Skip to content

Commit 86ddbdd

Browse files
[mlir][linalg][transform][python] Allow no args in MaskedVectorize. (#66541)
The mix-in of this op did not allow to pass in no argument. This special case is now handled correctly and covered by the tests.
1 parent 159e94a commit 86ddbdd

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

mlir/python/mlir/dialects/_structured_transform_ops_ext.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,21 @@ class MaskedVectorizeOp:
366366
def __init__(
367367
self,
368368
target: Union[Operation, OpView, Value],
369-
vector_sizes: Union[DynamicIndexList, ArrayAttr],
369+
vector_sizes: Optional[Union[DynamicIndexList, ArrayAttr]] = None,
370370
*,
371371
vectorize_nd_extract: Optional[bool] = None,
372372
scalable_sizes: OptionalBoolList = None,
373373
static_vector_sizes: OptionalIntList = None,
374374
loc=None,
375375
ip=None,
376376
):
377-
if scalable_sizes is None and static_vector_sizes is None:
377+
if (
378+
scalable_sizes is None
379+
and static_vector_sizes is None
380+
and vector_sizes is None
381+
):
382+
dynamic_vector_sizes = []
383+
elif scalable_sizes is None and static_vector_sizes is None:
378384
(
379385
dynamic_vector_sizes,
380386
static_vector_sizes,

mlir/test/python/dialects/transform_structured_ext.py

+10
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,16 @@ def testMatchOpNamesList(target):
169169
# CHECK-SAME: (!transform.any_op) -> !transform.any_op
170170

171171

172+
@run
173+
@create_sequence
174+
def testMaskedVectorizeNoArgs(target):
175+
structured.MaskedVectorizeOp(target)
176+
# CHECK-LABEL: TEST: testMaskedVectorizeNoArgs
177+
# CHECK: transform.sequence
178+
# CHECK: transform.structured.masked_vectorize
179+
# CHECK-NOT: vector_sizes
180+
181+
172182
@run
173183
@create_sequence
174184
def testMaskedVectorizeStatic(target):

0 commit comments

Comments
 (0)