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
124 lines
4.7 KiB
MLIR
124 lines
4.7 KiB
MLIR
// RUN: mlir-opt -allow-unregistered-dialect -convert-scf-to-emitc %s | FileCheck %s
|
|
// RUN: mlir-opt -allow-unregistered-dialect -convert-to-emitc="filter-dialects=scf" %s | FileCheck %s
|
|
|
|
// CHECK-LABEL: func.func @switch_no_result(
|
|
// CHECK-SAME: %[[ARG_0:.*]]: index) {
|
|
// CHECK: %[[VAL_0:.*]] = builtin.unrealized_conversion_cast %[[ARG_0]] : index to !emitc.size_t
|
|
// CHECK: emitc.switch %[[VAL_0]]
|
|
// CHECK: case 2 {
|
|
// CHECK: %[[VAL_1:.*]] = arith.constant 10 : i32
|
|
// CHECK: yield
|
|
// CHECK: }
|
|
// CHECK: case 5 {
|
|
// CHECK: %[[VAL_2:.*]] = arith.constant 20 : i32
|
|
// CHECK: yield
|
|
// CHECK: }
|
|
// CHECK: default {
|
|
// CHECK: %[[VAL_3:.*]] = arith.constant 30 : i32
|
|
// CHECK: }
|
|
// CHECK: return
|
|
// CHECK: }
|
|
func.func @switch_no_result(%arg0 : index) {
|
|
scf.index_switch %arg0
|
|
case 2 {
|
|
%1 = arith.constant 10 : i32
|
|
scf.yield
|
|
}
|
|
case 5 {
|
|
%2 = arith.constant 20 : i32
|
|
scf.yield
|
|
}
|
|
default {
|
|
%3 = arith.constant 30 : i32
|
|
}
|
|
return
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @switch_one_result(
|
|
// CHECK-SAME: %[[ARG_0:.*]]: index) {
|
|
// CHECK: %[[VAL_0:.*]] = builtin.unrealized_conversion_cast %[[ARG_0]] : index to !emitc.size_t
|
|
// CHECK: %[[VAL_1:.*]] = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
|
|
// CHECK: emitc.switch %[[VAL_0]]
|
|
// CHECK: case 2 {
|
|
// CHECK: %[[VAL_2:.*]] = arith.constant 10 : i32
|
|
// CHECK: assign %[[VAL_2]] : i32 to %[[VAL_1]] : <i32>
|
|
// CHECK: yield
|
|
// CHECK: }
|
|
// CHECK: case 5 {
|
|
// CHECK: %[[VAL_3:.*]] = arith.constant 20 : i32
|
|
// CHECK: assign %[[VAL_3]] : i32 to %[[VAL_1]] : <i32>
|
|
// CHECK: yield
|
|
// CHECK: }
|
|
// CHECK: default {
|
|
// CHECK: %[[VAL_4:.*]] = arith.constant 30 : i32
|
|
// CHECK: assign %[[VAL_4]] : i32 to %[[VAL_1]] : <i32>
|
|
// CHECK: }
|
|
// CHECK: return
|
|
// CHECK: }
|
|
func.func @switch_one_result(%arg0 : index) {
|
|
%0 = scf.index_switch %arg0 -> i32
|
|
case 2 {
|
|
%1 = arith.constant 10 : i32
|
|
scf.yield %1 : i32
|
|
}
|
|
case 5 {
|
|
%2 = arith.constant 20 : i32
|
|
scf.yield %2 : i32
|
|
}
|
|
default {
|
|
%3 = arith.constant 30 : i32
|
|
scf.yield %3 : i32
|
|
}
|
|
return
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @switch_two_results(
|
|
// CHECK-SAME: %[[ARG_0:.*]]: index) -> (i32, f32) {
|
|
// CHECK: %[[VAL_0:.*]] = builtin.unrealized_conversion_cast %[[ARG_0]] : index to !emitc.size_t
|
|
// CHECK: %[[VAL_1:.*]] = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
|
|
// CHECK: %[[VAL_2:.*]] = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<f32>
|
|
// CHECK: emitc.switch %[[VAL_0]]
|
|
// CHECK: case 2 {
|
|
// CHECK: %[[VAL_3:.*]] = arith.constant 10 : i32
|
|
// CHECK: %[[VAL_4:.*]] = arith.constant 1.200000e+00 : f32
|
|
// CHECK: assign %[[VAL_3]] : i32 to %[[VAL_1]] : <i32>
|
|
// CHECK: assign %[[VAL_4]] : f32 to %[[VAL_2]] : <f32>
|
|
// CHECK: yield
|
|
// CHECK: }
|
|
// CHECK: case 5 {
|
|
// CHECK: %[[VAL_5:.*]] = arith.constant 20 : i32
|
|
// CHECK: %[[VAL_6:.*]] = arith.constant 2.400000e+00 : f32
|
|
// CHECK: assign %[[VAL_5]] : i32 to %[[VAL_1]] : <i32>
|
|
// CHECK: assign %[[VAL_6]] : f32 to %[[VAL_2]] : <f32>
|
|
// CHECK: yield
|
|
// CHECK: }
|
|
// CHECK: default {
|
|
// CHECK: %[[VAL_7:.*]] = arith.constant 30 : i32
|
|
// CHECK: %[[VAL_8:.*]] = arith.constant 3.600000e+00 : f32
|
|
// CHECK: assign %[[VAL_7]] : i32 to %[[VAL_1]] : <i32>
|
|
// CHECK: assign %[[VAL_8]] : f32 to %[[VAL_2]] : <f32>
|
|
// CHECK: }
|
|
// CHECK: %[[RES_1:.*]] = emitc.load %[[VAL_1]] : <i32>
|
|
// CHECK: %[[RES_2:.*]] = emitc.load %[[VAL_2]] : <f32>
|
|
// CHECK: return %[[RES_1]], %[[RES_2]] : i32, f32
|
|
// CHECK: }
|
|
func.func @switch_two_results(%arg0 : index) -> (i32, f32) {
|
|
%0, %1 = scf.index_switch %arg0 -> i32, f32
|
|
case 2 {
|
|
%2 = arith.constant 10 : i32
|
|
%3 = arith.constant 1.2 : f32
|
|
scf.yield %2, %3 : i32, f32
|
|
}
|
|
case 5 {
|
|
%4 = arith.constant 20 : i32
|
|
%5 = arith.constant 2.4 : f32
|
|
scf.yield %4, %5 : i32, f32
|
|
}
|
|
default {
|
|
%6 = arith.constant 30 : i32
|
|
%7 = arith.constant 3.6 : f32
|
|
scf.yield %6, %7 : i32, f32
|
|
}
|
|
return %0, %1 : i32, f32
|
|
}
|