[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
|
|
|
//===-------------------------------------------------------*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-10-08 08:30:10 +08:00
|
|
|
#ifndef REFBACK_OPS
|
|
|
|
#define REFBACK_OPS
|
[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
|
|
|
|
2020-10-08 08:30:10 +08:00
|
|
|
include "npcomp/Dialect/Refback/IR/RefbackBase.td"
|
[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
|
|
|
include "mlir/Dialect/Shape/IR/ShapeBase.td"
|
|
|
|
include "mlir/Interfaces/SideEffectInterfaces.td"
|
|
|
|
include "mlir/Interfaces/InferTypeOpInterface.td"
|
|
|
|
include "mlir/Interfaces/ControlFlowInterfaces.td"
|
|
|
|
include "mlir/IR/SymbolInterfaces.td"
|
|
|
|
|
2020-10-08 08:30:10 +08:00
|
|
|
class Refback_Op<string mnemonic, list<OpTrait> traits = []>
|
|
|
|
: Op<Refback_Dialect, mnemonic, traits> {
|
[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
|
|
|
}
|
|
|
|
|
2020-10-08 08:30:10 +08:00
|
|
|
def Refback_GlobalOp : Refback_Op<"global", [Symbol]> {
|
[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
|
|
|
let summary = "Represents a global variable";
|
|
|
|
let description = [{
|
|
|
|
Represents a global variable.
|
|
|
|
|
|
|
|
Currently, only constant tensors are supported, and they are not
|
|
|
|
considered to be exported.
|
|
|
|
}];
|
|
|
|
let arguments = (ins StrAttr:$sym_name, ElementsAttr:$value);
|
|
|
|
let results = (outs);
|
|
|
|
|
|
|
|
let printer = [{ return ::print$cppClass(p, *this); }];
|
|
|
|
let parser = [{ return ::parse$cppClass(parser, result); }];
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
2020-10-15 10:28:43 +08:00
|
|
|
// Ops related to bufferization.
|
[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
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-10-08 08:30:10 +08:00
|
|
|
def Refback_AllocMemRefOp : Refback_Op<"alloc_memref", []> {
|
[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
|
|
|
let summary = "Allocates a memref of the given shape.";
|
|
|
|
let description = [{
|
|
|
|
Allocates a memref of the given shape.
|
|
|
|
|
|
|
|
This op is a convenience for creating a bunch of
|
|
|
|
shape.get_extent + std.alloc ops.
|
|
|
|
}];
|
|
|
|
let arguments = (ins Shape_ExtentTensorType:$shape);
|
|
|
|
let results = (outs AnyMemRef:$memref);
|
|
|
|
let assemblyFormat = "$shape attr-dict `:` type($memref)";
|
|
|
|
}
|
|
|
|
|
2020-10-08 08:30:10 +08:00
|
|
|
def Refback_GetGlobalMemrefOp : Refback_Op<"get_global_memref"> {
|
[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
|
|
|
let summary = "Obtain a memref pointing at the given global";
|
|
|
|
let description = [{
|
|
|
|
Obtain a memref pointing at the given global.
|
|
|
|
}];
|
|
|
|
let arguments = (ins FlatSymbolRefAttr:$global);
|
|
|
|
let results = (outs AnyMemRef:$memref);
|
|
|
|
let assemblyFormat = "$global attr-dict `:` type($memref)";
|
|
|
|
let verifier = "return ::verify$cppClass(*this);";
|
|
|
|
}
|
|
|
|
|
2020-10-08 08:30:10 +08:00
|
|
|
#endif // REFBACK_OPS
|