Introduce a type system for the transform dialect. A transform IR type captures the expectations of the transform IR on the payload IR operations that are being transformed, such as being of a certain kind or implementing an interface that enables the transformation. This provides stricter checking and better readability of the transform IR than using the catch-all "handle" type. This change implements the basic support for a type system amendable to dialect extensions and adds a drop-in replacement for the unrestricted "handle" type. The actual switch of transform dialect ops to that type will happen in a separate commit. See https://discourse.llvm.org/t/rfc-type-system-for-the-transform-dialect/65702 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D135164
18 lines
697 B
MLIR
18 lines
697 B
MLIR
// RUN: mlir-opt %s | FileCheck %s
|
|
|
|
// These types and ops are defined by a test extension but should be okay to
|
|
// roundtrip.
|
|
|
|
// CHECK: transform.test_transform_op
|
|
transform.test_transform_op
|
|
|
|
// CHECK: = transform.test_produce_param_or_forward_operand 42 {foo = "bar"}
|
|
%0 = transform.test_produce_param_or_forward_operand 42 { foo = "bar" }
|
|
|
|
// CHECK: transform.test_consume_operand_if_matches_param_or_fail %{{.*}}[42]
|
|
transform.test_consume_operand_if_matches_param_or_fail %0[42]
|
|
|
|
// Ensure that the extension type is roundtripped correctly.
|
|
// CHECK: transform.cast %{{.*}} : !pdl.operation to !transform.test_dialect_op
|
|
%1 = transform.cast %0: !pdl.operation to !transform.test_dialect_op
|