Skip to content

Commit 931b473

Browse files
committed
Move builderCall parameter from custom attr class to DefaultValued(Optional)Attr
1 parent e98838d commit 931b473

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,10 @@ def MatmulOp : LinalgStructuredBase_Op<"matmul", [
624624
let arguments = (ins
625625
Variadic<AnyType>:$inputs,
626626
Variadic<AnyShaped>:$outputs,
627-
DefaultValuedContextDependentAttr<AffineMapArrayAttr,
627+
DefaultValuedOptionalAttr<AffineMapArrayAttr, "SmallVector<AffineMap>()",
628628
builderCall = [{ $_builder.getAffineMapArrayAttr(
629629
$0.empty() ? MatmulOp::getDefaultIndexingMaps($_builder.getContext()) : $0
630-
)}], default = "SmallVector<AffineMap>()">:$indexing_maps,
630+
)}]>:$indexing_maps,
631631
DefaultValuedOptionalAttr<TypeFnAttr, "TypeFn::cast_signed">:$cast
632632
);
633633
let results = (outs Variadic<AnyRankedTensor>:$result_tensors);

mlir/include/mlir/IR/CommonAttrConstraints.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ class DialectAttr<Dialect d, Pred condition, string summary = ""> :
9090
// Attribute modifier definition
9191

9292
// Decorates an attribute to have an (unvalidated) default value if not present.
93-
class DefaultValuedAttr<Attr attr, string val> :
93+
class DefaultValuedAttr<Attr attr, string val, string builderCall = ""> :
9494
Attr<attr.predicate, attr.summary> {
9595
// Construct this attribute with the input attribute and change only
9696
// the default value.
9797
// Note: this has to be kept up to date with Attr above.
9898
let storageType = attr.storageType;
9999
let returnType = attr.returnType;
100100
let convertFromStorage = attr.convertFromStorage;
101-
let constBuilderCall = attr.constBuilderCall;
101+
let constBuilderCall = !if(!eq(builderCall, ""), attr.constBuilderCall, builderCall);
102102
let defaultValue = val;
103103
let valueType = attr.valueType;
104104

@@ -107,15 +107,15 @@ class DefaultValuedAttr<Attr attr, string val> :
107107

108108
// Decorates an optional attribute to have an (unvalidated) default value
109109
// return by ODS generated accessors if not present.
110-
class DefaultValuedOptionalAttr<Attr attr, string val> :
110+
class DefaultValuedOptionalAttr<Attr attr, string val, string builderCall = ""> :
111111
Attr<attr.predicate, attr.summary> {
112112
// Construct this attribute with the input attribute and change only
113113
// the default value.
114114
// Note: this has to be kept up to date with Attr above.
115115
let storageType = attr.storageType;
116116
let returnType = attr.returnType;
117117
let convertFromStorage = attr.convertFromStorage;
118-
let constBuilderCall = attr.constBuilderCall;
118+
let constBuilderCall = !if(!eq(builderCall, ""), attr.constBuilderCall, builderCall);
119119
let defaultValue = val;
120120
let valueType = attr.valueType;
121121
let isOptional = 1;

0 commit comments

Comments
 (0)