Files
TheRock/compiler/amd-llvm/mlir/test/Dialect/Affine/transform-op-simplify-min-max-ops.mlir
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

69 lines
3.4 KiB
MLIR

// RUN: mlir-opt %s --transform-interpreter --split-input-file | FileCheck %s
// CHECK-DAG: #[[MAP_0:.*]] = affine_map<()[s0] -> (32, s0)>
// CHECK-DAG: #[[MAP_1:.*]] = affine_map<()[s0, s1] -> (s1, s0)>
// CHECK-DAG: #[[MAP_2:.*]] = affine_map<()[s0] -> (256, s0)>
// CHECK: @min_max_full_simplify
func.func @min_max_full_simplify() -> (index, index) {
%0 = test.value_with_bounds {max = 128 : index, min = 0 : index}
%1 = test.value_with_bounds {max = 512 : index, min = 256 : index}
// CHECK: %[[V0:.*]] = test.value_with_bounds {max = 128 : index, min = 0 : index}
// CHECK: %[[V1:.*]] = test.value_with_bounds {max = 512 : index, min = 256 : index}
// CHECK-NOT: affine.min
// CHECK-NOT: affine.max
// CHECK: return %[[V0]], %[[V1]]
%r0 = affine.min affine_map<()[s0, s1] -> (s0, 192, s1)>()[%0, %1]
%r1 = affine.max affine_map<()[s0, s1] -> (s0, 192, s1)>()[%0, %1]
return %r0, %r1 : index, index
}
// CHECK: @min_only_simplify
func.func @min_only_simplify() -> (index, index) {
// CHECK: %[[V0:.*]] = test.value_with_bounds {max = 512 : index, min = 0 : index}
// CHECK: %[[V1:.*]] = test.value_with_bounds {max = 512 : index, min = 256 : index}
// CHECK: affine.min #[[MAP_0]]()[%[[V0]]]
// CHECK: affine.max #[[MAP_1]]()[%[[V0]], %[[V1]]]
%0 = test.value_with_bounds {max = 512 : index, min = 0 : index}
%1 = test.value_with_bounds {max = 512 : index, min = 256 : index}
%r0 = affine.min affine_map<()[s0, s1] -> (s0, 32, s1)>()[%0, %1]
%r1 = affine.max affine_map<()[s0, s1] -> (s0, 32, s1)>()[%0, %1]
return %r0, %r1 : index, index
}
// CHECK: @max_only_simplify
func.func @max_only_simplify() -> (index, index) {
// CHECK: %[[V0:.*]] = test.value_with_bounds {max = 128 : index, min = 0 : index}
// CHECK: %[[V1:.*]] = test.value_with_bounds {max = 512 : index, min = 0 : index}
// CHECK: affine.min #[[MAP_1]]()[%[[V0]], %[[V1]]]
// CHECK: affine.max #[[MAP_2]]()[%[[V1]]]
%0 = test.value_with_bounds {max = 128 : index, min = 0 : index}
%1 = test.value_with_bounds {max = 512 : index, min = 0 : index}
%r0 = affine.min affine_map<()[s0, s1] -> (s0, 256, s1)>()[%0, %1]
%r1 = affine.max affine_map<()[s0, s1] -> (s0, 256, s1)>()[%0, %1]
return %r0, %r1 : index, index
}
// CHECK: @overlapping_constraints
func.func @overlapping_constraints() -> (index, index) {
%0 = test.value_with_bounds {max = 192 : index, min = 0 : index}
%1 = test.value_with_bounds {max = 384 : index, min = 128 : index}
%2 = test.value_with_bounds {max = 512 : index, min = 256 : index}
// CHECK: %[[V0:.*]] = test.value_with_bounds {max = 192 : index, min = 0 : index}
// CHECK: %[[V1:.*]] = test.value_with_bounds {max = 384 : index, min = 128 : index}
// CHECK: %[[V2:.*]] = test.value_with_bounds {max = 512 : index, min = 256 : index}
// CHECK: affine.min #[[MAP_1]]()[%[[V0]], %[[V1]]]
// CHECK: affine.max #[[MAP_1]]()[%[[V1]], %[[V2]]]
%r0 = affine.min affine_map<()[s0, s1, s2] -> (s0, s1, s2)>()[%0, %1, %2]
%r1 = affine.max affine_map<()[s0, s1, s2] -> (s0, s1, s2)>()[%0, %1, %2]
return %r0, %r1 : index, index
}
module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg0: !transform.any_op {transform.readonly}) {
%0 = transform.structured.match ops{["affine.min", "affine.max"]} in %arg0 : (!transform.any_op) -> !transform.any_op
transform.affine.simplify_min_max_affine_ops %0 : !transform.any_op
transform.yield
}
}