CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
104 lines
2.8 KiB
TableGen
104 lines
2.8 KiB
TableGen
// RUN: mlir-tblgen -gen-rewriters -I %S/../../include %s | FileCheck %s
|
|
|
|
include "mlir/IR/OpBase.td"
|
|
include "mlir/IR/PatternBase.td"
|
|
|
|
def Test_Dialect : Dialect {
|
|
let name = "test";
|
|
}
|
|
class NS_Op<string mnemonic, list<Trait> traits> :
|
|
Op<Test_Dialect, mnemonic, traits>;
|
|
|
|
def AOp : NS_Op<"a_op", []> {
|
|
let arguments = (ins
|
|
AnyInteger:$any_integer
|
|
);
|
|
|
|
let results = (outs AnyInteger);
|
|
}
|
|
|
|
def BOp : NS_Op<"b_op", []> {
|
|
let arguments = (ins
|
|
AnyAttr: $any_attr,
|
|
AnyInteger
|
|
);
|
|
|
|
let results = (outs AnyInteger);
|
|
}
|
|
|
|
def COp : NS_Op<"c_op", []> {
|
|
let arguments = (ins
|
|
AnyAttr: $any_attr,
|
|
AnyInteger
|
|
);
|
|
|
|
let results = (outs AnyInteger);
|
|
}
|
|
|
|
def DOp : NS_Op<"d_op", []> {
|
|
let arguments = (ins
|
|
Variadic<AnyInteger>:$any_integer
|
|
);
|
|
|
|
let results = (outs AnyInteger);
|
|
}
|
|
|
|
def Foo : NativeCodeCall<"foo($_builder, $0)">;
|
|
|
|
def NonNegProp : PropConstraint<CPred<"$_self >= 0">, "non-negative integer">;
|
|
|
|
def EOp : NS_Op<"e_op", []> {
|
|
let arguments = (ins
|
|
I32Prop:$x,
|
|
I64Prop:$y,
|
|
AnyInteger:$z
|
|
);
|
|
let results = (outs I32:$res);
|
|
}
|
|
|
|
def FOp: NS_Op<"f_op", []> {
|
|
let arguments = (ins
|
|
I32Prop:$a,
|
|
AnyInteger:$b
|
|
);
|
|
}
|
|
|
|
// Test static matcher for duplicate DagNode
|
|
// ---
|
|
|
|
// CHECK: static ::llvm::LogicalResult [[$TYPE_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
|
|
// CHECK-NEXT: {{.*::mlir::Type type}}
|
|
// CHECK: static ::llvm::LogicalResult [[$ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
|
|
// CHECK-NEXT: {{.*::mlir::Attribute attr}}
|
|
// CHECK: template <typename T>
|
|
// CHECK-NEXT: static ::llvm::LogicalResult [[$PROP_CONSTRAINT:__mlir_ods_local_prop_constraint.*]](
|
|
// CHECK-NEXT: {{.*T prop}}
|
|
// CHECK: static ::llvm::LogicalResult [[$DAG_MATCHER:static_dag_matcher.*]](
|
|
// CHECK: if(::mlir::failed([[$ATTR_CONSTRAINT]]
|
|
// CHECK: if(::mlir::failed([[$TYPE_CONSTRAINT]]
|
|
// CHECK: static ::llvm::LogicalResult [[$DAG_MATCHER2:static_dag_matcher.*]](
|
|
// CHECK-SAME: int32_t &x
|
|
// CHECK: if(::mlir::failed([[$PROP_CONSTRAINT]]
|
|
// CHECK: if(::mlir::failed([[$TYPE_CONSTRAINT]]
|
|
|
|
// CHECK: if(::mlir::failed([[$DAG_MATCHER]](rewriter, op1, tblgen_ops
|
|
def : Pat<(AOp (BOp I32Attr:$attr, I32:$int)),
|
|
(AOp $int)>;
|
|
|
|
// CHECK: if(::mlir::failed([[$DAG_MATCHER]](rewriter, op1, tblgen_ops
|
|
def : Pat<(COp $_, (BOp I32Attr:$attr, I32:$int)),
|
|
(COp $attr, $int)>;
|
|
|
|
// CHECK: auto [[$VAR:.*]] = foo(
|
|
// CHECK: ::llvm::SmallVector<::mlir::Value, 4> [[$ARR:tblgen_variadic_values_.*]];
|
|
// CHECK: [[$ARR]].push_back([[$VAR]]);
|
|
def : Pat<(AOp $x), (DOp (variadic (Foo $x)))>;
|
|
|
|
// CHECK: if(::mlir::failed([[$DAG_MATCHER2]]({{.*}} x{{[,)]}}
|
|
def : Pat<(AOp (EOp NonNegProp:$x, NonNegProp:$_, I32:$z)),
|
|
(AOp $z)>;
|
|
|
|
// CHECK: if(::mlir::failed([[$DAG_MATCHER2]]({{.*}} x{{[,)]}}
|
|
def : Pat<(FOp $_, (EOp NonNegProp:$x, NonNegProp:$_, I32:$z)),
|
|
(COp $x, $z)>;
|