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
110 lines
4.3 KiB
MLIR
110 lines
4.3 KiB
MLIR
// RUN: mlir-opt -math-sincos-fusion %s | FileCheck %s
|
|
|
|
// CHECK-LABEL: func.func @sincos_fusion(
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32,
|
|
// CHECK-SAME: %[[ARG1:.*]]: f32) -> (f32, f32, f32, f32) {
|
|
// CHECK: %[[VAL_0:.*]], %[[VAL_1:.*]] = math.sincos %[[ARG0]] : f32
|
|
// CHECK: %[[VAL_2:.*]], %[[VAL_3:.*]] = math.sincos %[[ARG1]] : f32
|
|
// CHECK: return %[[VAL_0]], %[[VAL_1]], %[[VAL_3]], %[[VAL_2]] : f32, f32, f32, f32
|
|
// CHECK: }
|
|
func.func @sincos_fusion(%arg0 : f32, %arg1 : f32) -> (f32, f32, f32, f32) {
|
|
%0 = math.sin %arg0 : f32
|
|
%1 = math.cos %arg0 : f32
|
|
|
|
%2 = math.cos %arg1 : f32
|
|
%3 = math.sin %arg1 : f32
|
|
|
|
func.return %0, %1, %2, %3 : f32, f32, f32, f32
|
|
}
|
|
|
|
func.func private @sink(%arg0 : f32)
|
|
|
|
// CHECK: func.func private @sink(f32)
|
|
// CHECK-LABEL: func.func @sincos_ensure_ssa_dominance(
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32,
|
|
// CHECK-SAME: %[[ARG1:.*]]: f32) -> (f32, f32, f32, f32) {
|
|
// CHECK: %[[VAL_0:.*]], %[[VAL_1:.*]] = math.sincos %[[ARG0]] : f32
|
|
// CHECK: call @sink(%[[VAL_0]]) : (f32) -> ()
|
|
// CHECK: %[[VAL_2:.*]], %[[VAL_3:.*]] = math.sincos %[[ARG1]] : f32
|
|
// CHECK: call @sink(%[[VAL_3]]) : (f32) -> ()
|
|
// CHECK: return %[[VAL_0]], %[[VAL_1]], %[[VAL_3]], %[[VAL_2]] : f32, f32, f32, f32
|
|
// CHECK: }
|
|
func.func @sincos_ensure_ssa_dominance(%arg0 : f32, %arg1 : f32) -> (f32, f32, f32, f32) {
|
|
%0 = math.sin %arg0 : f32
|
|
func.call @sink(%0) : (f32) -> ()
|
|
%1 = math.cos %arg0 : f32
|
|
%2 = math.cos %arg1 : f32
|
|
func.call @sink(%2) : (f32) -> ()
|
|
%3 = math.sin %arg1 : f32
|
|
func.return %0, %1, %2, %3 : f32, f32, f32, f32
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @sincos_fusion_no_match_fmf(
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32) -> (f32, f32) {
|
|
// CHECK: %[[VAL_0:.*]] = math.sin %[[ARG0]] fastmath<contract> : f32
|
|
// CHECK: %[[VAL_1:.*]] = math.cos %[[ARG0]] : f32
|
|
// CHECK: return %[[VAL_0]], %[[VAL_1]] : f32, f32
|
|
// CHECK: }
|
|
func.func @sincos_fusion_no_match_fmf(%arg0 : f32) -> (f32, f32) {
|
|
%0 = math.sin %arg0 fastmath<contract> : f32
|
|
%1 = math.cos %arg0 : f32
|
|
func.return %0, %1 : f32, f32
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @sincos_no_fusion_different_block(
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32,
|
|
// CHECK-SAME: %[[ARG1:.*]]: i1) -> f32 {
|
|
// CHECK: %[[VAL_0:.*]] = scf.if %[[ARG1]] -> (f32) {
|
|
// CHECK: %[[VAL_1:.*]] = math.sin %[[ARG0]] : f32
|
|
// CHECK: scf.yield %[[VAL_1]] : f32
|
|
// CHECK: } else {
|
|
// CHECK: %[[VAL_2:.*]] = math.cos %[[ARG0]] : f32
|
|
// CHECK: scf.yield %[[VAL_2]] : f32
|
|
// CHECK: }
|
|
// CHECK: return %[[VAL_0]] : f32
|
|
// CHECK: }
|
|
func.func @sincos_no_fusion_different_block(%arg0 : f32, %flag : i1) -> f32 {
|
|
%0 = scf.if %flag -> f32 {
|
|
%s = math.sin %arg0 : f32
|
|
scf.yield %s : f32
|
|
} else {
|
|
%c = math.cos %arg0 : f32
|
|
scf.yield %c : f32
|
|
}
|
|
func.return %0 : f32
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @sincos_no_fusion_nested_region(
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32,
|
|
// CHECK-SAME: %[[ARG1:.*]]: i1) -> (f32, f32) {
|
|
// CHECK: %[[SIN:.*]] = math.sin %[[ARG0]] : f32
|
|
// CHECK: %[[IF:.*]] = scf.if %[[ARG1]] -> (f32) {
|
|
// CHECK: %[[COS:.*]] = math.cos %[[ARG0]] : f32
|
|
// CHECK: scf.yield %[[COS]] : f32
|
|
// CHECK: } else {
|
|
// CHECK: scf.yield %[[SIN]] : f32
|
|
// CHECK: }
|
|
// CHECK: return %[[SIN]], %[[IF]] : f32, f32
|
|
// CHECK: }
|
|
func.func @sincos_no_fusion_nested_region(%arg0 : f32, %flag : i1) -> (f32, f32) {
|
|
%s = math.sin %arg0 : f32
|
|
%r = scf.if %flag -> f32 {
|
|
%c = math.cos %arg0 : f32
|
|
scf.yield %c : f32
|
|
} else {
|
|
scf.yield %s : f32
|
|
}
|
|
func.return %s, %r : f32, f32
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @sincos_fusion_preserve_fastmath(
|
|
// CHECK-SAME: %[[ARG0:.*]]: f32) -> (f32, f32) {
|
|
// CHECK: %[[VAL_0:.*]], %[[VAL_1:.*]] = math.sincos %[[ARG0]] fastmath<contract> : f32
|
|
// CHECK: return %[[VAL_0]], %[[VAL_1]] : f32, f32
|
|
// CHECK: }
|
|
func.func @sincos_fusion_preserve_fastmath(%arg0 : f32) -> (f32, f32) {
|
|
%0 = math.sin %arg0 fastmath<contract> : f32
|
|
%1 = math.cos %arg0 fastmath<contract> : f32
|
|
func.return %0, %1 : f32, f32
|
|
}
|