Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dialects: (transform) Define non-parametrized transform types #2860

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/filecheck/dialects/transform/transform_types.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: XDSL_ROUNDTRIP

%0 = "test.op"() : () -> (!transform.affine_map)
%1 = "test.op"() : () -> (!transform.any_op)
%2 = "test.op"() : () -> (!transform.any_param)
%3 = "test.op"() : () -> (!transform.any_value)

// CHECK-NEXT: module {
// CHECK-NEXT: %0 = "test.op"() : () -> !transform.affine_map
// CHECK-NEXT: %1 = "test.op"() : () -> !transform.any_op
// CHECK-NEXT: %2 = "test.op"() : () -> !transform.any_param
// CHECK-NEXT: %3 = "test.op"() : () -> !transform.any_value
// CHECK-NEXT: }
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// RUN: xdsl-opt %s | xdsl-opt | mlir-opt --allow-unregistered-dialect | filecheck %s

%0 = "test.op"() : () -> (!transform.affine_map)
%1 = "test.op"() : () -> (!transform.any_op)
%2 = "test.op"() : () -> (!transform.any_param)
%3 = "test.op"() : () -> (!transform.any_value)

// CHECK-NEXT: module {
// CHECK-NEXT: %0 = "test.op"() : () -> !transform.affine_map
// CHECK-NEXT: %1 = "test.op"() : () -> !transform.any_op
// CHECK-NEXT: %2 = "test.op"() : () -> !transform.any_param
// CHECK-NEXT: %3 = "test.op"() : () -> !transform.any_value
// CHECK-NEXT: }
6 changes: 6 additions & 0 deletions xdsl/dialects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@ def get_x86():

return X86

def get_transform():
from xdsl.dialects.transform import Transform

return Transform

return {
"accfg": get_accfg,
"affine": get_affine,
Expand Down Expand Up @@ -331,4 +336,5 @@ def get_x86():
"vector": get_vector,
"wasm": get_wasm,
"x86": get_x86,
"transform": get_transform,
}
41 changes: 41 additions & 0 deletions xdsl/dialects/transform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from xdsl.ir import (
Dialect,
ParametrizedAttribute,
TypeAttribute,
)
from xdsl.irdl import (
irdl_attr_definition,
)


@irdl_attr_definition
class AffineMapType(ParametrizedAttribute, TypeAttribute):
name = "transform.affine_map"


@irdl_attr_definition
class AnyOpType(ParametrizedAttribute, TypeAttribute):
name = "transform.any_op"


@irdl_attr_definition
class AnyParamType(ParametrizedAttribute, TypeAttribute):
name = "transform.any_param"


@irdl_attr_definition
class AnyValueType(ParametrizedAttribute, TypeAttribute):
name = "transform.any_value"


Transform = Dialect(
"transform",
[],
[
# TYpes
AffineMapType,
AnyOpType,
AnyParamType,
AnyValueType,
],
)
Loading