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
125 lines
3.6 KiB
MLIR
125 lines
3.6 KiB
MLIR
// RUN: mlir-opt %s -split-input-file -pass-pipeline='builtin.module(func.func(canonicalize{test-convergence}))' | FileCheck %s
|
|
|
|
// CHECK-LABEL: @dcast_fold
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: return %[[ARG_0]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
func.func @dcast_fold(%arg0: tensor<4xf32>) -> tensor<4xf32> {
|
|
%0 = quant.qcast %arg0 : tensor<4xf32> to tensor<4x!qalias>
|
|
%1 = quant.dcast %0 : tensor<4x!qalias> to tensor<4xf32>
|
|
return %1 : tensor<4xf32>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @dcast_no_fold_source
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: %[[VAL_0:.*]] = quant.scast %[[ARG_0]]
|
|
// CHECK: %[[VAL_1:.*]] = quant.dcast %[[VAL_0]]
|
|
// CHECK: return %[[VAL_1]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
func.func @dcast_no_fold_source(%arg0: tensor<4xi8>) -> tensor<4xf32> {
|
|
%0 = quant.scast %arg0 : tensor<4xi8> to tensor<4x!qalias>
|
|
%1 = quant.dcast %0 : tensor<4x!qalias> to tensor<4xf32>
|
|
return %1 : tensor<4xf32>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @qcast_fold
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: return %[[ARG_0]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
func.func @qcast_fold(%arg0: tensor<4x!qalias>) -> tensor<4x!qalias> {
|
|
%0 = quant.dcast %arg0 : tensor<4x!qalias> to tensor<4xf32>
|
|
%1 = quant.qcast %0 : tensor<4xf32> to tensor<4x!qalias>
|
|
return %1 : tensor<4x!qalias>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @qcast_no_fold_source
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: %[[VAL_0:.*]] = arith.negf %[[ARG_0]]
|
|
// CHECK: %[[VAL_1:.*]] = quant.qcast %[[VAL_0]]
|
|
// CHECK: return %[[VAL_1]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
func.func @qcast_no_fold_source(%arg0: tensor<4xf32>) -> tensor<4x!qalias> {
|
|
%0 = arith.negf %arg0 : tensor<4xf32>
|
|
%1 = quant.qcast %0 : tensor<4xf32> to tensor<4x!qalias>
|
|
return %1 : tensor<4x!qalias>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @qcast_no_fold_type
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: %[[VAL_0:.*]] = quant.dcast %[[ARG_0]]
|
|
// CHECK: %[[VAL_1:.*]] = quant.qcast %[[VAL_0]]
|
|
// CHECK: return %[[VAL_1]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
!qalias1 = !quant.uniform<u8:f32, 3.0:128>
|
|
func.func @qcast_no_fold_type(%arg0: tensor<4x!qalias>) -> tensor<4x!qalias1> {
|
|
%0 = quant.dcast %arg0 : tensor<4x!qalias> to tensor<4xf32>
|
|
%1 = quant.qcast %0 : tensor<4xf32> to tensor<4x!qalias1>
|
|
return %1 : tensor<4x!qalias1>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @scast_fold
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: return %[[ARG_0]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
func.func @scast_fold(%arg0: tensor<4x!qalias>) -> tensor<4x!qalias> {
|
|
%0 = quant.scast %arg0 : tensor<4x!qalias> to tensor<4xi8>
|
|
%1 = quant.scast %0 : tensor<4xi8> to tensor<4x!qalias>
|
|
return %1 : tensor<4x!qalias>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @scast_no_fold_source
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: %[[QCAST:.*]] = quant.qcast %[[ARG_0]]
|
|
// CHECK: %[[SCAST:.*]] = quant.scast %[[QCAST]]
|
|
// CHECK: return %[[SCAST]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
func.func @scast_no_fold_source(%arg0: tensor<4xf32>) -> tensor<4xi8> {
|
|
%0 = quant.qcast %arg0 : tensor<4xf32> to tensor<4x!qalias>
|
|
%1 = quant.scast %0 : tensor<4x!qalias> to tensor<4xi8>
|
|
return %1 : tensor<4xi8>
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @scast_no_fold_type
|
|
// CHECK-SAME: %[[ARG_0:.*]]: tensor
|
|
|
|
// CHECK: %[[VAL_0:.*]] = quant.scast %[[ARG_0]]
|
|
// CHECK: %[[VAL_1:.*]] = quant.scast %[[VAL_0]]
|
|
// CHECK: return %[[VAL_1]]
|
|
|
|
!qalias = !quant.uniform<u8:f32, 2.0:128>
|
|
!qalias1 = !quant.uniform<u8:f32, 3.0:128>
|
|
func.func @scast_no_fold_type(%arg0: tensor<4x!qalias>) -> tensor<4x!qalias1> {
|
|
%0 = quant.scast %arg0 : tensor<4x!qalias> to tensor<4xi8>
|
|
%1 = quant.scast %0 : tensor<4xi8> to tensor<4x!qalias1>
|
|
return %1 : tensor<4x!qalias1>
|
|
}
|
|
|