-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[mlir][tosa] Move variable op definitions to TosaOps.td (NFC)
#165260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Variable ops (VARIABLE/VARIABLE_READ/VARIABLE_WRITE) are part of the TOSA specification and should therefore be defined in `TosaOps.td`. Change-Id: I4c675da45ece85063e76bf71c74953b3372fb82a
|
@llvm/pr-subscribers-mlir-tosa Author: Luke Hutton (lhutton1) ChangesVariable ops (VARIABLE/VARIABLE_READ/VARIABLE_WRITE) are part of the TOSA specification and should therefore be defined in Full diff: https://github.com/llvm/llvm-project/pull/165260.diff 2 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 6f07247b478c8..ae20051685f8e 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -19,6 +19,7 @@ include "mlir/IR/OpBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/LoopLikeInterface.td"
+include "mlir/IR/SymbolInterfaces.td"
include "mlir/Dialect/Tosa/IR/TosaInterfaces.td"
include "mlir/Dialect/Tosa/IR/TosaTypesBase.td"
@@ -2751,6 +2752,106 @@ def Tosa_WhileOp : Tosa_Op<"while_loop", [
let hasVerifier = 1;
}
+//===----------------------------------------------------------------------===//
+// Operator: variable
+//===----------------------------------------------------------------------===//
+def Tosa_VariableOp : Tosa_Op<"variable", [Symbol]> {
+ let summary = "Defines a variable";
+
+ let description = [{
+ Defines a new TOSA variable. This is a persistent mutable value across multiple
+ TOSA graph invocations. Modifications are expressed using read/write semantics.
+ }];
+
+ let arguments = (ins
+ // Note: "sym_name" is used as opposed to "name" in the specification,
+ // since a Symbol must be named "sym_name" for it to be recognised by
+ // the containing SymbolTable.
+ SymbolNameAttr:$sym_name,
+ IndexElementsAttr:$var_shape,
+ TypeAttr:$type,
+ OptionalAttr<AnyAttr>:$initial_value
+ );
+
+ list<Availability> availability = [
+ Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
+ Extension<[Tosa_EXT_VARIABLE]>,
+ ];
+
+ let hasCustomAssemblyFormat = 1;
+
+ let assemblyFormat = [{
+ $sym_name
+ attr-dict
+ custom<VariableOpTypeOrInitialValue>($var_shape, $type, $initial_value)
+ }];
+
+ let builders = [Tosa_VariableOpBuilder];
+
+ let extraClassDeclaration = [{
+ ::llvm::StringRef getName() {
+ return getSymName();
+ }
+ }];
+}
+
+//===----------------------------------------------------------------------===//
+// Operator: variable_write
+//===----------------------------------------------------------------------===//
+def Tosa_VariableWriteOp : Tosa_Op<"variable_write", []> {
+ let summary = "write_buffer operator";
+
+ let description = [{
+ Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.
+ }];
+
+ let arguments = (ins
+ SymbolNameAttr:$name,
+ Tosa_Tensor:$input1
+ );
+
+ list<Availability> availability = [
+ Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
+ Extension<[Tosa_EXT_VARIABLE]>,
+ ];
+
+ let assemblyFormat = [{
+ $name attr-dict `,` $input1 `:` type($input1)
+ }];
+
+ let hasVerifier = 1;
+}
+
+//===----------------------------------------------------------------------===//
+// Operator: variable_read
+//===----------------------------------------------------------------------===//
+def Tosa_VariableReadOp : Tosa_Op<"variable_read", []> {
+ let summary = "read_buffer operator";
+
+ let description = [{
+ Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.
+ }];
+
+ let arguments = (ins
+ SymbolNameAttr:$name
+ );
+
+ let results = (outs
+ Tosa_Tensor:$output1
+ );
+
+ list<Availability> availability = [
+ Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
+ Extension<[Tosa_EXT_VARIABLE]>,
+ ];
+
+ let assemblyFormat = [{
+ $name attr-dict `:` type($output1)
+ }];
+
+ let hasVerifier = 1;
+}
+
include "mlir/Dialect/Tosa/IR/TosaUtilOps.td"
include "mlir/Dialect/Tosa/IR/TosaShapeOps.td"
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
index f1a618e75061b..4c71089c50fba 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
@@ -18,7 +18,6 @@
include "mlir/IR/OpBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
-include "mlir/IR/SymbolInterfaces.td"
include "mlir/Interfaces/LoopLikeInterface.td"
include "mlir/Interfaces/VectorInterfaces.td"
include "mlir/Dialect/Tosa/IR/TosaInterfaces.td"
@@ -80,104 +79,4 @@ def Tosa_YieldOp : Tosa_Op<"yield", [
let assemblyFormat = "$inputs attr-dict `:` type($inputs)";
}
-//===----------------------------------------------------------------------===//
-// Operator: variable
-//===----------------------------------------------------------------------===//
-def Tosa_VariableOp : Tosa_Op<"variable", [Symbol]> {
- let summary = "Defines a variable";
-
- let description = [{
- Defines a new TOSA variable. This is a persistent mutable value across multiple
- TOSA graph invocations. Modifications are expressed using read/write semantics.
- }];
-
- let arguments = (ins
- // Note: "sym_name" is used as opposed to "name" in the specification,
- // since a Symbol must be named "sym_name" for it to be recognised by
- // the containing SymbolTable.
- SymbolNameAttr:$sym_name,
- IndexElementsAttr:$var_shape,
- TypeAttr:$type,
- OptionalAttr<AnyAttr>:$initial_value
- );
-
- list<Availability> availability = [
- Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
- Extension<[Tosa_EXT_VARIABLE]>,
- ];
-
- let hasCustomAssemblyFormat = 1;
-
- let assemblyFormat = [{
- $sym_name
- attr-dict
- custom<VariableOpTypeOrInitialValue>($var_shape, $type, $initial_value)
- }];
-
- let builders = [Tosa_VariableOpBuilder];
-
- let extraClassDeclaration = [{
- ::llvm::StringRef getName() {
- return getSymName();
- }
- }];
-}
-
-//===----------------------------------------------------------------------===//
-// Operator: variable_write
-//===----------------------------------------------------------------------===//
-def Tosa_VariableWriteOp : Tosa_Op<"variable_write", []> {
- let summary = "write_buffer operator";
-
- let description = [{
- Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.
- }];
-
- let arguments = (ins
- SymbolNameAttr:$name,
- Tosa_Tensor:$input1
- );
-
- list<Availability> availability = [
- Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
- Extension<[Tosa_EXT_VARIABLE]>,
- ];
-
- let assemblyFormat = [{
- $name attr-dict `,` $input1 `:` type($input1)
- }];
-
- let hasVerifier = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// Operator: variable_read
-//===----------------------------------------------------------------------===//
-def Tosa_VariableReadOp : Tosa_Op<"variable_read", []> {
- let summary = "read_buffer operator";
-
- let description = [{
- Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.
- }];
-
- let arguments = (ins
- SymbolNameAttr:$name
- );
-
- let results = (outs
- Tosa_Tensor:$output1
- );
-
- list<Availability> availability = [
- Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
- Extension<[Tosa_EXT_VARIABLE]>,
- ];
-
- let assemblyFormat = [{
- $name attr-dict `:` type($output1)
- }];
-
- let hasVerifier = 1;
-}
-
#endif // TOSA_UTIL_OPS
|
|
@llvm/pr-subscribers-mlir Author: Luke Hutton (lhutton1) ChangesVariable ops (VARIABLE/VARIABLE_READ/VARIABLE_WRITE) are part of the TOSA specification and should therefore be defined in Full diff: https://github.com/llvm/llvm-project/pull/165260.diff 2 Files Affected:
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 6f07247b478c8..ae20051685f8e 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -19,6 +19,7 @@ include "mlir/IR/OpBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/Interfaces/InferTypeOpInterface.td"
include "mlir/Interfaces/LoopLikeInterface.td"
+include "mlir/IR/SymbolInterfaces.td"
include "mlir/Dialect/Tosa/IR/TosaInterfaces.td"
include "mlir/Dialect/Tosa/IR/TosaTypesBase.td"
@@ -2751,6 +2752,106 @@ def Tosa_WhileOp : Tosa_Op<"while_loop", [
let hasVerifier = 1;
}
+//===----------------------------------------------------------------------===//
+// Operator: variable
+//===----------------------------------------------------------------------===//
+def Tosa_VariableOp : Tosa_Op<"variable", [Symbol]> {
+ let summary = "Defines a variable";
+
+ let description = [{
+ Defines a new TOSA variable. This is a persistent mutable value across multiple
+ TOSA graph invocations. Modifications are expressed using read/write semantics.
+ }];
+
+ let arguments = (ins
+ // Note: "sym_name" is used as opposed to "name" in the specification,
+ // since a Symbol must be named "sym_name" for it to be recognised by
+ // the containing SymbolTable.
+ SymbolNameAttr:$sym_name,
+ IndexElementsAttr:$var_shape,
+ TypeAttr:$type,
+ OptionalAttr<AnyAttr>:$initial_value
+ );
+
+ list<Availability> availability = [
+ Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
+ Extension<[Tosa_EXT_VARIABLE]>,
+ ];
+
+ let hasCustomAssemblyFormat = 1;
+
+ let assemblyFormat = [{
+ $sym_name
+ attr-dict
+ custom<VariableOpTypeOrInitialValue>($var_shape, $type, $initial_value)
+ }];
+
+ let builders = [Tosa_VariableOpBuilder];
+
+ let extraClassDeclaration = [{
+ ::llvm::StringRef getName() {
+ return getSymName();
+ }
+ }];
+}
+
+//===----------------------------------------------------------------------===//
+// Operator: variable_write
+//===----------------------------------------------------------------------===//
+def Tosa_VariableWriteOp : Tosa_Op<"variable_write", []> {
+ let summary = "write_buffer operator";
+
+ let description = [{
+ Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.
+ }];
+
+ let arguments = (ins
+ SymbolNameAttr:$name,
+ Tosa_Tensor:$input1
+ );
+
+ list<Availability> availability = [
+ Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
+ Extension<[Tosa_EXT_VARIABLE]>,
+ ];
+
+ let assemblyFormat = [{
+ $name attr-dict `,` $input1 `:` type($input1)
+ }];
+
+ let hasVerifier = 1;
+}
+
+//===----------------------------------------------------------------------===//
+// Operator: variable_read
+//===----------------------------------------------------------------------===//
+def Tosa_VariableReadOp : Tosa_Op<"variable_read", []> {
+ let summary = "read_buffer operator";
+
+ let description = [{
+ Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.
+ }];
+
+ let arguments = (ins
+ SymbolNameAttr:$name
+ );
+
+ let results = (outs
+ Tosa_Tensor:$output1
+ );
+
+ list<Availability> availability = [
+ Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
+ Extension<[Tosa_EXT_VARIABLE]>,
+ ];
+
+ let assemblyFormat = [{
+ $name attr-dict `:` type($output1)
+ }];
+
+ let hasVerifier = 1;
+}
+
include "mlir/Dialect/Tosa/IR/TosaUtilOps.td"
include "mlir/Dialect/Tosa/IR/TosaShapeOps.td"
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
index f1a618e75061b..4c71089c50fba 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaUtilOps.td
@@ -18,7 +18,6 @@
include "mlir/IR/OpBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
-include "mlir/IR/SymbolInterfaces.td"
include "mlir/Interfaces/LoopLikeInterface.td"
include "mlir/Interfaces/VectorInterfaces.td"
include "mlir/Dialect/Tosa/IR/TosaInterfaces.td"
@@ -80,104 +79,4 @@ def Tosa_YieldOp : Tosa_Op<"yield", [
let assemblyFormat = "$inputs attr-dict `:` type($inputs)";
}
-//===----------------------------------------------------------------------===//
-// Operator: variable
-//===----------------------------------------------------------------------===//
-def Tosa_VariableOp : Tosa_Op<"variable", [Symbol]> {
- let summary = "Defines a variable";
-
- let description = [{
- Defines a new TOSA variable. This is a persistent mutable value across multiple
- TOSA graph invocations. Modifications are expressed using read/write semantics.
- }];
-
- let arguments = (ins
- // Note: "sym_name" is used as opposed to "name" in the specification,
- // since a Symbol must be named "sym_name" for it to be recognised by
- // the containing SymbolTable.
- SymbolNameAttr:$sym_name,
- IndexElementsAttr:$var_shape,
- TypeAttr:$type,
- OptionalAttr<AnyAttr>:$initial_value
- );
-
- list<Availability> availability = [
- Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
- Extension<[Tosa_EXT_VARIABLE]>,
- ];
-
- let hasCustomAssemblyFormat = 1;
-
- let assemblyFormat = [{
- $sym_name
- attr-dict
- custom<VariableOpTypeOrInitialValue>($var_shape, $type, $initial_value)
- }];
-
- let builders = [Tosa_VariableOpBuilder];
-
- let extraClassDeclaration = [{
- ::llvm::StringRef getName() {
- return getSymName();
- }
- }];
-}
-
-//===----------------------------------------------------------------------===//
-// Operator: variable_write
-//===----------------------------------------------------------------------===//
-def Tosa_VariableWriteOp : Tosa_Op<"variable_write", []> {
- let summary = "write_buffer operator";
-
- let description = [{
- Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.
- }];
-
- let arguments = (ins
- SymbolNameAttr:$name,
- Tosa_Tensor:$input1
- );
-
- list<Availability> availability = [
- Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
- Extension<[Tosa_EXT_VARIABLE]>,
- ];
-
- let assemblyFormat = [{
- $name attr-dict `,` $input1 `:` type($input1)
- }];
-
- let hasVerifier = 1;
-}
-
-//===----------------------------------------------------------------------===//
-// Operator: variable_read
-//===----------------------------------------------------------------------===//
-def Tosa_VariableReadOp : Tosa_Op<"variable_read", []> {
- let summary = "read_buffer operator";
-
- let description = [{
- Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.
- }];
-
- let arguments = (ins
- SymbolNameAttr:$name
- );
-
- let results = (outs
- Tosa_Tensor:$output1
- );
-
- list<Availability> availability = [
- Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>,
- Extension<[Tosa_EXT_VARIABLE]>,
- ];
-
- let assemblyFormat = [{
- $name attr-dict `:` type($output1)
- }];
-
- let hasVerifier = 1;
-}
-
#endif // TOSA_UTIL_OPS
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me, seems no functional change.
…#165260) Variable ops (VARIABLE/VARIABLE_READ/VARIABLE_WRITE) are part of the TOSA specification and should therefore be defined in `TosaOps.td`.
…#165260) Variable ops (VARIABLE/VARIABLE_READ/VARIABLE_WRITE) are part of the TOSA specification and should therefore be defined in `TosaOps.td`.
Variable ops (VARIABLE/VARIABLE_READ/VARIABLE_WRITE) are part of the TOSA specification and should therefore be defined in
TosaOps.td.