Skip to content

Commit 27cb073

Browse files
committed
[Heavy] Improve nbdl dialect
1 parent 166bea1 commit 27cb073

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

heavy/include/nbdl_gen/Nbdl.td

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
include "mlir/IR/AttrTypeBase.td"
1212
include "mlir/IR/OpBase.td"
13+
include "mlir/IR/SymbolInterfaces.td"
1314

1415
def Nbdl_Dialect : Dialect {
1516
let name = "nbdl";
@@ -210,18 +211,25 @@ def Nbdl_ConstexprOp : Nbdl_Op<"constexpr", []> {
210211
let results = (outs Nbdl_OpaqueType:$result);
211212
}
212213

213-
def Nbdl_StoreComposeOp : NbdlOp<"store_compose", []> {
214+
def Nbdl_StoreComposeOp : Nbdl_Op<"store_compose", []> {
214215
let description = [{
215216
Add a store $rhs as a member to another store $lhs using a key $key
216217
to access the member. The set of keys in $lhs are shadowed by their
217218
intersection with $key.
219+
220+
If the optional construction argument is present, then
221+
$key must be a Nbdl_Symbol and the path depth must be 1.
218222
}];
219223

220-
let arguments = (ins Nbdl_Type:$lhs, Nbdl_Type:$rhs, Nbdl_KeyAttr:$key);
224+
let arguments = (ins
225+
Nbdl_Type:$lhs,
226+
Nbdl_KeyAttr:$key,
227+
Nbdl_Type:$rhs,
228+
Optional<Nbdl_OpaqueType>:$cnstrArg);
221229
let results = (outs Nbdl_Type:$result);
222230
}
223231

224-
def Nbdl_VariantOp : NbdlOp<"variant", []> {
232+
def Nbdl_VariantOp : Nbdl_Op<"variant", []> {
225233
let description = [{
226234
Create a sum type provided stores.
227235

@@ -232,7 +240,7 @@ def Nbdl_VariantOp : NbdlOp<"variant", []> {
232240
let results = (outs Nbdl_Variant:$result);
233241
}
234242

235-
def Nbdl_CreateStoreOp : NbdlOp<"create_store", [Symbol, IsolatedFromAbove]> {
243+
def Nbdl_CreateStoreOp : Nbdl_Op<"create_store", [Symbol, IsolatedFromAbove]> {
236244
let description = [{
237245
If no region exists, then the operation is considered external
238246
and should refer to an existing C++ type that satisfies nbdl::Store.
@@ -244,7 +252,9 @@ def Nbdl_CreateStoreOp : NbdlOp<"create_store", [Symbol, IsolatedFromAbove]> {
244252
created type is a Tag.
245253
}];
246254
let regions = (region AnyRegion:$body);
247-
let arguments = (ins FlatSymbolRefAttr:$name);
255+
let arguments = (ins
256+
FlatSymbolRefAttr:$name,
257+
OptionalAttr<DictArrayAttr>:$cnstrArgs);
248258
let results = (outs);
249259
}
250260

0 commit comments

Comments
 (0)