llvm-project/mlir/test/python/dialects/transform_x86vector_ext.py
Adam Siemieniuk ba58225a0a
[mlir][x86vector] Python bindings for x86vector dialect (#179958)
Registers python bindings for x86vector dialect and transform ops.
2026-02-05 20:05:17 +01:00

41 lines
1.5 KiB
Python

# RUN: %PYTHON %s | FileCheck %s
from mlir.ir import *
from mlir.dialects import transform
from mlir.dialects.transform import x86vector
def run_apply_patterns(f):
with Context(), Location.unknown():
module = Module.create()
with InsertionPoint(module.body):
sequence = transform.SequenceOp(
transform.FailurePropagationMode.Propagate,
[],
transform.AnyOpType.get(),
)
with InsertionPoint(sequence.body):
apply = transform.ApplyPatternsOp(sequence.bodyTarget)
with InsertionPoint(apply.patterns):
f()
transform.YieldOp()
print("\nTEST:", f.__name__)
print(module)
return f
@run_apply_patterns
def non_configurable_patterns():
# CHECK-LABEL: TEST: non_configurable_patterns
# CHECK: apply_patterns
# CHECK: transform.apply_patterns.x86vector.vector_contract_to_fma
x86vector.ApplyVectorContractToFMAPatternsOp()
# CHECK: transform.apply_patterns.x86vector.vector_contract_to_packed_type_dot_product
x86vector.ApplyVectorContractToPackedTypeDotProductPatternsOp()
# CHECK: transform.apply_patterns.x86vector.vector_contract_bf16_to_fma
x86vector.ApplyVectorContractBF16ToFMAPatternsOp()
# CHECK: transform.apply_patterns.x86vector.sink_vector_producer_ops
x86vector.ApplySinkVectorProducerOpsPatternsOp()
# CHECK: transform.apply_patterns.x86vector.shuffle_vector_fma_ops
x86vector.ApplyShuffleVectorFMAOpsPatternsOp()