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
61 lines
2.7 KiB
MLIR
61 lines
2.7 KiB
MLIR
// RUN: mlir-opt -arith-expand -convert-arith-to-emitc %s | FileCheck %s
|
|
|
|
/// This file checks the combined `-arith-expand | -convert-arith-to-emitc`
|
|
/// pipeline with intentionally minimal FileCheck coverage.
|
|
/// The full expansion is covered in `test/Dialect/Arith/expand-ops.mlir`, and
|
|
/// the full ArithToEmitC lowering is covered in
|
|
/// `test/Conversion/ArithToEmitC/arith-to-emitc.mlir`; this test only covers
|
|
/// that the combination of the two produces the expected EmitC ops.
|
|
|
|
/// `arith.maximumf`/`arith.minimumf` expand through `arith.cmpf`.
|
|
/// Vector cases excluded because ArithToEmitC cannot convert `VectorType`.
|
|
/// Tensor cases excluded because ArithToEmitC only lowers scalar `cmpf`.
|
|
|
|
// CHECK-LABEL: func @maximumf
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32, %[[ARG1:.*]]: f32) -> f32
|
|
func.func @maximumf(%a: f32, %b: f32) -> f32 {
|
|
// CHECK-NOT: arith
|
|
// CHECK: %[[CMP:.*]] = emitc.cmp gt, %[[ARG0]], %[[ARG1]] : (f32, f32) -> i1
|
|
// CHECK: %[[OR:.*]] = emitc.logical_or %{{.*}}, %[[CMP]] : i1, i1
|
|
// CHECK: %[[SEL0:.*]] = emitc.conditional %[[OR]], %[[ARG0]], %[[ARG1]] : f32
|
|
// CHECK: %[[SEL1:.*]] = emitc.conditional %{{.*}}, %[[ARG1]], %[[SEL0]] : f32
|
|
%result = arith.maximumf %a, %b : f32
|
|
// CHECK: return %[[SEL1]] : f32
|
|
return %result : f32
|
|
}
|
|
|
|
// CHECK-LABEL: func @minimumf
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32, %[[ARG1:.*]]: f32) -> f32
|
|
func.func @minimumf(%a: f32, %b: f32) -> f32 {
|
|
// CHECK-NOT: arith
|
|
// CHECK: %[[CMP:.*]] = emitc.cmp lt, %[[ARG0]], %[[ARG1]] : (f32, f32) -> i1
|
|
// CHECK: %[[OR:.*]] = emitc.logical_or %{{.*}}, %[[CMP]] : i1, i1
|
|
// CHECK: %[[SEL0:.*]] = emitc.conditional %[[OR]], %[[ARG0]], %[[ARG1]] : f32
|
|
// CHECK: %[[SEL1:.*]] = emitc.conditional %{{.*}}, %[[ARG1]], %[[SEL0]] : f32
|
|
%result = arith.minimumf %a, %b : f32
|
|
// CHECK: return %[[SEL1]] : f32
|
|
return %result : f32
|
|
}
|
|
|
|
// CHECK-LABEL: func @minsi
|
|
// CHECK-SAME: %[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32) -> i32
|
|
func.func @minsi(%a: i32, %b: i32) -> i32 {
|
|
// CHECK-NOT: arith
|
|
// CHECK: %[[CMP:.*]] = emitc.cmp lt, %[[ARG0]], %[[ARG1]] : (i32, i32) -> i1
|
|
// CHECK: %[[SEL:.*]] = emitc.conditional %[[CMP]], %[[ARG0]], %[[ARG1]] : i32
|
|
%result = arith.minsi %a, %b : i32
|
|
// CHECK: return %[[SEL]] : i32
|
|
return %result : i32
|
|
}
|
|
|
|
// CHECK-LABEL: func @maxsi
|
|
// CHECK-SAME: %[[ARG0:.*]]: i32, %[[ARG1:.*]]: i32) -> i32
|
|
func.func @maxsi(%a: i32, %b: i32) -> i32 {
|
|
// CHECK-NOT: arith
|
|
// CHECK: %[[CMP:.*]] = emitc.cmp gt, %[[ARG0]], %[[ARG1]] : (i32, i32) -> i1
|
|
// CHECK: %[[SEL:.*]] = emitc.conditional %[[CMP]], %[[ARG0]], %[[ARG1]] : i32
|
|
%result = arith.maxsi %a, %b : i32
|
|
// CHECK: return %[[SEL]] : i32
|
|
return %result : i32
|
|
}
|