@@ -65,14 +65,6 @@ def TosaOptionalDecompositionsPass
65
65
}];
66
66
}
67
67
68
- def TosaLevelType : I32EnumAttr<"TosaLevelEnum", "Tosa level",
69
- [
70
- I32EnumAttrCase<"None", 0, "none">,
71
- I32EnumAttrCase<"EightK", 1, "8k">,
72
- ]>{
73
- let cppNamespace = "mlir::tosa";
74
- }
75
-
76
68
def TosaValidation : Pass<"tosa-validate", "mlir::ModuleOp"> {
77
69
let summary = "Validates TOSA dialect";
78
70
let description = [{
@@ -81,28 +73,14 @@ def TosaValidation : Pass<"tosa-validate", "mlir::ModuleOp"> {
81
73
}];
82
74
83
75
let options = [
84
- ListOption<"profile", "profile", "std::string",
85
- "Validate if operations match for the given profile set">,
86
- ListOption<"extension", "extension", "std::string",
87
- "Validate if operations match for the given extension set">,
88
76
Option<"strictOpSpecAlignment", "strict-op-spec-alignment", "bool",
89
77
/*default=*/"false",
90
78
"Verify if the properties of certain operations align the spec requirement">,
91
79
Option<"allowInvalidOpDatatypeCombinations", "allow-invalid-op-datatype-combinations", "bool",
92
80
/*default=*/"false",
93
81
"Disable checks for operations that are determined to be invalid due to their "
94
82
"operand/result datatypes not aligning with the 'Supported Data Types' "
95
- "sections of the specifciation">,
96
- Option<"level", "level", "mlir::tosa::TosaLevelEnum",
97
- /*default=*/"mlir::tosa::TosaLevelEnum::EightK",
98
- "Validate if operator parameters are within specfication for the given level",
99
- [{::llvm::cl::values(
100
- clEnumValN(mlir::tosa::TosaLevelEnum::EightK, "8k",
101
- "Ranges are expected to be sufficient for applications with frame sizes up to 8K."),
102
- clEnumValN(mlir::tosa::TosaLevelEnum::None, "none",
103
- "Allows the full range of arguments specified by the operations according "
104
- "to the operation data types.")
105
- )}]>
83
+ "sections of the specifciation">
106
84
];
107
85
}
108
86
@@ -141,4 +119,44 @@ def TosaConvertIntegerTypeToSignless : Pass<"tosa-convert-integer-type-to-signle
141
119
}];
142
120
}
143
121
122
+ def TosaAttachTarget : Pass<"tosa-attach-target", "ModuleOp"> {
123
+ let summary = "Attach tosa.target_env information to the given module.";
124
+
125
+ let description = [{
126
+ This pass allows the user to specify a TOSA target environment consisting of
127
+ the following components: level, profiles and extensions.
128
+
129
+ The target environment is attached to the module as an attribute, allowing other
130
+ transformations to query the selected target and adapt their behaviour based on
131
+ this information.
132
+ }];
133
+
134
+ let dependentDialects = [
135
+ "func::FuncDialect",
136
+ "tosa::TosaDialect",
137
+ ];
138
+
139
+ let options = [
140
+ Option<"level", "level", "mlir::tosa::Level",
141
+ /*default=*/"mlir::tosa::Level::eightK",
142
+ "The TOSA level that operators should conform to. A TOSA level defines "
143
+ "operator argument ranges that an implementation shall support.",
144
+ [{::llvm::cl::values(
145
+ clEnumValN(mlir::tosa::Level::eightK, "8k",
146
+ "Ranges are expected to be sufficient for applications with frame "
147
+ "sizes up to 8K."),
148
+ clEnumValN(mlir::tosa::Level::none, "none",
149
+ "Allows the full range of arguments specified by the operations according "
150
+ "to the operation data types.")
151
+ )}]>,
152
+ ListOption<"profiles", "profiles", "std::string",
153
+ "The TOSA profile(s) that operators should conform to. TOSA profiles "
154
+ "enable efficient implementation on different classes of device. Each "
155
+ "profile is an independent set of operations and data type combinations.">,
156
+ ListOption<"extensions", "extensions", "std::string",
157
+ "The TOSA extension(s) that operators should conform to. TOSA profile "
158
+ "extensions define optional operation and data type combinations.">
159
+ ];
160
+ }
161
+
144
162
#endif // MLIR_DIALECT_TOSA_TRANSFORMS_PASSES
0 commit comments