Files
TheRock/compiler/amd-llvm/mlir/test/mlir-pdll/CodeGen/MLIR/decl.pdll
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

98 lines
3.2 KiB
Plaintext

// RUN: mlir-pdll %s -I %S -split-input-file -x mlir | FileCheck %s
//===----------------------------------------------------------------------===//
// PatternDecl
//===----------------------------------------------------------------------===//
// CHECK: pdl.pattern : benefit(0) {
Pattern => erase _: Op;
// -----
// CHECK: pdl.pattern @NamedPattern : benefit(0) {
Pattern NamedPattern => erase _: Op;
// -----
// CHECK: pdl.pattern @NamedPattern : benefit(10) {
Pattern NamedPattern with benefit(10), recursion => erase _: Op;
// -----
//===----------------------------------------------------------------------===//
// VariableDecl
//===----------------------------------------------------------------------===//
// Test the case of a variable with an initializer.
// CHECK: pdl.pattern @VarWithInit
// CHECK: %[[INIT:.*]] = operation "test.op"
// CHECK: rewrite %[[INIT]] {
// CHECK: erase %[[INIT]]
Pattern VarWithInit {
let var = op<test.op>;
erase var;
}
// -----
// Test range based constraints.
// CHECK: pdl.pattern @VarWithRangeConstraints
// CHECK: %[[OPERAND_TYPES:.*]] = types
// CHECK: %[[OPERANDS:.*]] = operands : %[[OPERAND_TYPES]]
// CHECK: %[[RESULT_TYPES:.*]] = types
// CHECK: operation(%[[OPERANDS]] : !pdl.range<value>) -> (%[[RESULT_TYPES]] : !pdl.range<type>)
Pattern VarWithRangeConstraints {
erase op<>(operands: ValueRange<operandTypes: TypeRange>) -> (results: TypeRange);
}
// -----
// Test single entity constraints.
// CHECK: pdl.pattern @VarWithConstraints
// CHECK: %[[OPERAND_TYPE:.*]] = type
// CHECK: %[[OPERAND:.*]] = operand : %[[OPERAND_TYPES]]
// CHECK: %[[ATTR_TYPE:.*]] = type
// CHECK: %[[ATTR:.*]] = attribute : %[[ATTR_TYPE]]
// CHECK: %[[RESULT_TYPE:.*]] = type
// CHECK: operation(%[[OPERAND]] : !pdl.value) {"attr" = %[[ATTR]]} -> (%[[RESULT_TYPE]] : !pdl.type)
Pattern VarWithConstraints {
erase op<>(operand: Value<operandType: Type>) { attr = _: Attr<attrType: Type>} -> (result: Type);
}
// -----
// Test op constraint.
// CHECK: pdl.pattern @VarWithNoNameOpConstraint
// CHECK: %[[OPERANDS:.*]] = operands
// CHECK: %[[RESULT_TYPES:.*]] = types
// CHECK: operation(%[[OPERANDS]] : !pdl.range<value>) -> (%[[RESULT_TYPES]] : !pdl.range<type>)
Pattern VarWithNoNameOpConstraint => erase _: Op;
// CHECK: pdl.pattern @VarWithNamedOpConstraint
// CHECK: %[[OPERANDS:.*]] = operands
// CHECK: %[[RESULT_TYPES:.*]] = types
// CHECK: operation "test.op"(%[[OPERANDS]] : !pdl.range<value>) -> (%[[RESULT_TYPES]] : !pdl.range<type>)
Pattern VarWithNamedOpConstraint => erase _: Op<test.op>;
// -----
// Test user defined constraints.
// CHECK: pdl.pattern @VarWithUserConstraint
// CHECK: %[[OPERANDS:.*]] = operands
// CHECK: %[[RESULT_TYPES:.*]] = types
// CHECK: %[[OP:.*]] = operation(%[[OPERANDS]] : !pdl.range<value>) -> (%[[RESULT_TYPES]] : !pdl.range<type>)
// CHECK: apply_native_constraint "NestedArgCst"(%[[OP]] : !pdl.operation)
// CHECK: apply_native_constraint "NestedResCst"(%[[OP]] : !pdl.operation)
// CHECK: apply_native_constraint "OpCst"(%[[OP]] : !pdl.operation)
// CHECK: rewrite %[[OP]]
Constraint NestedArgCst(op: Op);
Constraint NestedResCst(op: Op);
Constraint TestArgResCsts(op: NestedArgCst) -> NestedResCst => op;
Constraint OpCst(op: Op);
Pattern VarWithUserConstraint => erase _: [TestArgResCsts, OpCst];