[RefBackend] Split out RefBackend (refback) dialect from TCP.
This is the first in a patch series that is refactoring the
constellation of things variously called or associated with "E2E",
"RefE2E", "npcomprt", and "TCP" into a more cleanly layered result.
Concretely, this first patch fixes the fact that TCP was basically
acting like a dumping ground needed by the reference backend. This
splits it out, which is fairly mechanical, but touches a lot of lines of
code (basically replacing `tcp` with `refback` and `TCP` with
`RefBackend).
Now, the RefBackend dialect is that dumping ground, which
is slighly better, as it starts allowing TCP to become a nice clean
middle layer that is not related per se to the reference backend.
The previous name RefE2E or "reference e2e flow" was super confusing.
Now that we are seeing more clearly where the "backend" distinction
lies, the [RefBackend] commit tag is born :)
2020-10-07 06:44:18 +08:00
|
|
|
// RUN: npcomp-opt <%s | npcomp-opt | FileCheck %s
|
2020-09-22 10:14:27 +08:00
|
|
|
|
2020-11-10 07:49:22 +08:00
|
|
|
// CHECK-LABEL: @broadcast_to
|
|
|
|
func @broadcast_to(%arg0: tensor<?xf32>, %arg1: tensor<?xindex>) -> tensor<?x?xf32> {
|
|
|
|
// CHECK: tcp.broadcast_to
|
|
|
|
%0 = tcp.broadcast_to %arg0, %arg1 : (tensor<?xf32>, tensor<?xindex>) -> tensor<?x?xf32>
|
|
|
|
return %0 : tensor<?x?xf32>
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @splatted
|
|
|
|
func @splatted(%arg0: f32, %arg1: tensor<?xindex>) -> tensor<?x?xf32> {
|
|
|
|
// CHECK: tcp.splatted
|
|
|
|
%0 = tcp.splatted %arg0, %arg1 : (f32, tensor<?xindex>) -> tensor<?x?xf32>
|
2020-09-18 09:56:01 +08:00
|
|
|
return %0 : tensor<?x?xf32>
|
|
|
|
}
|
2020-12-18 02:56:46 +08:00
|
|
|
|
|
|
|
// CHECK-LABEL: @pad
|
|
|
|
func @pad(%arg0: tensor<?x?x?x?xf32>, %arg1: tensor<?xindex>, %arg2: tensor<?xindex>, %arg3: f32) -> tensor<?x?x?x?xf32> {
|
|
|
|
// CHECK: tcp.pad
|
|
|
|
%0 = tcp.pad %arg0, %arg1, %arg2, %arg3 : (tensor<?x?x?x?xf32>, tensor<?xindex>, tensor<?xindex>, f32) -> tensor<?x?x?x?xf32>
|
|
|
|
return %0 : tensor<?x?x?x?xf32>
|
|
|
|
}
|