[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.
This commit is contained in:
Ingo Müller 2023-09-19 10:34:47 +02:00 committed by GitHub
parent 159e94a0c3
commit 86ddbdd3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -366,7 +366,7 @@ class MaskedVectorizeOp:
def __init__(
self,
target: Union[Operation, OpView, Value],
vector_sizes: Union[DynamicIndexList, ArrayAttr],
vector_sizes: Optional[Union[DynamicIndexList, ArrayAttr]] = None,
*,
vectorize_nd_extract: Optional[bool] = None,
scalable_sizes: OptionalBoolList = None,
@ -374,7 +374,13 @@ class MaskedVectorizeOp:
loc=None,
ip=None,
):
if scalable_sizes is None and static_vector_sizes is None:
if (
scalable_sizes is None
and static_vector_sizes is None
and vector_sizes is None
):
dynamic_vector_sizes = []
elif scalable_sizes is None and static_vector_sizes is None:
(
dynamic_vector_sizes,
static_vector_sizes,

View File

@ -169,6 +169,16 @@ def testMatchOpNamesList(target):
# CHECK-SAME: (!transform.any_op) -> !transform.any_op
@run
@create_sequence
def testMaskedVectorizeNoArgs(target):
structured.MaskedVectorizeOp(target)
# CHECK-LABEL: TEST: testMaskedVectorizeNoArgs
# CHECK: transform.sequence
# CHECK: transform.structured.masked_vectorize
# CHECK-NOT: vector_sizes
@run
@create_sequence
def testMaskedVectorizeStatic(target):