From 2a1a363b498eb9fc6ada315af5134bb53880bef3 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Tue, 7 Oct 2025 18:01:52 -0400 Subject: [PATCH 01/20] start of llvm/stablehlo bump Signed-off-by: Christopher Munoz --- docs/BuildOnLinuxOSX.md | 2 +- docs/BuildOnWindows.md | 2 +- src/Conversion/ONNXToTOSA/Tensor/Resize.cpp | 6 ++- src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp | 2 +- src/onnx-mlir.cpp | 2 +- test/backend-cpp/TestCategoryMapper.cpp | 2 +- .../onnx_to_tosa/Tensor/Resize.mlir | 38 ++++++++++++------- test/numerical/TestConv.cpp | 2 +- test/numerical/TestElementwise.cpp | 2 +- test/numerical/TestGRU.cpp | 2 +- test/numerical/TestGemm.cpp | 2 +- test/numerical/TestLSTM.cpp | 2 +- test/numerical/TestLeakyRelu.cpp | 2 +- test/numerical/TestLoop.cpp | 2 +- test/numerical/TestMatMul2D.cpp | 2 +- test/numerical/TestMatMulBroadcast.cpp | 2 +- test/numerical/TestRNN.cpp | 2 +- test/numerical/TestScan.cpp | 2 +- test/numerical/TestSoftplus.cpp | 2 +- test/perf/PerfHelper.cpp | 2 +- third_party/stablehlo | 2 +- 21 files changed, 48 insertions(+), 34 deletions(-) diff --git a/docs/BuildOnLinuxOSX.md b/docs/BuildOnLinuxOSX.md index e9f56226a8..fc18070d21 100644 --- a/docs/BuildOnLinuxOSX.md +++ b/docs/BuildOnLinuxOSX.md @@ -15,7 +15,7 @@ Firstly, install MLIR (as a part of LLVM-Project): ``` bash git clone -n https://github.com/llvm/llvm-project.git # Check out a specific branch that is known to work with ONNX-MLIR. -cd llvm-project && git checkout fc44a4fcd3c54be927c15ddd9211aca1501633e7 && cd .. +cd llvm-project && git checkout 113f01aa82d055410f22a9d03b3468fa68600589 && cd .. ``` [same-as-file]: <> ({"ref": "utils/build-mlir.sh", "skip-ref": 2}) diff --git a/docs/BuildOnWindows.md b/docs/BuildOnWindows.md index 2bc48d3e3d..440c8c0b1f 100644 --- a/docs/BuildOnWindows.md +++ b/docs/BuildOnWindows.md @@ -52,7 +52,7 @@ Install MLIR (as a part of LLVM-Project): ```shell git clone -n https://github.com/llvm/llvm-project.git # Check out a specific branch that is known to work with ONNX-MLIR. -cd llvm-project && git checkout fc44a4fcd3c54be927c15ddd9211aca1501633e7 && cd .. +cd llvm-project && git checkout 113f01aa82d055410f22a9d03b3468fa68600589 && cd .. ``` [same-as-file]: <> ({"ref": "utils/build-mlir.cmd", "skip-ref": 2}) diff --git a/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp b/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp index abc5afd443..14fbe1bb97 100644 --- a/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp +++ b/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp @@ -291,7 +291,9 @@ class ONNXResizeOpLoweringToTOSA : public ConversionPattern { bool isBilinear = mode == "linear"; bool isNearest = mode == "nearest"; bool isNearestModeFloor = nearestMode == "floor"; - StringRef resizeMode = isBilinear ? "BILINEAR" : "NEAREST_NEIGHBOR"; + mlir::tosa::ResizeMode resizeMode = + isBilinear ? mlir::tosa::ResizeMode::BILINEAR + : mlir::tosa::ResizeMode::NEAREST_NEIGHBOR; if (halfPixelSymmetric) return rewriter.notifyMatchFailure(op, @@ -317,7 +319,7 @@ class ONNXResizeOpLoweringToTOSA : public ConversionPattern { Value border = mlir::tosa::getTosaConstShape( rewriter, loc, {yDimension.border, xDimension.border}); - auto resizeModeAttr = rewriter.getStringAttr(resizeMode); + auto resizeModeAttr = mlir::tosa::ResizeModeAttr::get(rewriter.getContext(), resizeMode); Type newOutputType = RankedTensorType::get(llvm::SmallVector( inputType.getRank(), ShapedType::kDynamic), diff --git a/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp b/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp index ecb53d99c0..63365d3f1f 100644 --- a/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp +++ b/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp @@ -158,7 +158,7 @@ int main(int argc, char **argv) { if (!parseCustomEnvFlagsCommandLineOption(argc, argv, &llvm::errs()) || !llvm::cl::ParseCommandLineOptions(argc, argv, getVendorName() + " - A modular optimizer driver\n", &llvm::errs(), - customEnvFlags.c_str())) { + /*VFS=*/nullptr, customEnvFlags.c_str())) { llvm::errs() << "Failed to parse options\n"; return 1; } diff --git a/src/onnx-mlir.cpp b/src/onnx-mlir.cpp index cd880e9822..a967ee737e 100644 --- a/src/onnx-mlir.cpp +++ b/src/onnx-mlir.cpp @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { if (!parseCustomEnvFlagsCommandLineOption(argc, argv, &llvm::errs()) || !llvm::cl::ParseCommandLineOptions(argc, argv, getVendorName() + " - A modular optimizer driver\n", &llvm::errs(), - customEnvFlags.c_str())) { + /*VFS=*/nullptr, customEnvFlags.c_str())) { llvm::errs() << "Failed to parse options\n"; return 1; } diff --git a/test/backend-cpp/TestCategoryMapper.cpp b/test/backend-cpp/TestCategoryMapper.cpp index c7ca160e0b..b2ca9e2459 100644 --- a/test/backend-cpp/TestCategoryMapper.cpp +++ b/test/backend-cpp/TestCategoryMapper.cpp @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { setCompilerOption(onnx_mlir::OptionKind::CompilerOptLevel, "3"); mlir::registerPassManagerCLOptions(); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestCategoryMapper\n", nullptr, "TEST_ARGS"); + argc, argv, "TestCategoryMapper\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); onnx_mlir::initCompilerConfig(); std::cout << "Target options: \"" << onnx_mlir::getCompilerOption(onnx_mlir::OptionKind::TargetAccel) diff --git a/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir b/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir index 32cc0d5d94..c305fd1850 100644 --- a/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir +++ b/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir @@ -11,13 +11,14 @@ func.func @test_resize_pytorch_half_pixel_linear(%arg0: tensor<1x1x2x4xf32>) -> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[4, 2, 4, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<-1> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_4_:%.+]] = tosa.const_shape {values = dense<1> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_5_:%.+]] = tosa.resize [[VAR_1_]], [[VAR_2_]], [[VAR_3_]], [[VAR_4_]] {mode = "BILINEAR"} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x4x8x1xf32> +// CHECK: [[VAR_5_:%.+]] = tosa.resize [[VAR_1_]], [[VAR_2_]], [[VAR_3_]], [[VAR_4_]] {mode = BILINEAR} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x4x8x1xf32> // CHECK: [[VAR_7_:%.+]] = tosa.transpose [[VAR_5_]] {perms = array} : (tensor<1x4x8x1xf32>) -> tensor<1x1x4x8xf32> // CHECK: return [[VAR_7_]] : tensor<1x1x4x8xf32> // CHECK: } } // ----- + func.func @test_resize_half_pixel_nearest_floor(%arg0: tensor<1x1x1x4xf32>) -> tensor<1x1x1x12xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1, 1, 1, 12]> : tensor<4xi64>} : () -> tensor<4xi64> @@ -31,7 +32,7 @@ func.func @test_resize_half_pixel_nearest_floor(%arg0: tensor<1x1x1x4xf32>) -> t // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 6, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[-1, -5]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<-1> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "NEAREST_NEIGHBOR"} : (tensor<1x1x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x12x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = NEAREST_NEIGHBOR} : (tensor<1x1x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x12x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x1x12x1xf32>) -> tensor<1x1x1x12xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x1x12xf32> // CHECK: } @@ -39,6 +40,7 @@ func.func @test_resize_half_pixel_nearest_floor(%arg0: tensor<1x1x1x4xf32>) -> t // ----- + func.func @test_resize_half_pixel_nearest_round_prefer_ceil(%arg0: tensor<1x1x3x4xf32>) -> tensor<1x1x3x12xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1, 1, 3, 12]> : tensor<4xi64>} : () -> tensor<4xi64> @@ -52,7 +54,7 @@ func.func @test_resize_half_pixel_nearest_round_prefer_ceil(%arg0: tensor<1x1x3x // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 6, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[0, -2]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[0, 2]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "NEAREST_NEIGHBOR"} : (tensor<1x3x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x3x12x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = NEAREST_NEIGHBOR} : (tensor<1x3x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x3x12x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x3x12x1xf32>) -> tensor<1x1x3x12xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x3x12xf32> // CHECK: } @@ -60,6 +62,7 @@ func.func @test_resize_half_pixel_nearest_round_prefer_ceil(%arg0: tensor<1x1x3x // ----- + func.func @test_resize_align_corners(%arg0: tensor<1x1x3x4xf32>) -> tensor<1x1x3x12xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1, 1, 3, 12]> : tensor<4xi64>} : () -> tensor<4xi64> @@ -72,7 +75,7 @@ func.func @test_resize_align_corners(%arg0: tensor<1x1x3x4xf32>) -> tensor<1x1x3 // CHECK-DAG: [[VAR_0_:%.+]] = tosa.transpose [[PARAM_0_]] {perms = array} : (tensor<1x1x3x4xf32>) -> tensor<1x3x4x1xf32> // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 22, 6]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<0> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_3_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_2_]] {mode = "NEAREST_NEIGHBOR"} : (tensor<1x3x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x3x12x1xf32> +// CHECK: [[VAR_3_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_2_]] {mode = NEAREST_NEIGHBOR} : (tensor<1x3x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x3x12x1xf32> // CHECK: [[VAR_4_:%.+]] = tosa.transpose [[VAR_3_]] {perms = array} : (tensor<1x3x12x1xf32>) -> tensor<1x1x3x12xf32> // CHECK: return [[VAR_4_]] : tensor<1x1x3x12xf32> // CHECK: } @@ -80,6 +83,7 @@ func.func @test_resize_align_corners(%arg0: tensor<1x1x3x4xf32>) -> tensor<1x1x3 // ----- + func.func @test_resize_asymmetric(%arg0: tensor<1x1x3x4xf32>) -> tensor<1x1x3x12xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1, 1, 3, 12]> : tensor<4xi64>} : () -> tensor<4xi64> @@ -93,7 +97,7 @@ func.func @test_resize_asymmetric(%arg0: tensor<1x1x3x4xf32>) -> tensor<1x1x3x12 // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 6, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<0> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[0, 4]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "NEAREST_NEIGHBOR"} : (tensor<1x3x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x3x12x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = NEAREST_NEIGHBOR} : (tensor<1x3x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x3x12x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x3x12x1xf32>) -> tensor<1x1x3x12xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x3x12xf32> // CHECK: } @@ -101,6 +105,7 @@ func.func @test_resize_asymmetric(%arg0: tensor<1x1x3x4xf32>) -> tensor<1x1x3x12 // ----- + func.func @test_resize_half_pixel_nearest_floor_downsample(%arg0: tensor<1x1x1x12xf32>) -> tensor<1x1x1x4xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1, 1, 1, 4]> : tensor<4xi64>} : () -> tensor<4xi64> @@ -114,7 +119,7 @@ func.func @test_resize_half_pixel_nearest_floor_downsample(%arg0: tensor<1x1x1x1 // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 2, 6]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[-1, 1]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[-1, -3]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "NEAREST_NEIGHBOR"} : (tensor<1x1x12x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x4x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = NEAREST_NEIGHBOR} : (tensor<1x1x12x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x4x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x1x4x1xf32>) -> tensor<1x1x1x4xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x1x4xf32> // CHECK: } @@ -122,6 +127,7 @@ func.func @test_resize_half_pixel_nearest_floor_downsample(%arg0: tensor<1x1x1x1 // ----- + func.func @test_resize_input_one(%arg0: tensor<1x1x1x1xf32>) -> tensor<1x1x4x4xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1, 1, 4, 4]> : tensor<4xi64>} : () -> tensor<4xi64> @@ -135,7 +141,7 @@ func.func @test_resize_input_one(%arg0: tensor<1x1x1x1xf32>) -> tensor<1x1x4x4xf // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[8, 2, 8, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<-3> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<3> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "BILINEAR"} : (tensor<1x1x1x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x4x4x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = BILINEAR} : (tensor<1x1x1x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x4x4x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x4x4x1xf32>) -> tensor<1x1x4x4xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x4x4xf32> // CHECK: } @@ -143,6 +149,7 @@ func.func @test_resize_input_one(%arg0: tensor<1x1x1x1xf32>) -> tensor<1x1x4x4xf // ----- + func.func @test_resize_pytorch_half_pixel_linear_float_scale_upsample(%arg0: tensor<1x1x2x4xf32>) -> tensor<1x1x4x8xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1.000000e+00, 1.000000e+00, 2.001000e+00, 2.000000e+00]> : tensor<4xf32>} : () -> tensor<4xf32> @@ -156,7 +163,7 @@ func.func @test_resize_pytorch_half_pixel_linear_float_scale_upsample(%arg0: ten // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[500249982, 250000000, 4, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[-125124991, -1]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[124625027, 1]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "BILINEAR"} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x4x8x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = BILINEAR} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x4x8x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x4x8x1xf32>) -> tensor<1x1x4x8xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x4x8xf32> // CHECK: } @@ -164,6 +171,7 @@ func.func @test_resize_pytorch_half_pixel_linear_float_scale_upsample(%arg0: ten // ----- + func.func @test_resize_pytorch_half_pixel_linear_float_scale_downsample(%arg0: tensor<1x1x2x4xf32>) -> tensor<1x1x1x2xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1.000000e+00, 1.000000e+00, 0.600000e+00, 0.600000e+00]> : tensor<4xf32>} : () -> tensor<4xf32> @@ -177,7 +185,7 @@ func.func @test_resize_pytorch_half_pixel_linear_float_scale_downsample(%arg0: t // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[1, 1, 150000006, 250000000]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[-1, 49999997]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[-2, -150000021]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "BILINEAR"} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x2x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = BILINEAR} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x2x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x1x2x1xf32>) -> tensor<1x1x1x2xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x1x2xf32> // CHECK: } @@ -185,6 +193,7 @@ func.func @test_resize_pytorch_half_pixel_linear_float_scale_downsample(%arg0: t // ----- + func.func @test_resize_half_pixel_nearest_floor_downsample_axis_both(%arg0: tensor<1x1x1x12xf32>) -> tensor<1x1x1x6xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1, 6]> : tensor<2xi64>} : () -> tensor<2xi64> @@ -198,7 +207,7 @@ func.func @test_resize_half_pixel_nearest_floor_downsample_axis_both(%arg0: tens // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 2, 4]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[-1, 0]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[-1, -2]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "NEAREST_NEIGHBOR"} : (tensor<1x1x12x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x6x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = NEAREST_NEIGHBOR} : (tensor<1x1x12x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x6x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x1x6x1xf32>) -> tensor<1x1x1x6xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x1x6xf32> // CHECK: } @@ -206,6 +215,7 @@ func.func @test_resize_half_pixel_nearest_floor_downsample_axis_both(%arg0: tens // ----- + func.func @test_resize_half_pixel_nearest_floor_downsample_axis_one(%arg0: tensor<1x1x1x12xf32>) -> tensor<1x1x1x6xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[6]> : tensor<1xi64>} : () -> tensor<1xi64> @@ -219,7 +229,7 @@ func.func @test_resize_half_pixel_nearest_floor_downsample_axis_one(%arg0: tenso // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 2, 4]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[-1, 0]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[-1, -2]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "NEAREST_NEIGHBOR"} : (tensor<1x1x12x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x6x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = NEAREST_NEIGHBOR} : (tensor<1x1x12x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x1x6x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x1x6x1xf32>) -> tensor<1x1x1x6xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x1x6xf32> // CHECK: } @@ -249,6 +259,7 @@ func.func @test_resize_linear_int_disallowed(%arg0: tensor<1x1x2x4xi32>) -> tens // ----- + func.func @test_resize_pytorch_half_pixel_linear_other_axis_allowed_negative_axis(%arg0: tensor<1x1x2x4xf32>) -> tensor<1x1x2x8xf32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1.000000e+00, 2.000000e+00]> : tensor<2xf32>} : () -> tensor<2xf32> @@ -262,7 +273,7 @@ func.func @test_resize_pytorch_half_pixel_linear_other_axis_allowed_negative_axi // CHECK-DAG: [[VAR_1_:%.+]] = tosa.const_shape {values = dense<[2, 2, 4, 2]> : tensor<4xindex>} : () -> !tosa.shape<4> // CHECK-DAG: [[VAR_2_:%.+]] = tosa.const_shape {values = dense<[0, -1]> : tensor<2xindex>} : () -> !tosa.shape<2> // CHECK-DAG: [[VAR_3_:%.+]] = tosa.const_shape {values = dense<[0, 1]> : tensor<2xindex>} : () -> !tosa.shape<2> -// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = "BILINEAR"} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x2x8x1xf32> +// CHECK: [[VAR_4_:%.+]] = tosa.resize [[VAR_0_]], [[VAR_1_]], [[VAR_2_]], [[VAR_3_]] {mode = BILINEAR} : (tensor<1x2x4x1xf32>, !tosa.shape<4>, !tosa.shape<2>, !tosa.shape<2>) -> tensor<1x2x8x1xf32> // CHECK: [[VAR_5_:%.+]] = tosa.transpose [[VAR_4_]] {perms = array} : (tensor<1x2x8x1xf32>) -> tensor<1x1x2x8xf32> // CHECK: return [[VAR_5_]] : tensor<1x1x2x8xf32> // CHECK: } @@ -291,6 +302,7 @@ func.func @test_resize_cubic_disallowed(%arg0: tensor<1x1x2x4xf32>) -> tensor<1x } // ----- + func.func @test_resize_linear_int_disallowed(%arg0: tensor<1x1x2x4xi32>) -> tensor<1x1x4x8xi32> { %0 = "onnx.NoValue"() {value} : () -> none %1 = "onnx.Constant"() {value = dense<[1.000000e+00, 1.000000e+00, 2.000000e+00, 2.000000e+00]> : tensor<4xf32>} : () -> tensor<4xf32> @@ -298,4 +310,4 @@ func.func @test_resize_linear_int_disallowed(%arg0: tensor<1x1x2x4xi32>) -> tens return %2 : tensor<1x1x4x8xi32> // CHECK-LABEL: func.func @test_resize_linear_int_disallowed // CHECK: onnx.Resize -} +} \ No newline at end of file diff --git a/test/numerical/TestConv.cpp b/test/numerical/TestConv.cpp index ce7b5c84a0..3a54608c18 100644 --- a/test/numerical/TestConv.cpp +++ b/test/numerical/TestConv.cpp @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestConv\n", nullptr, "TEST_ARGS"); + argc, argv, "TestConv\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestElementwise.cpp b/test/numerical/TestElementwise.cpp index 65c583f464..0b1ca5cbdf 100644 --- a/test/numerical/TestElementwise.cpp +++ b/test/numerical/TestElementwise.cpp @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestElementwise\n", nullptr, "TEST_ARGS"); + argc, argv, "TestElementwise\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestGRU.cpp b/test/numerical/TestGRU.cpp index c144d1bc68..35fd81b846 100644 --- a/test/numerical/TestGRU.cpp +++ b/test/numerical/TestGRU.cpp @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestGRU\n", nullptr, "TEST_ARGS"); + argc, argv, "TestGRU\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestGemm.cpp b/test/numerical/TestGemm.cpp index 9c6334e4f1..618e714f45 100644 --- a/test/numerical/TestGemm.cpp +++ b/test/numerical/TestGemm.cpp @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestGemm\n", nullptr, "TEST_ARGS"); + argc, argv, "TestGemm\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestLSTM.cpp b/test/numerical/TestLSTM.cpp index 988c218193..232b343470 100644 --- a/test/numerical/TestLSTM.cpp +++ b/test/numerical/TestLSTM.cpp @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestLSTM\n", nullptr, "TEST_ARGS"); + argc, argv, "TestLSTM\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestLeakyRelu.cpp b/test/numerical/TestLeakyRelu.cpp index 31fdc4817b..3ec2af5105 100644 --- a/test/numerical/TestLeakyRelu.cpp +++ b/test/numerical/TestLeakyRelu.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestLeakyRelu\n", nullptr, "TEST_ARGS"); + argc, argv, "TestLeakyRelu\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestLoop.cpp b/test/numerical/TestLoop.cpp index 82d7f8bc69..05eadb6b5c 100644 --- a/test/numerical/TestLoop.cpp +++ b/test/numerical/TestLoop.cpp @@ -166,7 +166,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestLoop\n", nullptr, "TEST_ARGS"); + argc, argv, "TestLoop\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestMatMul2D.cpp b/test/numerical/TestMatMul2D.cpp index fb2a2c98fd..c4c54ec38b 100644 --- a/test/numerical/TestMatMul2D.cpp +++ b/test/numerical/TestMatMul2D.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestMatMul2D\n", nullptr, "TEST_ARGS"); + argc, argv, "TestMatMul2D\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestMatMulBroadcast.cpp b/test/numerical/TestMatMulBroadcast.cpp index 51508a0b6e..c02f2eb2d4 100644 --- a/test/numerical/TestMatMulBroadcast.cpp +++ b/test/numerical/TestMatMulBroadcast.cpp @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestMatMulBroadcast\n", nullptr, "TEST_ARGS"); + argc, argv, "TestMatMulBroadcast\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestRNN.cpp b/test/numerical/TestRNN.cpp index bab7117ba5..efcaab1355 100644 --- a/test/numerical/TestRNN.cpp +++ b/test/numerical/TestRNN.cpp @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestRNN\n", nullptr, "TEST_ARGS"); + argc, argv, "TestRNN\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestScan.cpp b/test/numerical/TestScan.cpp index b14a069c0c..9bffda16f3 100644 --- a/test/numerical/TestScan.cpp +++ b/test/numerical/TestScan.cpp @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestScan\n", nullptr, "TEST_ARGS"); + argc, argv, "TestScan\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestSoftplus.cpp b/test/numerical/TestSoftplus.cpp index 570eddb8ff..6fd5afbf07 100644 --- a/test/numerical/TestSoftplus.cpp +++ b/test/numerical/TestSoftplus.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestSoftplus\n", nullptr, "TEST_ARGS"); + argc, argv, "TestSoftplus\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/perf/PerfHelper.cpp b/test/perf/PerfHelper.cpp index 7dd191aeb5..c7dfcbfb11 100644 --- a/test/perf/PerfHelper.cpp +++ b/test/perf/PerfHelper.cpp @@ -35,7 +35,7 @@ int perf_main(int argc, char **argv) { onnxMlirArgv[0] = argv[0]; onnxMlirArgv[1] = "-O3"; if (!llvm::cl::ParseCommandLineOptions(onnxMlirArgc, onnxMlirArgv, - "set options for perf-algo", nullptr, /*env var*/ "PERF_ARGS")) + "set options for perf-algo", nullptr, /*VFS=*/ nullptr, /*env var*/ "PERF_ARGS")) return 2; if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; diff --git a/third_party/stablehlo b/third_party/stablehlo index 54ed073f70..0a4440a5c8 160000 --- a/third_party/stablehlo +++ b/third_party/stablehlo @@ -1 +1 @@ -Subproject commit 54ed073f70daf51724676efc122d6c45dc8c2938 +Subproject commit 0a4440a5c8de45c4f9649bf3eb4913bf3f97da0d From 86e3f3f8604b019bcdbaef8a5188cceffc1e29b3 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Tue, 7 Oct 2025 18:04:36 -0400 Subject: [PATCH 02/20] formatting fix Signed-off-by: Christopher Munoz --- src/Conversion/ONNXToTOSA/Tensor/Resize.cpp | 7 ++++--- utils/clone-mlir.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp b/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp index 14fbe1bb97..315dbd89ed 100644 --- a/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp +++ b/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp @@ -31,7 +31,7 @@ struct ScaleHelper { ScaleHelper( int64_t numerator, int64_t denominator, int64_t offset, int64_t border) : numerator(numerator), denominator(denominator), offset(offset), - border(border){}; + border(border) {}; int64_t numerator, denominator, offset, border; }; @@ -293,7 +293,7 @@ class ONNXResizeOpLoweringToTOSA : public ConversionPattern { bool isNearestModeFloor = nearestMode == "floor"; mlir::tosa::ResizeMode resizeMode = isBilinear ? mlir::tosa::ResizeMode::BILINEAR - : mlir::tosa::ResizeMode::NEAREST_NEIGHBOR; + : mlir::tosa::ResizeMode::NEAREST_NEIGHBOR; if (halfPixelSymmetric) return rewriter.notifyMatchFailure(op, @@ -319,7 +319,8 @@ class ONNXResizeOpLoweringToTOSA : public ConversionPattern { Value border = mlir::tosa::getTosaConstShape( rewriter, loc, {yDimension.border, xDimension.border}); - auto resizeModeAttr = mlir::tosa::ResizeModeAttr::get(rewriter.getContext(), resizeMode); + auto resizeModeAttr = + mlir::tosa::ResizeModeAttr::get(rewriter.getContext(), resizeMode); Type newOutputType = RankedTensorType::get(llvm::SmallVector( inputType.getRank(), ShapedType::kDynamic), diff --git a/utils/clone-mlir.sh b/utils/clone-mlir.sh index fcc1259f31..c785d98cc9 100644 --- a/utils/clone-mlir.sh +++ b/utils/clone-mlir.sh @@ -1,3 +1,3 @@ git clone -n https://github.com/llvm/llvm-project.git # Check out a specific branch that is known to work with ONNX-MLIR. -cd llvm-project && git checkout fc44a4fcd3c54be927c15ddd9211aca1501633e7 && cd .. +cd llvm-project && git checkout 113f01aa82d055410f22a9d03b3468fa68600589 && cd .. From 8a998fd5322d4f5cee33ba052992aab78530bd2a Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Tue, 7 Oct 2025 18:05:50 -0400 Subject: [PATCH 03/20] formatting fix Signed-off-by: Christopher Munoz --- src/Conversion/ONNXToTOSA/Tensor/Resize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp b/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp index 315dbd89ed..82ce308764 100644 --- a/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp +++ b/src/Conversion/ONNXToTOSA/Tensor/Resize.cpp @@ -31,7 +31,7 @@ struct ScaleHelper { ScaleHelper( int64_t numerator, int64_t denominator, int64_t offset, int64_t border) : numerator(numerator), denominator(denominator), offset(offset), - border(border) {}; + border(border){}; int64_t numerator, denominator, offset, border; }; From f2051d37dba60077f823af1d32b549e6b3c9eb86 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Tue, 7 Oct 2025 20:47:10 -0400 Subject: [PATCH 04/20] fixing mlir tests Signed-off-by: Christopher Munoz --- .../Elementwise_with_canonicalize_O3.mlir | 81 +++++++----- .../QLinearMatMul_with_canonicalize_O3.mlir | 118 +++++++++-------- ...QuantizeLinear_with_simd_canonicalize.mlir | 121 ++++++++++-------- ...inear_with_simd_parallel_canonicalize.mlir | 121 ++++++++++-------- 4 files changed, 244 insertions(+), 197 deletions(-) diff --git a/test/mlir/conversion/onnx_to_krnl/Math/Elementwise_with_canonicalize_O3.mlir b/test/mlir/conversion/onnx_to_krnl/Math/Elementwise_with_canonicalize_O3.mlir index d2988f6ccb..1cc5629417 100644 --- a/test/mlir/conversion/onnx_to_krnl/Math/Elementwise_with_canonicalize_O3.mlir +++ b/test/mlir/conversion/onnx_to_krnl/Math/Elementwise_with_canonicalize_O3.mlir @@ -108,16 +108,19 @@ func.func @round(%arg0: tensor<15xf32>) -> tensor<*xf32> { // CHECK: [[LOAD_PARAM_0_MEM_:%.+]] = vector.load [[PARAM_0_]]{{.}}[[VAR_2_]]{{.}} : memref<15xf32>, vector<12xf32> // CHECK: [[VAR_4_:%.+]] = vector.shape_cast [[LOAD_PARAM_0_MEM_]] : vector<12xf32> to vector<3x4xf32> // CHECK: [[VAR_5_:%.+]] = vector.extract [[VAR_4_]][0] : vector<4xf32> from vector<3x4xf32> -// CHECK: [[VAR_6_:%.+]] = "krnl.round_even"([[VAR_5_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_7_:%.+]] = vector.insert [[VAR_6_]], [[VAR_4_]] [0] : vector<4xf32> into vector<3x4xf32> -// CHECK-DAG: [[VAR_8_:%.+]] = vector.extract [[VAR_4_]][1] : vector<4xf32> from vector<3x4xf32> -// CHECK: [[VAR_9_:%.+]] = "krnl.round_even"([[VAR_8_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_10_:%.+]] = vector.insert [[VAR_9_]], [[VAR_7_]] [1] : vector<4xf32> into vector<3x4xf32> -// CHECK-DAG: [[VAR_11_:%.+]] = vector.extract [[VAR_4_]][2] : vector<4xf32> from vector<3x4xf32> -// CHECK: [[VAR_12_:%.+]] = "krnl.round_even"([[VAR_11_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_13_:%.+]] = vector.insert [[VAR_12_]], [[VAR_10_]] [2] : vector<4xf32> into vector<3x4xf32> -// CHECK: [[VAR_14_:%.+]] = vector.shape_cast [[VAR_13_]] : vector<3x4xf32> to vector<12xf32> -// CHECK: vector.store [[VAR_14_]], [[VAR_view_]]{{.}}[[VAR_2_]]{{.}} : memref<15xf32>, vector<12xf32> +// CHECK-DAG: [[VAR_6_:%.+]] = "krnl.round_even"([[VAR_5_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_7_:%.+]] = vector.extract [[VAR_4_]][1] : vector<4xf32> from vector<3x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_8_:%.+]] = "krnl.round_even"([[VAR_7_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_9_:%.+]] = vector.extract [[VAR_4_]][2] : vector<4xf32> from vector<3x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_10_:%.+]] = "krnl.round_even"([[VAR_9_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_11_:%.+]]:4 = vector.to_elements [[VAR_6_]] : vector<4xf32> +// CHECK-DAG: [[VAR_12_:%.+]]:4 = vector.to_elements [[VAR_8_]] : vector<4xf32> +// CHECK: [[VAR_13_:%.+]]:4 = vector.to_elements [[VAR_10_]] : vector<4xf32> +// CHECK: [[VAR_14_:%.+]] = vector.from_elements [[VAR_11_]]#0, [[VAR_11_]]#1, [[VAR_11_]]#2, [[VAR_11_]]#3, [[VAR_12_]]#0, [[VAR_12_]]#1, [[VAR_12_]]#2, [[VAR_12_]]#3, [[VAR_13_]]#0, [[VAR_13_]]#1, [[VAR_13_]]#2, [[VAR_13_]]#3 : vector<3x4xf32> +// CHECK: [[VAR_15_:%.+]] = vector.shape_cast [[VAR_14_]] : vector<3x4xf32> to vector<12xf32> +// CHECK: vector.store [[VAR_15_]], [[VAR_view_]]{{.}}[[VAR_2_]]{{.}} : memref<15xf32>, vector<12xf32> // CHECK: } // CHECK: [[LOOP_1_:%.+]] = krnl.define_loops 1 // CHECK: krnl.iterate([[LOOP_1_]]) with ([[LOOP_1_]] -> [[I_1_:%.+]] = 12 to 15){ @@ -165,31 +168,39 @@ func.func private @test_round_multiple16(%arg0 : tensor) -> tensor<*xf // CHECK: [[LOAD_VAR_reshape_MEM_:%.+]] = vector.load [[VAR_reshape_]]{{.}}[[VAR_3_]]{{.}} : memref, vector<32xf32> // CHECK: [[VAR_5_:%.+]] = vector.shape_cast [[LOAD_VAR_reshape_MEM_]] : vector<32xf32> to vector<8x4xf32> // CHECK: [[VAR_6_:%.+]] = vector.extract [[VAR_5_]][0] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_7_:%.+]] = "krnl.round_even"([[VAR_6_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_8_:%.+]] = vector.insert [[VAR_7_]], [[VAR_5_]] [0] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_9_:%.+]] = vector.extract [[VAR_5_]][1] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_10_:%.+]] = "krnl.round_even"([[VAR_9_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_11_:%.+]] = vector.insert [[VAR_10_]], [[VAR_8_]] [1] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_12_:%.+]] = vector.extract [[VAR_5_]][2] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_13_:%.+]] = "krnl.round_even"([[VAR_12_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_14_:%.+]] = vector.insert [[VAR_13_]], [[VAR_11_]] [2] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_15_:%.+]] = vector.extract [[VAR_5_]][3] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_16_:%.+]] = "krnl.round_even"([[VAR_15_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_17_:%.+]] = vector.insert [[VAR_16_]], [[VAR_14_]] [3] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_18_:%.+]] = vector.extract [[VAR_5_]][4] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_19_:%.+]] = "krnl.round_even"([[VAR_18_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_20_:%.+]] = vector.insert [[VAR_19_]], [[VAR_17_]] [4] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_21_:%.+]] = vector.extract [[VAR_5_]][5] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_22_:%.+]] = "krnl.round_even"([[VAR_21_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_23_:%.+]] = vector.insert [[VAR_22_]], [[VAR_20_]] [5] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_24_:%.+]] = vector.extract [[VAR_5_]][6] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_25_:%.+]] = "krnl.round_even"([[VAR_24_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_26_:%.+]] = vector.insert [[VAR_25_]], [[VAR_23_]] [6] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_27_:%.+]] = vector.extract [[VAR_5_]][7] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_28_:%.+]] = "krnl.round_even"([[VAR_27_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_29_:%.+]] = vector.insert [[VAR_28_]], [[VAR_26_]] [7] : vector<4xf32> into vector<8x4xf32> -// CHECK: [[VAR_30_:%.+]] = vector.shape_cast [[VAR_29_]] : vector<8x4xf32> to vector<32xf32> -// CHECK: vector.store [[VAR_30_]], [[VAR_reshape_3_]]{{.}}[[VAR_3_]]{{.}} : memref, vector<32xf32> +// CHECK-DAG: [[VAR_7_:%.+]] = "krnl.round_even"([[VAR_6_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_8_:%.+]] = vector.extract [[VAR_5_]][1] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_9_:%.+]] = "krnl.round_even"([[VAR_8_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_10_:%.+]] = vector.extract [[VAR_5_]][2] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_11_:%.+]] = "krnl.round_even"([[VAR_10_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_12_:%.+]] = vector.extract [[VAR_5_]][3] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_13_:%.+]] = "krnl.round_even"([[VAR_12_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_14_:%.+]] = vector.extract [[VAR_5_]][4] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_15_:%.+]] = "krnl.round_even"([[VAR_14_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_16_:%.+]] = vector.extract [[VAR_5_]][5] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_17_:%.+]] = "krnl.round_even"([[VAR_16_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_18_:%.+]] = vector.extract [[VAR_5_]][6] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_19_:%.+]] = "krnl.round_even"([[VAR_18_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_20_:%.+]] = vector.extract [[VAR_5_]][7] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_21_:%.+]] = "krnl.round_even"([[VAR_20_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_22_:%.+]]:4 = vector.to_elements [[VAR_7_]] : vector<4xf32> +// CHECK-DAG: [[VAR_23_:%.+]]:4 = vector.to_elements [[VAR_9_]] : vector<4xf32> +// CHECK-DAG: [[VAR_24_:%.+]]:4 = vector.to_elements [[VAR_11_]] : vector<4xf32> +// CHECK-DAG: [[VAR_25_:%.+]]:4 = vector.to_elements [[VAR_13_]] : vector<4xf32> +// CHECK-DAG: [[VAR_26_:%.+]]:4 = vector.to_elements [[VAR_15_]] : vector<4xf32> +// CHECK-DAG: [[VAR_27_:%.+]]:4 = vector.to_elements [[VAR_17_]] : vector<4xf32> +// CHECK-DAG: [[VAR_28_:%.+]]:4 = vector.to_elements [[VAR_19_]] : vector<4xf32> +// CHECK: [[VAR_29_:%.+]]:4 = vector.to_elements [[VAR_21_]] : vector<4xf32> +// CHECK: [[VAR_30_:%.+]] = vector.from_elements [[VAR_22_]]#0, [[VAR_22_]]#1, [[VAR_22_]]#2, [[VAR_22_]]#3, [[VAR_23_]]#0, [[VAR_23_]]#1, [[VAR_23_]]#2, [[VAR_23_]]#3, [[VAR_24_]]#0, [[VAR_24_]]#1, [[VAR_24_]]#2, [[VAR_24_]]#3, [[VAR_25_]]#0, [[VAR_25_]]#1, [[VAR_25_]]#2, [[VAR_25_]]#3, [[VAR_26_]]#0, [[VAR_26_]]#1, [[VAR_26_]]#2, [[VAR_26_]]#3, [[VAR_27_]]#0, [[VAR_27_]]#1, [[VAR_27_]]#2, [[VAR_27_]]#3, [[VAR_28_]]#0, [[VAR_28_]]#1, [[VAR_28_]]#2, [[VAR_28_]]#3, [[VAR_29_]]#0, [[VAR_29_]]#1, [[VAR_29_]]#2, [[VAR_29_]]#3 : vector<8x4xf32> +// CHECK: [[VAR_31_:%.+]] = vector.shape_cast [[VAR_30_]] : vector<8x4xf32> to vector<32xf32> +// CHECK: vector.store [[VAR_31_]], [[VAR_reshape_3_]]{{.}}[[VAR_3_]]{{.}} : memref, vector<32xf32> // CHECK: } // CHECK: } // CHECK: return [[RES_]] : memref diff --git a/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir b/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir index 97456eadcf..c8f58ebad3 100644 --- a/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir +++ b/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir @@ -174,31 +174,39 @@ func.func @qlinearmatmul_i8_f32(%arg0: tensor<16x32xi8>, %arg1: tensor<1xf32>, % // CHECK: [[LOAD_VAR_reshape_MEM_1_1_1_:%.+]] = vector.load [[VAR_reshape_40_]]{{.}}[[VAR_14_6_]]{{.}} : memref<1024xf32>, vector<32xf32> // CHECK: [[VAR_16_4_:%.+]] = vector.shape_cast [[LOAD_VAR_reshape_MEM_1_1_1_]] : vector<32xf32> to vector<8x4xf32> // CHECK: [[VAR_17_3_:%.+]] = vector.extract [[VAR_16_4_]][0] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_18_3_:%.+]] = "krnl.round_even"([[VAR_17_3_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_19_:%.+]] = vector.insert [[VAR_18_3_]], [[VAR_16_4_]] [0] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_20_:%.+]] = vector.extract [[VAR_16_4_]][1] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_21_:%.+]] = "krnl.round_even"([[VAR_20_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_22_:%.+]] = vector.insert [[VAR_21_]], [[VAR_19_]] [1] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_23_:%.+]] = vector.extract [[VAR_16_4_]][2] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_24_:%.+]] = "krnl.round_even"([[VAR_23_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_25_:%.+]] = vector.insert [[VAR_24_]], [[VAR_22_]] [2] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_26_:%.+]] = vector.extract [[VAR_16_4_]][3] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_27_:%.+]] = "krnl.round_even"([[VAR_26_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_28_:%.+]] = vector.insert [[VAR_27_]], [[VAR_25_]] [3] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_29_:%.+]] = vector.extract [[VAR_16_4_]][4] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_30_:%.+]] = "krnl.round_even"([[VAR_29_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_31_:%.+]] = vector.insert [[VAR_30_]], [[VAR_28_]] [4] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_32_:%.+]] = vector.extract [[VAR_16_4_]][5] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_33_:%.+]] = "krnl.round_even"([[VAR_32_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_34_:%.+]] = vector.insert [[VAR_33_]], [[VAR_31_]] [5] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_35_:%.+]] = vector.extract [[VAR_16_4_]][6] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_36_:%.+]] = "krnl.round_even"([[VAR_35_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_37_:%.+]] = vector.insert [[VAR_36_]], [[VAR_34_]] [6] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_38_:%.+]] = vector.extract [[VAR_16_4_]][7] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_39_:%.+]] = "krnl.round_even"([[VAR_38_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_40_:%.+]] = vector.insert [[VAR_39_]], [[VAR_37_]] [7] : vector<4xf32> into vector<8x4xf32> -// CHECK: [[VAR_41_:%.+]] = vector.shape_cast [[VAR_40_]] : vector<8x4xf32> to vector<32xf32> -// CHECK: vector.store [[VAR_41_]], [[VAR_reshape_42_]]{{.}}[[VAR_14_6_]]{{.}} : memref<1024xf32>, vector<32xf32> +// CHECK-DAG: [[VAR_18_3_:%.+]] = "krnl.round_even"([[VAR_17_3_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_19_:%.+]] = vector.extract [[VAR_16_4_]][1] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_20_:%.+]] = "krnl.round_even"([[VAR_19_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_21_:%.+]] = vector.extract [[VAR_16_4_]][2] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_22_:%.+]] = "krnl.round_even"([[VAR_21_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_23_:%.+]] = vector.extract [[VAR_16_4_]][3] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_24_:%.+]] = "krnl.round_even"([[VAR_23_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_25_:%.+]] = vector.extract [[VAR_16_4_]][4] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_26_:%.+]] = "krnl.round_even"([[VAR_25_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_27_:%.+]] = vector.extract [[VAR_16_4_]][5] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_28_:%.+]] = "krnl.round_even"([[VAR_27_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_29_:%.+]] = vector.extract [[VAR_16_4_]][6] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_30_:%.+]] = "krnl.round_even"([[VAR_29_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_31_:%.+]] = vector.extract [[VAR_16_4_]][7] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_32_:%.+]] = "krnl.round_even"([[VAR_31_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_33_:%.+]]:4 = vector.to_elements [[VAR_18_3_]] : vector<4xf32> +// CHECK-DAG: [[VAR_34_:%.+]]:4 = vector.to_elements [[VAR_20_]] : vector<4xf32> +// CHECK-DAG: [[VAR_35_:%.+]]:4 = vector.to_elements [[VAR_22_]] : vector<4xf32> +// CHECK-DAG: [[VAR_36_:%.+]]:4 = vector.to_elements [[VAR_24_]] : vector<4xf32> +// CHECK-DAG: [[VAR_37_:%.+]]:4 = vector.to_elements [[VAR_26_]] : vector<4xf32> +// CHECK-DAG: [[VAR_38_:%.+]]:4 = vector.to_elements [[VAR_28_]] : vector<4xf32> +// CHECK-DAG: [[VAR_39_:%.+]]:4 = vector.to_elements [[VAR_30_]] : vector<4xf32> +// CHECK: [[VAR_40_:%.+]]:4 = vector.to_elements [[VAR_32_]] : vector<4xf32> +// CHECK: [[VAR_41_:%.+]] = vector.from_elements [[VAR_33_]]#0, [[VAR_33_]]#1, [[VAR_33_]]#2, [[VAR_33_]]#3, [[VAR_34_]]#0, [[VAR_34_]]#1, [[VAR_34_]]#2, [[VAR_34_]]#3, [[VAR_35_]]#0, [[VAR_35_]]#1, [[VAR_35_]]#2, [[VAR_35_]]#3, [[VAR_36_]]#0, [[VAR_36_]]#1, [[VAR_36_]]#2, [[VAR_36_]]#3, [[VAR_37_]]#0, [[VAR_37_]]#1, [[VAR_37_]]#2, [[VAR_37_]]#3, [[VAR_38_]]#0, [[VAR_38_]]#1, [[VAR_38_]]#2, [[VAR_38_]]#3, [[VAR_39_]]#0, [[VAR_39_]]#1, [[VAR_39_]]#2, [[VAR_39_]]#3, [[VAR_40_]]#0, [[VAR_40_]]#1, [[VAR_40_]]#2, [[VAR_40_]]#3 : vector<8x4xf32> +// CHECK: [[VAR_42_:%.+]] = vector.shape_cast [[VAR_41_]] : vector<8x4xf32> to vector<32xf32> +// CHECK: vector.store [[VAR_42_]], [[VAR_reshape_42_]]{{.}}[[VAR_14_6_]]{{.}} : memref<1024xf32>, vector<32xf32> // CHECK: } // CHECK: } // CHECK-DAG: [[RES_27_:%.+]] = memref.alloc() {{.*}}: memref<16x64xi32> @@ -588,31 +596,39 @@ func.func @qlinearmatmul_ui8_f32(%arg0: tensor<16x32xui8>, %arg1: tensor<1xf32>, // CHECK: [[LOAD_VAR_reshape_MEM_1_1_1_1_1_1_:%.+]] = vector.load [[VAR_reshape_79_]]{{.}}[[VAR_44_12_]]{{.}} : memref<1024xf32>, vector<32xf32> // CHECK: [[VAR_46_8_:%.+]] = vector.shape_cast [[LOAD_VAR_reshape_MEM_1_1_1_1_1_1_]] : vector<32xf32> to vector<8x4xf32> // CHECK: [[VAR_47_7_:%.+]] = vector.extract [[VAR_46_8_]][0] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_48_5_:%.+]] = "krnl.round_even"([[VAR_47_7_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_49_:%.+]] = vector.insert [[VAR_48_5_]], [[VAR_46_8_]] [0] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_50_:%.+]] = vector.extract [[VAR_46_8_]][1] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_51_:%.+]] = "krnl.round_even"([[VAR_50_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_52_:%.+]] = vector.insert [[VAR_51_]], [[VAR_49_]] [1] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_53_:%.+]] = vector.extract [[VAR_46_8_]][2] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_54_:%.+]] = "krnl.round_even"([[VAR_53_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_55_:%.+]] = vector.insert [[VAR_54_]], [[VAR_52_]] [2] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_56_:%.+]] = vector.extract [[VAR_46_8_]][3] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_57_:%.+]] = "krnl.round_even"([[VAR_56_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_58_:%.+]] = vector.insert [[VAR_57_]], [[VAR_55_]] [3] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_59_:%.+]] = vector.extract [[VAR_46_8_]][4] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_60_:%.+]] = "krnl.round_even"([[VAR_59_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_61_:%.+]] = vector.insert [[VAR_60_]], [[VAR_58_]] [4] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_62_:%.+]] = vector.extract [[VAR_46_8_]][5] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_63_:%.+]] = "krnl.round_even"([[VAR_62_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_64_:%.+]] = vector.insert [[VAR_63_]], [[VAR_61_]] [5] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_65_:%.+]] = vector.extract [[VAR_46_8_]][6] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_66_:%.+]] = "krnl.round_even"([[VAR_65_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_67_:%.+]] = vector.insert [[VAR_66_]], [[VAR_64_]] [6] : vector<4xf32> into vector<8x4xf32> -// CHECK-DAG: [[VAR_68_:%.+]] = vector.extract [[VAR_46_8_]][7] : vector<4xf32> from vector<8x4xf32> -// CHECK: [[VAR_69_:%.+]] = "krnl.round_even"([[VAR_68_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_70_:%.+]] = vector.insert [[VAR_69_]], [[VAR_67_]] [7] : vector<4xf32> into vector<8x4xf32> -// CHECK: [[VAR_71_:%.+]] = vector.shape_cast [[VAR_70_]] : vector<8x4xf32> to vector<32xf32> -// CHECK: vector.store [[VAR_71_]], [[VAR_reshape_81_]]{{.}}[[VAR_44_12_]]{{.}} : memref<1024xf32>, vector<32xf32> +// CHECK-DAG: [[VAR_48_5_:%.+]] = "krnl.round_even"([[VAR_47_7_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_49_:%.+]] = vector.extract [[VAR_46_8_]][1] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_50_:%.+]] = "krnl.round_even"([[VAR_49_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_51_:%.+]] = vector.extract [[VAR_46_8_]][2] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_52_:%.+]] = "krnl.round_even"([[VAR_51_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_53_:%.+]] = vector.extract [[VAR_46_8_]][3] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_54_:%.+]] = "krnl.round_even"([[VAR_53_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_55_:%.+]] = vector.extract [[VAR_46_8_]][4] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_56_:%.+]] = "krnl.round_even"([[VAR_55_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_57_:%.+]] = vector.extract [[VAR_46_8_]][5] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_58_:%.+]] = "krnl.round_even"([[VAR_57_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_59_:%.+]] = vector.extract [[VAR_46_8_]][6] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_60_:%.+]] = "krnl.round_even"([[VAR_59_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_61_:%.+]] = vector.extract [[VAR_46_8_]][7] : vector<4xf32> from vector<8x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_62_:%.+]] = "krnl.round_even"([[VAR_61_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_63_:%.+]]:4 = vector.to_elements [[VAR_48_5_]] : vector<4xf32> +// CHECK-DAG: [[VAR_64_:%.+]]:4 = vector.to_elements [[VAR_50_]] : vector<4xf32> +// CHECK-DAG: [[VAR_65_:%.+]]:4 = vector.to_elements [[VAR_52_]] : vector<4xf32> +// CHECK-DAG: [[VAR_66_:%.+]]:4 = vector.to_elements [[VAR_54_]] : vector<4xf32> +// CHECK-DAG: [[VAR_67_:%.+]]:4 = vector.to_elements [[VAR_56_]] : vector<4xf32> +// CHECK-DAG: [[VAR_68_:%.+]]:4 = vector.to_elements [[VAR_58_]] : vector<4xf32> +// CHECK-DAG: [[VAR_69_:%.+]]:4 = vector.to_elements [[VAR_60_]] : vector<4xf32> +// CHECK: [[VAR_70_:%.+]]:4 = vector.to_elements [[VAR_62_]] : vector<4xf32> +// CHECK: [[VAR_71_:%.+]] = vector.from_elements [[VAR_63_]]#0, [[VAR_63_]]#1, [[VAR_63_]]#2, [[VAR_63_]]#3, [[VAR_64_]]#0, [[VAR_64_]]#1, [[VAR_64_]]#2, [[VAR_64_]]#3, [[VAR_65_]]#0, [[VAR_65_]]#1, [[VAR_65_]]#2, [[VAR_65_]]#3, [[VAR_66_]]#0, [[VAR_66_]]#1, [[VAR_66_]]#2, [[VAR_66_]]#3, [[VAR_67_]]#0, [[VAR_67_]]#1, [[VAR_67_]]#2, [[VAR_67_]]#3, [[VAR_68_]]#0, [[VAR_68_]]#1, [[VAR_68_]]#2, [[VAR_68_]]#3, [[VAR_69_]]#0, [[VAR_69_]]#1, [[VAR_69_]]#2, [[VAR_69_]]#3, [[VAR_70_]]#0, [[VAR_70_]]#1, [[VAR_70_]]#2, [[VAR_70_]]#3 : vector<8x4xf32> +// CHECK: [[VAR_72_:%.+]] = vector.shape_cast [[VAR_71_]] : vector<8x4xf32> to vector<32xf32> +// CHECK: vector.store [[VAR_72_]], [[VAR_reshape_81_]]{{.}}[[VAR_44_12_]]{{.}} : memref<1024xf32>, vector<32xf32> // CHECK: } // CHECK: } // CHECK-DAG: [[RES_54_:%.+]] = memref.alloc() {{.*}}: memref<16x64xi32> @@ -706,4 +722,4 @@ func.func @qlinearmatmul_ui8_f32(%arg0: tensor<16x32xui8>, %arg1: tensor<1xf32>, // CHECK: } // CHECK: return [[RES_66_]] : memref<16x64xui8> // CHECK: } -} +} \ No newline at end of file diff --git a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir index 0f50420217..9682e8cf88 100644 --- a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir +++ b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir @@ -86,26 +86,30 @@ func.func @test_dynamic_quantize_linear_simd_only(%arg0: tensor<256x16xf32>) -> // CHECK: [[LOAD_RES_4_MEM_2_:%.+]] = arith.divf [[LOAD_VAR_reshape_MEM_2_]], [[LOAD_VAR_reshape_MEM_1_]] : vector<16xf32> // CHECK: [[LOAD_RES_6_MEM_2_:%.+]] = vector.shape_cast [[LOAD_RES_4_MEM_2_]] : vector<16xf32> to vector<4x4xf32> // CHECK: [[VAR_25_1_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][0] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_26_1_:%.+]] = "krnl.round_even"([[VAR_25_1_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_27_:%.+]] = vector.insert [[VAR_26_1_]], [[LOAD_RES_6_MEM_2_]] [0] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_28_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][1] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_29_:%.+]] = "krnl.round_even"([[VAR_28_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_30_:%.+]] = vector.insert [[VAR_29_]], [[VAR_27_]] [1] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_31_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][2] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_32_:%.+]] = "krnl.round_even"([[VAR_31_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_33_:%.+]] = vector.insert [[VAR_32_]], [[VAR_30_]] [2] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_34_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][3] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_35_:%.+]] = "krnl.round_even"([[VAR_34_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_36_:%.+]] = vector.insert [[VAR_35_]], [[VAR_33_]] [3] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_37_:%.+]] = vector.shape_cast [[VAR_36_]] : vector<4x4xf32> to vector<16xf32> -// CHECK-DAG: [[VAR_38_:%.+]] = vector.broadcast [[VAR_15_]] : f32 to vector<16xf32> -// CHECK: [[VAR_39_:%.+]] = arith.addf [[VAR_37_]], [[VAR_38_]] : vector<16xf32> -// CHECK: [[VAR_40_:%.+]] = arith.maxnumf [[VAR_39_]], [[VAR_cst_0_]] : vector<16xf32> -// CHECK: [[VAR_41_:%.+]] = arith.minnumf [[VAR_40_]], [[VAR_cst_]] : vector<16xf32> -// CHECK: [[VAR_42_:%.+]] = arith.fptoui [[VAR_41_]] : vector<16xf32> to vector<16xi32> -// CHECK: [[VAR_43_:%.+]] = arith.trunci [[VAR_42_]] : vector<16xi32> to vector<16xi8> -// CHECK: [[VAR_44_:%.+]] = builtin.unrealized_conversion_cast [[VAR_43_]] : vector<16xi8> to vector<16xui8> -// CHECK: vector.store [[VAR_44_]], [[VAR_reshape_15_]]{{.}}[[VAR_20_1_]]{{.}} : memref<4096xui8>, vector<16xui8> +// CHECK-DAG: [[VAR_26_1_:%.+]] = "krnl.round_even"([[VAR_25_1_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_27_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][1] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_28_:%.+]] = "krnl.round_even"([[VAR_27_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_29_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][2] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_30_:%.+]] = "krnl.round_even"([[VAR_29_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_31_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][3] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_32_:%.+]] = "krnl.round_even"([[VAR_31_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_33_:%.+]]:4 = vector.to_elements [[VAR_26_1_]] : vector<4xf32> +// CHECK-DAG: [[VAR_34_:%.+]]:4 = vector.to_elements [[VAR_28_]] : vector<4xf32> +// CHECK-DAG: [[VAR_35_:%.+]]:4 = vector.to_elements [[VAR_30_]] : vector<4xf32> +// CHECK: [[VAR_36_:%.+]]:4 = vector.to_elements [[VAR_32_]] : vector<4xf32> +// CHECK: [[VAR_37_:%.+]] = vector.from_elements [[VAR_33_]]#0, [[VAR_33_]]#1, [[VAR_33_]]#2, [[VAR_33_]]#3, [[VAR_34_]]#0, [[VAR_34_]]#1, [[VAR_34_]]#2, [[VAR_34_]]#3, [[VAR_35_]]#0, [[VAR_35_]]#1, [[VAR_35_]]#2, [[VAR_35_]]#3, [[VAR_36_]]#0, [[VAR_36_]]#1, [[VAR_36_]]#2, [[VAR_36_]]#3 : vector<4x4xf32> +// CHECK-DAG: [[VAR_38_:%.+]] = vector.shape_cast [[VAR_37_]] : vector<4x4xf32> to vector<16xf32> +// CHECK-DAG: [[VAR_39_:%.+]] = vector.broadcast [[VAR_15_]] : f32 to vector<16xf32> +// CHECK: [[VAR_40_:%.+]] = arith.addf [[VAR_38_]], [[VAR_39_]] : vector<16xf32> +// CHECK: [[VAR_41_:%.+]] = arith.maxnumf [[VAR_40_]], [[VAR_cst_0_]] : vector<16xf32> +// CHECK: [[VAR_42_:%.+]] = arith.minnumf [[VAR_41_]], [[VAR_cst_]] : vector<16xf32> +// CHECK: [[VAR_43_:%.+]] = arith.fptoui [[VAR_42_]] : vector<16xf32> to vector<16xi32> +// CHECK: [[VAR_44_:%.+]] = arith.trunci [[VAR_43_]] : vector<16xi32> to vector<16xi8> +// CHECK: [[VAR_45_:%.+]] = builtin.unrealized_conversion_cast [[VAR_44_]] : vector<16xi8> to vector<16xui8> +// CHECK: vector.store [[VAR_45_]], [[VAR_reshape_15_]]{{.}}[[VAR_20_1_]]{{.}} : memref<4096xui8>, vector<16xui8> // CHECK: } // CHECK: return [[RES_]], [[RES_]]_5, [[RES_]]_6 : memref<256x16xui8>, memref, memref // CHECK: } @@ -207,26 +211,30 @@ func.func @test_dynamic_quantize_linear_simd_and_scalar(%arg0: tensor<255x17xf32 // CHECK: [[LOAD_RES_4_MEM_1_:%.+]] = arith.divf [[LOAD_VAR_reshape_MEM_2_]], [[LOAD_VAR_reshape_MEM_3_]] : vector<16xf32> // CHECK: [[LOAD_RES_6_MEM_1_:%.+]] = vector.shape_cast [[LOAD_RES_4_MEM_1_]] : vector<16xf32> to vector<4x4xf32> // CHECK: [[VAR_27_2_:%.+]] = vector.extract [[LOAD_RES_6_MEM_1_]][0] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_28_2_:%.+]] = "krnl.round_even"([[VAR_27_2_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_29_:%.+]] = vector.insert [[VAR_28_2_]], [[LOAD_RES_6_MEM_1_]] [0] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_30_:%.+]] = vector.extract [[LOAD_RES_6_MEM_1_]][1] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_31_:%.+]] = "krnl.round_even"([[VAR_30_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_32_:%.+]] = vector.insert [[VAR_31_]], [[VAR_29_]] [1] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_33_:%.+]] = vector.extract [[LOAD_RES_6_MEM_1_]][2] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_34_:%.+]] = "krnl.round_even"([[VAR_33_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_35_:%.+]] = vector.insert [[VAR_34_]], [[VAR_32_]] [2] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_36_:%.+]] = vector.extract [[LOAD_RES_6_MEM_1_]][3] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_37_:%.+]] = "krnl.round_even"([[VAR_36_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_38_:%.+]] = vector.insert [[VAR_37_]], [[VAR_35_]] [3] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_39_:%.+]] = vector.shape_cast [[VAR_38_]] : vector<4x4xf32> to vector<16xf32> -// CHECK-DAG: [[VAR_40_:%.+]] = vector.broadcast [[VAR_16_]] : f32 to vector<16xf32> -// CHECK: [[VAR_41_:%.+]] = arith.addf [[VAR_39_]], [[VAR_40_]] : vector<16xf32> -// CHECK: [[VAR_42_:%.+]] = arith.maxnumf [[VAR_41_]], [[VAR_cst_0_]] : vector<16xf32> -// CHECK: [[VAR_43_:%.+]] = arith.minnumf [[VAR_42_]], [[VAR_cst_]] : vector<16xf32> -// CHECK: [[VAR_44_:%.+]] = arith.fptoui [[VAR_43_]] : vector<16xf32> to vector<16xi32> -// CHECK: [[VAR_45_:%.+]] = arith.trunci [[VAR_44_]] : vector<16xi32> to vector<16xi8> -// CHECK: [[VAR_46_:%.+]] = builtin.unrealized_conversion_cast [[VAR_45_]] : vector<16xi8> to vector<16xui8> -// CHECK: vector.store [[VAR_46_]], [[VAR_reshape_15_]]{{.}}[[VAR_22_2_]]{{.}} : memref<4335xui8>, vector<16xui8> +// CHECK-DAG: [[VAR_28_2_:%.+]] = "krnl.round_even"([[VAR_27_2_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_29_:%.+]] = vector.extract [[LOAD_RES_6_MEM_1_]][1] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_30_:%.+]] = "krnl.round_even"([[VAR_29_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_31_:%.+]] = vector.extract [[LOAD_RES_6_MEM_1_]][2] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_32_:%.+]] = "krnl.round_even"([[VAR_31_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_33_:%.+]] = vector.extract [[LOAD_RES_6_MEM_1_]][3] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_34_:%.+]] = "krnl.round_even"([[VAR_33_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_35_:%.+]]:4 = vector.to_elements [[VAR_28_2_]] : vector<4xf32> +// CHECK-DAG: [[VAR_36_:%.+]]:4 = vector.to_elements [[VAR_30_]] : vector<4xf32> +// CHECK-DAG: [[VAR_37_:%.+]]:4 = vector.to_elements [[VAR_32_]] : vector<4xf32> +// CHECK: [[VAR_38_:%.+]]:4 = vector.to_elements [[VAR_34_]] : vector<4xf32> +// CHECK: [[VAR_39_:%.+]] = vector.from_elements [[VAR_35_]]#0, [[VAR_35_]]#1, [[VAR_35_]]#2, [[VAR_35_]]#3, [[VAR_36_]]#0, [[VAR_36_]]#1, [[VAR_36_]]#2, [[VAR_36_]]#3, [[VAR_37_]]#0, [[VAR_37_]]#1, [[VAR_37_]]#2, [[VAR_37_]]#3, [[VAR_38_]]#0, [[VAR_38_]]#1, [[VAR_38_]]#2, [[VAR_38_]]#3 : vector<4x4xf32> +// CHECK-DAG: [[VAR_40_:%.+]] = vector.shape_cast [[VAR_39_]] : vector<4x4xf32> to vector<16xf32> +// CHECK-DAG: [[VAR_41_:%.+]] = vector.broadcast [[VAR_16_]] : f32 to vector<16xf32> +// CHECK: [[VAR_42_:%.+]] = arith.addf [[VAR_40_]], [[VAR_41_]] : vector<16xf32> +// CHECK: [[VAR_43_:%.+]] = arith.maxnumf [[VAR_42_]], [[VAR_cst_0_]] : vector<16xf32> +// CHECK: [[VAR_44_:%.+]] = arith.minnumf [[VAR_43_]], [[VAR_cst_]] : vector<16xf32> +// CHECK: [[VAR_45_:%.+]] = arith.fptoui [[VAR_44_]] : vector<16xf32> to vector<16xi32> +// CHECK: [[VAR_46_:%.+]] = arith.trunci [[VAR_45_]] : vector<16xi32> to vector<16xi8> +// CHECK: [[VAR_47_:%.+]] = builtin.unrealized_conversion_cast [[VAR_46_]] : vector<16xi8> to vector<16xui8> +// CHECK: vector.store [[VAR_47_]], [[VAR_reshape_15_]]{{.}}[[VAR_22_2_]]{{.}} : memref<4335xui8>, vector<16xui8> // CHECK: } // CHECK: [[LOOP_3_:%.+]] = krnl.define_loops 1 // CHECK: krnl.iterate([[LOOP_3_]]) with ([[LOOP_3_]] -> [[I_3_:%.+]] = 4320 to 4335){ @@ -329,22 +337,23 @@ func.func @test_dynamic_quantize_linear_reduced_simd_only(%arg0: tensor<1x8xf32> // CHECK: [[LOAD_RES_4_MEM_2_:%.+]] = arith.divf [[LOAD_VAR_reshape_MEM_2_]], [[LOAD_VAR_reshape_MEM_1_]] : vector<8xf32> // CHECK: [[LOAD_RES_6_MEM_2_:%.+]] = vector.shape_cast [[LOAD_RES_4_MEM_2_]] : vector<8xf32> to vector<2x4xf32> // CHECK: [[VAR_25_1_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][0] : vector<4xf32> from vector<2x4xf32> -// CHECK: [[VAR_26_1_:%.+]] = "krnl.round_even"([[VAR_25_1_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_27_:%.+]] = vector.insert [[VAR_26_1_]], [[LOAD_RES_6_MEM_2_]] [0] : vector<4xf32> into vector<2x4xf32> -// CHECK-DAG: [[VAR_28_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][1] : vector<4xf32> from vector<2x4xf32> -// CHECK: [[VAR_29_:%.+]] = "krnl.round_even"([[VAR_28_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_30_:%.+]] = vector.insert [[VAR_29_]], [[VAR_27_]] [1] : vector<4xf32> into vector<2x4xf32> -// CHECK-DAG: [[VAR_31_:%.+]] = vector.shape_cast [[VAR_30_]] : vector<2x4xf32> to vector<8xf32> -// CHECK-DAG: [[VAR_32_:%.+]] = vector.broadcast [[VAR_15_]] : f32 to vector<8xf32> -// CHECK: [[VAR_33_:%.+]] = arith.addf [[VAR_31_]], [[VAR_32_]] : vector<8xf32> -// CHECK: [[VAR_34_:%.+]] = arith.maxnumf [[VAR_33_]], [[VAR_cst_0_]] : vector<8xf32> -// CHECK: [[VAR_35_:%.+]] = arith.minnumf [[VAR_34_]], [[VAR_cst_]] : vector<8xf32> -// CHECK: [[VAR_36_:%.+]] = arith.fptoui [[VAR_35_]] : vector<8xf32> to vector<8xi32> -// CHECK: [[VAR_37_:%.+]] = arith.trunci [[VAR_36_]] : vector<8xi32> to vector<8xi8> -// CHECK: [[VAR_38_:%.+]] = builtin.unrealized_conversion_cast [[VAR_37_]] : vector<8xi8> to vector<8xui8> -// CHECK: vector.store [[VAR_38_]], [[VAR_reshape_15_]]{{.}}[[VAR_20_1_]]{{.}} : memref<8xui8>, vector<8xui8> +// CHECK-DAG: [[VAR_26_1_:%.+]] = "krnl.round_even"([[VAR_25_1_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_27_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][1] : vector<4xf32> from vector<2x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_28_:%.+]] = "krnl.round_even"([[VAR_27_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_29_:%.+]]:4 = vector.to_elements [[VAR_26_1_]] : vector<4xf32> +// CHECK: [[VAR_30_:%.+]]:4 = vector.to_elements [[VAR_28_]] : vector<4xf32> +// CHECK: [[VAR_31_:%.+]] = vector.from_elements [[VAR_29_]]#0, [[VAR_29_]]#1, [[VAR_29_]]#2, [[VAR_29_]]#3, [[VAR_30_]]#0, [[VAR_30_]]#1, [[VAR_30_]]#2, [[VAR_30_]]#3 : vector<2x4xf32> +// CHECK-DAG: [[VAR_32_:%.+]] = vector.shape_cast [[VAR_31_]] : vector<2x4xf32> to vector<8xf32> +// CHECK-DAG: [[VAR_33_:%.+]] = vector.broadcast [[VAR_15_]] : f32 to vector<8xf32> +// CHECK: [[VAR_34_:%.+]] = arith.addf [[VAR_32_]], [[VAR_33_]] : vector<8xf32> +// CHECK: [[VAR_35_:%.+]] = arith.maxnumf [[VAR_34_]], [[VAR_cst_0_]] : vector<8xf32> +// CHECK: [[VAR_36_:%.+]] = arith.minnumf [[VAR_35_]], [[VAR_cst_]] : vector<8xf32> +// CHECK: [[VAR_37_:%.+]] = arith.fptoui [[VAR_36_]] : vector<8xf32> to vector<8xi32> +// CHECK: [[VAR_38_:%.+]] = arith.trunci [[VAR_37_]] : vector<8xi32> to vector<8xi8> +// CHECK: [[VAR_39_:%.+]] = builtin.unrealized_conversion_cast [[VAR_38_]] : vector<8xi8> to vector<8xui8> +// CHECK: vector.store [[VAR_39_]], [[VAR_reshape_15_]]{{.}}[[VAR_20_1_]]{{.}} : memref<8xui8>, vector<8xui8> // CHECK: } // CHECK: return [[RES_]], [[RES_]]_5, [[RES_]]_6 : memref<1x8xui8>, memref, memref // CHECK: } -} - +} \ No newline at end of file diff --git a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir index 6cc83331d1..9290cac6f4 100644 --- a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir +++ b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir @@ -139,26 +139,30 @@ func.func @test_dynamic_quantize_linear_simd_only(%arg0: tensor<256x16xf32>) -> // CHECK: [[VAR_24_1_:%.+]] = arith.divf [[VAR_22_1_]], [[VAR_23_2_]] : vector<16xf32> // CHECK: [[VAR_25_1_:%.+]] = vector.shape_cast [[VAR_24_1_]] : vector<16xf32> to vector<4x4xf32> // CHECK: [[VAR_26_2_:%.+]] = vector.extract [[VAR_25_1_]][0] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[LOAD_RES_4_MEM_2_1_:%.+]] = "krnl.round_even"([[VAR_26_2_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[LOAD_RES_6_MEM_2_:%.+]] = vector.insert [[LOAD_RES_4_MEM_2_1_]], [[VAR_25_1_]] [0] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_29_1_:%.+]] = vector.extract [[VAR_25_1_]][1] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_30_1_:%.+]] = "krnl.round_even"([[VAR_29_1_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[LOAD_VAR_reshape_MEM_2_:%.+]] = vector.insert [[VAR_30_1_]], [[LOAD_RES_6_MEM_2_]] [1] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[LOAD_VAR_reshape_MEM_3_:%.+]] = vector.extract [[VAR_25_1_]][2] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[LOAD_RES_4_MEM_1_:%.+]] = "krnl.round_even"([[LOAD_VAR_reshape_MEM_3_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[LOAD_RES_6_MEM_1_:%.+]] = vector.insert [[LOAD_RES_4_MEM_1_]], [[LOAD_VAR_reshape_MEM_2_]] [2] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_35_2_:%.+]] = vector.extract [[VAR_25_1_]][3] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_36_2_:%.+]] = "krnl.round_even"([[VAR_35_2_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_37_:%.+]] = vector.insert [[VAR_36_2_]], [[LOAD_RES_6_MEM_1_]] [3] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_38_:%.+]] = vector.shape_cast [[VAR_37_]] : vector<4x4xf32> to vector<16xf32> -// CHECK-DAG: [[VAR_39_:%.+]] = vector.broadcast [[VAR_16_]] : f32 to vector<16xf32> -// CHECK: [[VAR_40_:%.+]] = arith.addf [[VAR_38_]], [[VAR_39_]] : vector<16xf32> -// CHECK: [[VAR_41_:%.+]] = arith.maxnumf [[VAR_40_]], [[VAR_cst_0_]] : vector<16xf32> -// CHECK: [[VAR_42_:%.+]] = arith.minnumf [[VAR_41_]], [[VAR_cst_]] : vector<16xf32> -// CHECK: [[VAR_43_:%.+]] = arith.fptoui [[VAR_42_]] : vector<16xf32> to vector<16xi32> -// CHECK: [[VAR_44_:%.+]] = arith.trunci [[VAR_43_]] : vector<16xi32> to vector<16xi8> -// CHECK: [[VAR_45_:%.+]] = builtin.unrealized_conversion_cast [[VAR_44_]] : vector<16xi8> to vector<16xui8> -// CHECK: vector.store [[VAR_45_]], [[VAR_reshape_19_]]{{.}}[[VAR_21_2_]]{{.}} : memref<4096xui8>, vector<16xui8> +// CHECK-DAG: [[LOAD_RES_4_MEM_2_1_:%.+]] = "krnl.round_even"([[VAR_26_2_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[LOAD_RES_6_MEM_2_:%.+]] = vector.extract [[VAR_25_1_]][1] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_29_1_:%.+]] = "krnl.round_even"([[LOAD_RES_6_MEM_2_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_30_1_:%.+]] = vector.extract [[VAR_25_1_]][2] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[LOAD_VAR_reshape_MEM_2_:%.+]] = "krnl.round_even"([[VAR_30_1_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[LOAD_VAR_reshape_MEM_3_:%.+]] = vector.extract [[VAR_25_1_]][3] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[LOAD_RES_4_MEM_1_:%.+]] = "krnl.round_even"([[LOAD_VAR_reshape_MEM_3_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[LOAD_RES_6_MEM_1_:%.+]]:4 = vector.to_elements [[LOAD_RES_4_MEM_2_1_]] : vector<4xf32> +// CHECK-DAG: [[VAR_35_2_:%.+]]:4 = vector.to_elements [[VAR_29_1_]] : vector<4xf32> +// CHECK-DAG: [[VAR_36_2_:%.+]]:4 = vector.to_elements [[LOAD_VAR_reshape_MEM_2_]] : vector<4xf32> +// CHECK: [[VAR_37_:%.+]]:4 = vector.to_elements [[LOAD_RES_4_MEM_1_]] : vector<4xf32> +// CHECK: [[VAR_38_:%.+]] = vector.from_elements [[LOAD_RES_6_MEM_1_]]#0, [[LOAD_RES_6_MEM_1_]]#1, [[LOAD_RES_6_MEM_1_]]#2, [[LOAD_RES_6_MEM_1_]]#3, [[VAR_35_2_]]#0, [[VAR_35_2_]]#1, [[VAR_35_2_]]#2, [[VAR_35_2_]]#3, [[VAR_36_2_]]#0, [[VAR_36_2_]]#1, [[VAR_36_2_]]#2, [[VAR_36_2_]]#3, [[VAR_37_]]#0, [[VAR_37_]]#1, [[VAR_37_]]#2, [[VAR_37_]]#3 : vector<4x4xf32> +// CHECK-DAG: [[VAR_39_:%.+]] = vector.shape_cast [[VAR_38_]] : vector<4x4xf32> to vector<16xf32> +// CHECK-DAG: [[VAR_40_:%.+]] = vector.broadcast [[VAR_16_]] : f32 to vector<16xf32> +// CHECK: [[VAR_41_:%.+]] = arith.addf [[VAR_39_]], [[VAR_40_]] : vector<16xf32> +// CHECK: [[VAR_42_:%.+]] = arith.maxnumf [[VAR_41_]], [[VAR_cst_0_]] : vector<16xf32> +// CHECK: [[VAR_43_:%.+]] = arith.minnumf [[VAR_42_]], [[VAR_cst_]] : vector<16xf32> +// CHECK: [[VAR_44_:%.+]] = arith.fptoui [[VAR_43_]] : vector<16xf32> to vector<16xi32> +// CHECK: [[VAR_45_:%.+]] = arith.trunci [[VAR_44_]] : vector<16xi32> to vector<16xi8> +// CHECK: [[VAR_46_:%.+]] = builtin.unrealized_conversion_cast [[VAR_45_]] : vector<16xi8> to vector<16xui8> +// CHECK: vector.store [[VAR_46_]], [[VAR_reshape_19_]]{{.}}[[VAR_21_2_]]{{.}} : memref<4096xui8>, vector<16xui8> // CHECK: } // CHECK: return [[RES_]], [[RES_]]_7, [[RES_]]_8 : memref<256x16xui8>, memref, memref // CHECK: } @@ -299,26 +303,30 @@ func.func @test_dynamic_quantize_linear_simd_and_scalar(%arg0: tensor<255x17xf32 // CHECK: [[VAR_25_1_:%.+]] = arith.divf [[VAR_23_1_]], [[VAR_24_2_]] : vector<16xf32> // CHECK: [[VAR_26_1_:%.+]] = vector.shape_cast [[VAR_25_1_]] : vector<16xf32> to vector<4x4xf32> // CHECK: [[VAR_27_2_:%.+]] = vector.extract [[VAR_26_1_]][0] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[LOAD_RES_4_MEM_2_1_:%.+]] = "krnl.round_even"([[VAR_27_2_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[LOAD_RES_6_MEM_2_:%.+]] = vector.insert [[LOAD_RES_4_MEM_2_1_]], [[VAR_26_1_]] [0] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_30_1_:%.+]] = vector.extract [[VAR_26_1_]][1] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_31_1_:%.+]] = "krnl.round_even"([[VAR_30_1_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[LOAD_VAR_reshape_MEM_2_:%.+]] = vector.insert [[VAR_31_1_]], [[LOAD_RES_6_MEM_2_]] [1] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[LOAD_VAR_reshape_MEM_3_:%.+]] = vector.extract [[VAR_26_1_]][2] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[LOAD_RES_4_MEM_1_:%.+]] = "krnl.round_even"([[LOAD_VAR_reshape_MEM_3_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[LOAD_RES_6_MEM_1_:%.+]] = vector.insert [[LOAD_RES_4_MEM_1_]], [[LOAD_VAR_reshape_MEM_2_]] [2] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_36_2_:%.+]] = vector.extract [[VAR_26_1_]][3] : vector<4xf32> from vector<4x4xf32> -// CHECK: [[VAR_37_2_:%.+]] = "krnl.round_even"([[VAR_36_2_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_38_:%.+]] = vector.insert [[VAR_37_2_]], [[LOAD_RES_6_MEM_1_]] [3] : vector<4xf32> into vector<4x4xf32> -// CHECK-DAG: [[VAR_39_:%.+]] = vector.shape_cast [[VAR_38_]] : vector<4x4xf32> to vector<16xf32> -// CHECK-DAG: [[VAR_40_:%.+]] = vector.broadcast [[VAR_16_]] : f32 to vector<16xf32> -// CHECK: [[VAR_41_:%.+]] = arith.addf [[VAR_39_]], [[VAR_40_]] : vector<16xf32> -// CHECK: [[VAR_42_:%.+]] = arith.maxnumf [[VAR_41_]], [[VAR_cst_0_]] : vector<16xf32> -// CHECK: [[VAR_43_:%.+]] = arith.minnumf [[VAR_42_]], [[VAR_cst_]] : vector<16xf32> -// CHECK: [[VAR_44_:%.+]] = arith.fptoui [[VAR_43_]] : vector<16xf32> to vector<16xi32> -// CHECK: [[VAR_45_:%.+]] = arith.trunci [[VAR_44_]] : vector<16xi32> to vector<16xi8> -// CHECK: [[VAR_46_:%.+]] = builtin.unrealized_conversion_cast [[VAR_45_]] : vector<16xi8> to vector<16xui8> -// CHECK: vector.store [[VAR_46_]], [[VAR_reshape_19_]]{{.}}[[VAR_22_2_]]{{.}} : memref<4335xui8>, vector<16xui8> +// CHECK-DAG: [[LOAD_RES_4_MEM_2_1_:%.+]] = "krnl.round_even"([[VAR_27_2_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[LOAD_RES_6_MEM_2_:%.+]] = vector.extract [[VAR_26_1_]][1] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_30_1_:%.+]] = "krnl.round_even"([[LOAD_RES_6_MEM_2_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_31_1_:%.+]] = vector.extract [[VAR_26_1_]][2] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[LOAD_VAR_reshape_MEM_2_:%.+]] = "krnl.round_even"([[VAR_31_1_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[LOAD_VAR_reshape_MEM_3_:%.+]] = vector.extract [[VAR_26_1_]][3] : vector<4xf32> from vector<4x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[LOAD_RES_4_MEM_1_:%.+]] = "krnl.round_even"([[LOAD_VAR_reshape_MEM_3_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[LOAD_RES_6_MEM_1_:%.+]]:4 = vector.to_elements [[LOAD_RES_4_MEM_2_1_]] : vector<4xf32> +// CHECK-DAG: [[VAR_36_2_:%.+]]:4 = vector.to_elements [[VAR_30_1_]] : vector<4xf32> +// CHECK-DAG: [[VAR_37_2_:%.+]]:4 = vector.to_elements [[LOAD_VAR_reshape_MEM_2_]] : vector<4xf32> +// CHECK: [[VAR_38_:%.+]]:4 = vector.to_elements [[LOAD_RES_4_MEM_1_]] : vector<4xf32> +// CHECK: [[VAR_39_:%.+]] = vector.from_elements [[LOAD_RES_6_MEM_1_]]#0, [[LOAD_RES_6_MEM_1_]]#1, [[LOAD_RES_6_MEM_1_]]#2, [[LOAD_RES_6_MEM_1_]]#3, [[VAR_36_2_]]#0, [[VAR_36_2_]]#1, [[VAR_36_2_]]#2, [[VAR_36_2_]]#3, [[VAR_37_2_]]#0, [[VAR_37_2_]]#1, [[VAR_37_2_]]#2, [[VAR_37_2_]]#3, [[VAR_38_]]#0, [[VAR_38_]]#1, [[VAR_38_]]#2, [[VAR_38_]]#3 : vector<4x4xf32> +// CHECK-DAG: [[VAR_40_:%.+]] = vector.shape_cast [[VAR_39_]] : vector<4x4xf32> to vector<16xf32> +// CHECK-DAG: [[VAR_41_:%.+]] = vector.broadcast [[VAR_16_]] : f32 to vector<16xf32> +// CHECK: [[VAR_42_:%.+]] = arith.addf [[VAR_40_]], [[VAR_41_]] : vector<16xf32> +// CHECK: [[VAR_43_:%.+]] = arith.maxnumf [[VAR_42_]], [[VAR_cst_0_]] : vector<16xf32> +// CHECK: [[VAR_44_:%.+]] = arith.minnumf [[VAR_43_]], [[VAR_cst_]] : vector<16xf32> +// CHECK: [[VAR_45_:%.+]] = arith.fptoui [[VAR_44_]] : vector<16xf32> to vector<16xi32> +// CHECK: [[VAR_46_:%.+]] = arith.trunci [[VAR_45_]] : vector<16xi32> to vector<16xi8> +// CHECK: [[VAR_47_:%.+]] = builtin.unrealized_conversion_cast [[VAR_46_]] : vector<16xi8> to vector<16xui8> +// CHECK: vector.store [[VAR_47_]], [[VAR_reshape_19_]]{{.}}[[VAR_22_2_]]{{.}} : memref<4335xui8>, vector<16xui8> // CHECK: } // CHECK: [[LOOP_3_:%.+]] = krnl.define_loops 1 // CHECK: krnl.iterate([[LOOP_3_]]) with ([[LOOP_3_]] -> [[I_5_:%.+]] = 4320 to 4335){ @@ -414,6 +422,7 @@ func.func @test_dynamic_quantize_linear_reduced_simd_only(%arg0: tensor<1x8xf32> // CHECK-DAG: [[VAR_reshape_15_:%.+]] = memref.reshape [[RES_]]([[RES_]]_14) : (memref<1x8xui8>, memref<1xindex>) -> memref<8xui8> // CHECK-DAG: [[LOOP_1_:%.+]] = krnl.define_loops 1 // CHECK: [[BLOCK_TILE__1_:%.+]], [[BLOCK_IN__1_:%.+]] = krnl.block [[LOOP_1_]] 8 : (!krnl.loop) -> (!krnl.loop, !krnl.loop) +// CHECK: krnl.parallel([[BLOCK_TILE__1_]]) : !krnl.loop // CHECK: krnl.iterate([[BLOCK_TILE__1_]]) with ([[LOOP_1_]] -> [[I_1_:%.+]] = 0 to 8){ // CHECK: [[VAR_20_1_:%.+]] = krnl.get_induction_var_value([[BLOCK_TILE__1_]]) : (!krnl.loop) -> index // CHECK-DAG: [[LOAD_VAR_reshape_MEM_2_:%.+]] = vector.load [[VAR_reshape_13_]]{{.}}[[VAR_20_1_]]{{.}} : memref<8xf32>, vector<8xf32> @@ -421,21 +430,23 @@ func.func @test_dynamic_quantize_linear_reduced_simd_only(%arg0: tensor<1x8xf32> // CHECK: [[LOAD_RES_4_MEM_2_:%.+]] = arith.divf [[LOAD_VAR_reshape_MEM_2_]], [[LOAD_VAR_reshape_MEM_1_]] : vector<8xf32> // CHECK: [[LOAD_RES_6_MEM_2_:%.+]] = vector.shape_cast [[LOAD_RES_4_MEM_2_]] : vector<8xf32> to vector<2x4xf32> // CHECK: [[VAR_25_1_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][0] : vector<4xf32> from vector<2x4xf32> -// CHECK: [[VAR_26_1_:%.+]] = "krnl.round_even"([[VAR_25_1_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK-DAG: [[VAR_27_:%.+]] = vector.insert [[VAR_26_1_]], [[LOAD_RES_6_MEM_2_]] [0] : vector<4xf32> into vector<2x4xf32> -// CHECK-DAG: [[VAR_28_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][1] : vector<4xf32> from vector<2x4xf32> -// CHECK: [[VAR_29_:%.+]] = "krnl.round_even"([[VAR_28_]]) : (vector<4xf32>) -> vector<4xf32> -// CHECK: [[VAR_30_:%.+]] = vector.insert [[VAR_29_]], [[VAR_27_]] [1] : vector<4xf32> into vector<2x4xf32> -// CHECK-DAG: [[VAR_31_:%.+]] = vector.shape_cast [[VAR_30_]] : vector<2x4xf32> to vector<8xf32> -// CHECK-DAG: [[VAR_32_:%.+]] = vector.broadcast [[VAR_15_]] : f32 to vector<8xf32> -// CHECK: [[VAR_33_:%.+]] = arith.addf [[VAR_31_]], [[VAR_32_]] : vector<8xf32> -// CHECK: [[VAR_34_:%.+]] = arith.maxnumf [[VAR_33_]], [[VAR_cst_0_]] : vector<8xf32> -// CHECK: [[VAR_35_:%.+]] = arith.minnumf [[VAR_34_]], [[VAR_cst_]] : vector<8xf32> -// CHECK: [[VAR_36_:%.+]] = arith.fptoui [[VAR_35_]] : vector<8xf32> to vector<8xi32> -// CHECK: [[VAR_37_:%.+]] = arith.trunci [[VAR_36_]] : vector<8xi32> to vector<8xi8> -// CHECK: [[VAR_38_:%.+]] = builtin.unrealized_conversion_cast [[VAR_37_]] : vector<8xi8> to vector<8xui8> -// CHECK: vector.store [[VAR_38_]], [[VAR_reshape_15_]]{{.}}[[VAR_20_1_]]{{.}} : memref<8xui8>, vector<8xui8> +// CHECK-DAG: [[VAR_26_1_:%.+]] = "krnl.round_even"([[VAR_25_1_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_27_:%.+]] = vector.extract [[LOAD_RES_6_MEM_2_]][1] : vector<4xf32> from vector<2x4xf32> +// CHECK-NOT: separator of consecutive DAGs +// CHECK-DAG: [[VAR_28_:%.+]] = "krnl.round_even"([[VAR_27_]]) : (vector<4xf32>) -> vector<4xf32> +// CHECK-DAG: [[VAR_29_:%.+]]:4 = vector.to_elements [[VAR_26_1_]] : vector<4xf32> +// CHECK: [[VAR_30_:%.+]]:4 = vector.to_elements [[VAR_28_]] : vector<4xf32> +// CHECK: [[VAR_31_:%.+]] = vector.from_elements [[VAR_29_]]#0, [[VAR_29_]]#1, [[VAR_29_]]#2, [[VAR_29_]]#3, [[VAR_30_]]#0, [[VAR_30_]]#1, [[VAR_30_]]#2, [[VAR_30_]]#3 : vector<2x4xf32> +// CHECK-DAG: [[VAR_32_:%.+]] = vector.shape_cast [[VAR_31_]] : vector<2x4xf32> to vector<8xf32> +// CHECK-DAG: [[VAR_33_:%.+]] = vector.broadcast [[VAR_15_]] : f32 to vector<8xf32> +// CHECK: [[VAR_34_:%.+]] = arith.addf [[VAR_32_]], [[VAR_33_]] : vector<8xf32> +// CHECK: [[VAR_35_:%.+]] = arith.maxnumf [[VAR_34_]], [[VAR_cst_0_]] : vector<8xf32> +// CHECK: [[VAR_36_:%.+]] = arith.minnumf [[VAR_35_]], [[VAR_cst_]] : vector<8xf32> +// CHECK: [[VAR_37_:%.+]] = arith.fptoui [[VAR_36_]] : vector<8xf32> to vector<8xi32> +// CHECK: [[VAR_38_:%.+]] = arith.trunci [[VAR_37_]] : vector<8xi32> to vector<8xi8> +// CHECK: [[VAR_39_:%.+]] = builtin.unrealized_conversion_cast [[VAR_38_]] : vector<8xi8> to vector<8xui8> +// CHECK: vector.store [[VAR_39_]], [[VAR_reshape_15_]]{{.}}[[VAR_20_1_]]{{.}} : memref<8xui8>, vector<8xui8> // CHECK: } // CHECK: return [[RES_]], [[RES_]]_5, [[RES_]]_6 : memref<1x8xui8>, memref, memref // CHECK: } -} +} \ No newline at end of file From dd5f93d252dee0cef70b54c59c6a208ae6ef56ba Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Wed, 8 Oct 2025 10:31:39 -0400 Subject: [PATCH 05/20] mlir formating fixes Signed-off-by: Christopher Munoz --- .../onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir | 2 +- .../DynamicQuantizeLinear_with_simd_canonicalize.mlir | 3 ++- .../DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir | 2 +- test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir b/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir index c8f58ebad3..aa051b14a8 100644 --- a/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir +++ b/test/mlir/conversion/onnx_to_krnl/Math/QLinearMatMul_with_canonicalize_O3.mlir @@ -722,4 +722,4 @@ func.func @qlinearmatmul_ui8_f32(%arg0: tensor<16x32xui8>, %arg1: tensor<1xf32>, // CHECK: } // CHECK: return [[RES_66_]] : memref<16x64xui8> // CHECK: } -} \ No newline at end of file +} diff --git a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir index 9682e8cf88..b790ada624 100644 --- a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir +++ b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_canonicalize.mlir @@ -356,4 +356,5 @@ func.func @test_dynamic_quantize_linear_reduced_simd_only(%arg0: tensor<1x8xf32> // CHECK: } // CHECK: return [[RES_]], [[RES_]]_5, [[RES_]]_6 : memref<1x8xui8>, memref, memref // CHECK: } -} \ No newline at end of file +} + diff --git a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir index 9290cac6f4..ee4bf68711 100644 --- a/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir +++ b/test/mlir/conversion/onnx_to_krnl/Quantization/DynamicQuantizeLinear_with_simd_parallel_canonicalize.mlir @@ -449,4 +449,4 @@ func.func @test_dynamic_quantize_linear_reduced_simd_only(%arg0: tensor<1x8xf32> // CHECK: } // CHECK: return [[RES_]], [[RES_]]_5, [[RES_]]_6 : memref<1x8xui8>, memref, memref // CHECK: } -} \ No newline at end of file +} diff --git a/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir b/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir index c305fd1850..7a3d29f5e9 100644 --- a/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir +++ b/test/mlir/conversion/onnx_to_tosa/Tensor/Resize.mlir @@ -310,4 +310,4 @@ func.func @test_resize_linear_int_disallowed(%arg0: tensor<1x1x2x4xi32>) -> tens return %2 : tensor<1x1x4x8xi32> // CHECK-LABEL: func.func @test_resize_linear_int_disallowed // CHECK: onnx.Resize -} \ No newline at end of file +} From 0905a3ec2b6c6d47296fbc755f16d0ac7b09c21c Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Mon, 13 Oct 2025 10:25:22 -0400 Subject: [PATCH 06/20] fixing vector dialect issue Signed-off-by: Christopher Munoz --- src/Compiler/CompilerPasses.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Compiler/CompilerPasses.cpp b/src/Compiler/CompilerPasses.cpp index c975ce31f6..c8d1f64c37 100644 --- a/src/Compiler/CompilerPasses.cpp +++ b/src/Compiler/CompilerPasses.cpp @@ -275,12 +275,14 @@ void addKrnlToLLVMPasses( // pm.addNestedPass(krnl::createConvertSeqToMemrefPass()); pm.addPass(mlir::memref::createFoldMemRefAliasOpsPass()); + pm.addPass(mlir::createConvertVectorToLLVMPass()); if (profileIR) pm.addNestedPass(onnx_mlir::createInstrumentCleanupPass()); if (enableBoundCheck) pm.addPass(mlir::createGenerateRuntimeVerificationPass()); + pm.addPass(krnl::createConvertKrnlToLLVMPass(verifyInputTensors, /*useLRODATA=*/(modelSize == ModelSize::large), /*storeConstantsToFile=*/storeConstantsToFile, From d7e333e8c12b7de361a960aed505bc6854771733 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Mon, 13 Oct 2025 10:26:55 -0400 Subject: [PATCH 07/20] fixing vector dialect issue Signed-off-by: Christopher Munoz --- src/Compiler/CompilerPasses.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/CompilerPasses.cpp b/src/Compiler/CompilerPasses.cpp index c8d1f64c37..9d22334b61 100644 --- a/src/Compiler/CompilerPasses.cpp +++ b/src/Compiler/CompilerPasses.cpp @@ -282,7 +282,7 @@ void addKrnlToLLVMPasses( if (enableBoundCheck) pm.addPass(mlir::createGenerateRuntimeVerificationPass()); - + pm.addPass(krnl::createConvertKrnlToLLVMPass(verifyInputTensors, /*useLRODATA=*/(modelSize == ModelSize::large), /*storeConstantsToFile=*/storeConstantsToFile, From 34a6045a1d8fb88f2bf2b2773bc693f0b5c33147 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Mon, 13 Oct 2025 13:09:01 -0400 Subject: [PATCH 08/20] pr comments Signed-off-by: Christopher Munoz --- src/Compiler/CompilerPasses.cpp | 2 ++ src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp | 2 +- src/onnx-mlir.cpp | 2 +- test/backend-cpp/TestCategoryMapper.cpp | 2 +- test/numerical/TestConv.cpp | 2 +- test/numerical/TestElementwise.cpp | 2 +- test/numerical/TestGRU.cpp | 2 +- test/numerical/TestGemm.cpp | 2 +- test/numerical/TestLSTM.cpp | 2 +- test/numerical/TestLeakyRelu.cpp | 2 +- test/numerical/TestLoop.cpp | 2 +- test/numerical/TestMatMul2D.cpp | 2 +- test/numerical/TestMatMulBroadcast.cpp | 2 +- test/numerical/TestRNN.cpp | 2 +- test/numerical/TestScan.cpp | 2 +- test/numerical/TestSoftplus.cpp | 2 +- test/perf/PerfHelper.cpp | 3 ++- 17 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/Compiler/CompilerPasses.cpp b/src/Compiler/CompilerPasses.cpp index 9d22334b61..bd76a78f3b 100644 --- a/src/Compiler/CompilerPasses.cpp +++ b/src/Compiler/CompilerPasses.cpp @@ -275,6 +275,8 @@ void addKrnlToLLVMPasses( // pm.addNestedPass(krnl::createConvertSeqToMemrefPass()); pm.addPass(mlir::memref::createFoldMemRefAliasOpsPass()); + // This pass is required on s390x targets to ensure all vector operations + // are properly lowered to LLVM dialect. (e.g., vector.from_elements) pm.addPass(mlir::createConvertVectorToLLVMPass()); if (profileIR) diff --git a/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp b/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp index 63365d3f1f..962c3f556b 100644 --- a/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp +++ b/src/Tools/onnx-mlir-opt/onnx-mlir-opt.cpp @@ -158,7 +158,7 @@ int main(int argc, char **argv) { if (!parseCustomEnvFlagsCommandLineOption(argc, argv, &llvm::errs()) || !llvm::cl::ParseCommandLineOptions(argc, argv, getVendorName() + " - A modular optimizer driver\n", &llvm::errs(), - /*VFS=*/nullptr, customEnvFlags.c_str())) { + nullptr, customEnvFlags.c_str())) { llvm::errs() << "Failed to parse options\n"; return 1; } diff --git a/src/onnx-mlir.cpp b/src/onnx-mlir.cpp index a967ee737e..ebe3d5efad 100644 --- a/src/onnx-mlir.cpp +++ b/src/onnx-mlir.cpp @@ -40,7 +40,7 @@ int main(int argc, char *argv[]) { if (!parseCustomEnvFlagsCommandLineOption(argc, argv, &llvm::errs()) || !llvm::cl::ParseCommandLineOptions(argc, argv, getVendorName() + " - A modular optimizer driver\n", &llvm::errs(), - /*VFS=*/nullptr, customEnvFlags.c_str())) { + nullptr, customEnvFlags.c_str())) { llvm::errs() << "Failed to parse options\n"; return 1; } diff --git a/test/backend-cpp/TestCategoryMapper.cpp b/test/backend-cpp/TestCategoryMapper.cpp index b2ca9e2459..d0d4b3b89b 100644 --- a/test/backend-cpp/TestCategoryMapper.cpp +++ b/test/backend-cpp/TestCategoryMapper.cpp @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) { setCompilerOption(onnx_mlir::OptionKind::CompilerOptLevel, "3"); mlir::registerPassManagerCLOptions(); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestCategoryMapper\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestCategoryMapper\n", nullptr, nullptr, "TEST_ARGS"); onnx_mlir::initCompilerConfig(); std::cout << "Target options: \"" << onnx_mlir::getCompilerOption(onnx_mlir::OptionKind::TargetAccel) diff --git a/test/numerical/TestConv.cpp b/test/numerical/TestConv.cpp index 3a54608c18..d099178b7c 100644 --- a/test/numerical/TestConv.cpp +++ b/test/numerical/TestConv.cpp @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestConv\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestConv\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestElementwise.cpp b/test/numerical/TestElementwise.cpp index 0b1ca5cbdf..23118fbc3a 100644 --- a/test/numerical/TestElementwise.cpp +++ b/test/numerical/TestElementwise.cpp @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestElementwise\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestElementwise\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestGRU.cpp b/test/numerical/TestGRU.cpp index 35fd81b846..7858727173 100644 --- a/test/numerical/TestGRU.cpp +++ b/test/numerical/TestGRU.cpp @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestGRU\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestGRU\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestGemm.cpp b/test/numerical/TestGemm.cpp index 618e714f45..0584ef2567 100644 --- a/test/numerical/TestGemm.cpp +++ b/test/numerical/TestGemm.cpp @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestGemm\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestGemm\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestLSTM.cpp b/test/numerical/TestLSTM.cpp index 232b343470..d968f4d0a8 100644 --- a/test/numerical/TestLSTM.cpp +++ b/test/numerical/TestLSTM.cpp @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestLSTM\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestLSTM\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestLeakyRelu.cpp b/test/numerical/TestLeakyRelu.cpp index 3ec2af5105..b036839efa 100644 --- a/test/numerical/TestLeakyRelu.cpp +++ b/test/numerical/TestLeakyRelu.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestLeakyRelu\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestLeakyRelu\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/numerical/TestLoop.cpp b/test/numerical/TestLoop.cpp index 05eadb6b5c..c9b327f791 100644 --- a/test/numerical/TestLoop.cpp +++ b/test/numerical/TestLoop.cpp @@ -166,7 +166,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestLoop\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestLoop\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestMatMul2D.cpp b/test/numerical/TestMatMul2D.cpp index c4c54ec38b..9e882e9697 100644 --- a/test/numerical/TestMatMul2D.cpp +++ b/test/numerical/TestMatMul2D.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestMatMul2D\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestMatMul2D\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestMatMulBroadcast.cpp b/test/numerical/TestMatMulBroadcast.cpp index c02f2eb2d4..71e4807b99 100644 --- a/test/numerical/TestMatMulBroadcast.cpp +++ b/test/numerical/TestMatMulBroadcast.cpp @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestMatMulBroadcast\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestMatMulBroadcast\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestRNN.cpp b/test/numerical/TestRNN.cpp index efcaab1355..036ea1c2c9 100644 --- a/test/numerical/TestRNN.cpp +++ b/test/numerical/TestRNN.cpp @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestRNN\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestRNN\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestScan.cpp b/test/numerical/TestScan.cpp index 9bffda16f3..80535354b1 100644 --- a/test/numerical/TestScan.cpp +++ b/test/numerical/TestScan.cpp @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestScan\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestScan\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::cout << "Target options: \"" << getCompilerOption(OptionKind::TargetAccel) << "\"\n"; diff --git a/test/numerical/TestSoftplus.cpp b/test/numerical/TestSoftplus.cpp index 6fd5afbf07..12fa498a99 100644 --- a/test/numerical/TestSoftplus.cpp +++ b/test/numerical/TestSoftplus.cpp @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { ModelLibBuilder::setRandomNumberGeneratorSeed("TEST_SEED"); removeUnrelatedOptions({&OnnxMlirCommonOptions, &OnnxMlirOptions}); llvm::cl::ParseCommandLineOptions( - argc, argv, "TestSoftplus\n", nullptr, /*VFS=*/nullptr, "TEST_ARGS"); + argc, argv, "TestSoftplus\n", nullptr, nullptr, "TEST_ARGS"); initCompilerConfig(); std::string target = getCompilerOption(OptionKind::TargetAccel); std::cout << "Target options: \"" << target << "\"\n"; diff --git a/test/perf/PerfHelper.cpp b/test/perf/PerfHelper.cpp index c7dfcbfb11..b5749dd0c4 100644 --- a/test/perf/PerfHelper.cpp +++ b/test/perf/PerfHelper.cpp @@ -35,7 +35,8 @@ int perf_main(int argc, char **argv) { onnxMlirArgv[0] = argv[0]; onnxMlirArgv[1] = "-O3"; if (!llvm::cl::ParseCommandLineOptions(onnxMlirArgc, onnxMlirArgv, - "set options for perf-algo", nullptr, /*VFS=*/ nullptr, /*env var*/ "PERF_ARGS")) + "set options for perf-algo", nullptr, nullptr, + /*env var*/ "PERF_ARGS")) return 2; if (::benchmark::ReportUnrecognizedArguments(argc, argv)) return 1; From 1c2668a8a468973b9636ecf28c1f255cb4507066 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Wed, 15 Oct 2025 15:58:12 -0400 Subject: [PATCH 09/20] updating comment Signed-off-by: Christopher Munoz --- src/Compiler/CompilerPasses.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/CompilerPasses.cpp b/src/Compiler/CompilerPasses.cpp index bd76a78f3b..bd387869d8 100644 --- a/src/Compiler/CompilerPasses.cpp +++ b/src/Compiler/CompilerPasses.cpp @@ -276,7 +276,7 @@ void addKrnlToLLVMPasses( pm.addPass(mlir::memref::createFoldMemRefAliasOpsPass()); // This pass is required on s390x targets to ensure all vector operations - // are properly lowered to LLVM dialect. (e.g., vector.from_elements) + // are properly lowered to LLVM dialect. (e.g., vector.to_elements) pm.addPass(mlir::createConvertVectorToLLVMPass()); if (profileIR) From 28316e95178a89964c491276306a8063a1d8694b Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Fri, 17 Oct 2025 13:16:14 -0400 Subject: [PATCH 10/20] no build isolation for requirements.txt Signed-off-by: Christopher Munoz --- docker/Dockerfile.onnx-mlir | 2 +- docker/Dockerfile.onnx-mlir-dev | 2 +- requirements.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.onnx-mlir b/docker/Dockerfile.onnx-mlir index 8e831c47c6..69d97d5d65 100644 --- a/docker/Dockerfile.onnx-mlir +++ b/docker/Dockerfile.onnx-mlir @@ -28,7 +28,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ - python3 -m pip install . \ + python3 -m pip install . --no-build-isolation \ && rm -rf ${HOME}/.cache ARG NPROC=4 diff --git a/docker/Dockerfile.onnx-mlir-dev b/docker/Dockerfile.onnx-mlir-dev index a6890e8d5b..21f049c588 100644 --- a/docker/Dockerfile.onnx-mlir-dev +++ b/docker/Dockerfile.onnx-mlir-dev @@ -23,7 +23,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ - python3 -m pip install . + python3 -m pip install . --no-build-isolation ARG NPROC=4 ARG ACCEL=NNPA diff --git a/requirements.txt b/requirements.txt index b9635d21fe..9e9d6b80d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ lit~=15.0 # numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str, # and np.int which are used heavily in onnx-mlir. numpy==2.0.1 -onnx==1.17.0 protobuf==6.32.0 +onnx==1.17.0 pytest==8.3.2 pytest-xdist==3.6.1 From eecae1a2d564a8ce8f8c09363fb1bdee5d19b13d Mon Sep 17 00:00:00 2001 From: Alexandre Eichenberger Date: Wed, 15 Oct 2025 20:48:47 -0400 Subject: [PATCH 11/20] Added a bit of functionality to IsolatePass, fixed a small bug (#3307) Signed-off-by: Alexandre Eichenberger Signed-off-by: Christopher Munoz --- docs/DebuggingNumericalError.md | 5 +++- utils/IsolatePass.py | 42 +++++++++++++++++++++++---------- utils/onnx-mlir-truncate.sh | 2 +- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/docs/DebuggingNumericalError.md b/docs/DebuggingNumericalError.md index f2337e73ff..162d8d4d15 100644 --- a/docs/DebuggingNumericalError.md +++ b/docs/DebuggingNumericalError.md @@ -76,7 +76,10 @@ This script is found here `utils/onnx-mlir-print.sh`, and it is used by adding a That compiler log may typically have 10-100 passes. We have a tool to isolate a given pass. Use `utils/IsolatePass.py -m -l` to list the name of all of these passes. You can then decide to investigate the compiler output of a given pass. For example, if interested in the transformation of ONNX to Krnl dialect, you can add the `-p "convert-onnx-to-krnl"` option, where the `convert-onnx-to-krnl` is the name of the actual pass. The `-p` option just take a regex matching a pass as listed with the `-l` option. Alternatively, option `-n 34` will isolate the 34th pass as listed with the `-l` option. -Say you are interested in the pass just before or just after `convert-onnx-to-krnl`, you can use, respectively, the `-a -1` or the `-a 1` additional option. Full options are listed under the `--help` flag. +Say you are interested in the pass just before or just after `convert-onnx-to-krnl`, you can use, respectively, the `-a -1` or the `-a 1` additional option. +The `-a` option can also list a REGEX, in which case, it will print the next pass that matches that REGEX. + +Full options are listed under the `--help` flag. ## Debugging the Code Generated for an Operator. diff --git a/utils/IsolatePass.py b/utils/IsolatePass.py index 6e56579c7f..5cda041e2b 100755 --- a/utils/IsolatePass.py +++ b/utils/IsolatePass.py @@ -18,6 +18,7 @@ # global variables pass_name_to_id = {} +id_to_pass_name = [] pass_listing = [] debug = 0 # Max length of a single line. If there are very long constants, truncate them. @@ -50,9 +51,10 @@ def get_args(): parser.add_argument( "-a", "--after", - help="Print the pass NUM(th) after the pass indicated by the " - "-p or -n options. Number can be negative.", - metavar="NUM", + help="If STR is a number, N, print the pass Nth after the pass indicated by the " + "-p or -n options. Number N can be negative. Otherwise, print the next pass that " + "matches the regex STR.", + metavar="STR", ) parser.add_argument( "-l", @@ -93,8 +95,9 @@ def process_line(str, length=max_line_length): def scan_listing(filename, print_list_name): - global pass_name_to_id, pass_listing + global pass_name_to_id, id_to_pass_name, pass_listing pass_name_to_id = {} + id_to_pass_name = [] pass_listing = [] current_listing = [] @@ -112,13 +115,14 @@ def scan_listing(filename, print_list_name): # Save current listing. id = len(pass_listing) pass_listing.append("".join(current_listing)) + id_to_pass_name.append(current_name) if current_name in pass_name_to_id: pass_name_to_id[current_name].append(id) else: pass_name_to_id[current_name] = [id] # Print info if requested. if print_list_name: - print(f"{id}: {pass_name}") + print(f"{id}: {current_name}") # Save new current name current_name = pass_name current_listing = [] @@ -164,23 +168,37 @@ def locate_pass(name, num): return ids[0] -def print_pass(filename, id, num, name=None): +def print_pass(filename, id, after, pass_name=None): + global pass_name_to_id, id_to_pass_name, pass_listing n = 0 - if num: - n = int(num) + if after: + if re.fullmatch(r"[+-]?\d+", after) is not None: + # After is a number. + n = int(after) + else: + # After is a pass name, locate it. + regex = re.compile(after) + n = 1 + while True: + if id + n >= len(id_to_pass_name): + usage(f"Did not find pass {after} after pass {pass_name}") + if regex.search(id_to_pass_name[id + n]): + # Found it + break + n += 1 id += n if id < 0 or id >= len(pass_listing): print(f"Out of bound id {id}, should be in [0..{len(pass_listing)}) range.") exit(1) message = f"// Printing pass with id {id}" - if name: + if pass_name: if n != 0: if n > 0: - message += f", {n}(th) pass(s) after {name}" + message += f", {n}(th) pass(s) after {pass_name}" else: - message += f", {-n}(th) pass(s) before {name}" + message += f", {-n}(th) pass(s) before {pass_name}" else: - message += f" with name {name}" + message += f" with name {pass_name}" message += f' from file "{filename}".' print(f"{message}\n\n", pass_listing[id], f"\n\n{message}") diff --git a/utils/onnx-mlir-truncate.sh b/utils/onnx-mlir-truncate.sh index 25e35c8b7b..e9678a7b22 100755 --- a/utils/onnx-mlir-truncate.sh +++ b/utils/onnx-mlir-truncate.sh @@ -22,7 +22,7 @@ # Unterminated strings then cause issues with the VSCode mlir code prettifier. maxLineLength=800 -echo "Command:" | tee ${@: -1} +echo "Command on `date`" | tee ${@: -1} echo "onnx-mlir ${@:1:$#-1}" | tee -a ${@: -1} echo "" | tee -a ${@: -1} From b136de450c142ffaf28a4e1d04a5eb1de12c4330 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Fri, 17 Oct 2025 13:34:25 -0400 Subject: [PATCH 12/20] upgrading setuptools Signed-off-by: Christopher Munoz --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 9e9d6b80d5..03b5aa358e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ lit~=15.0 # numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str, # and np.int which are used heavily in onnx-mlir. +setuptools==80.9.0 numpy==2.0.1 protobuf==6.32.0 onnx==1.17.0 From 6b5af4bbaeb47de36fafb18d8abf93d3e9bee7b6 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Fri, 17 Oct 2025 13:46:42 -0400 Subject: [PATCH 13/20] upgrading setuptools Signed-off-by: Christopher Munoz --- docker/Dockerfile.onnx-mlir | 1 + docker/Dockerfile.onnx-mlir-dev | 1 + requirements.txt | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.onnx-mlir b/docker/Dockerfile.onnx-mlir index 69d97d5d65..1e31f94f5e 100644 --- a/docker/Dockerfile.onnx-mlir +++ b/docker/Dockerfile.onnx-mlir @@ -27,6 +27,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_check_op\ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ + && python3 -m pip install --upgrade setuptools==80.9.0 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation \ && rm -rf ${HOME}/.cache diff --git a/docker/Dockerfile.onnx-mlir-dev b/docker/Dockerfile.onnx-mlir-dev index 21f049c588..c9a8752f46 100644 --- a/docker/Dockerfile.onnx-mlir-dev +++ b/docker/Dockerfile.onnx-mlir-dev @@ -22,6 +22,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_check_op\ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ + && python3 -m pip install --upgrade setuptools==80.9.0 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation diff --git a/requirements.txt b/requirements.txt index 03b5aa358e..7d78c5bef7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ -lit~=15.0 +../requirements.txtlit~=15.0 # numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str, # and np.int which are used heavily in onnx-mlir. -setuptools==80.9.0 numpy==2.0.1 protobuf==6.32.0 onnx==1.17.0 From 4466616a35860beef8c44de36f0336e63f627bd6 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Fri, 17 Oct 2025 13:54:00 -0400 Subject: [PATCH 14/20] upgrading setuptools Signed-off-by: Christopher Munoz --- docker/Dockerfile.onnx-mlir | 2 +- docker/Dockerfile.onnx-mlir-dev | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile.onnx-mlir b/docker/Dockerfile.onnx-mlir index 1e31f94f5e..d4cd3c634e 100644 --- a/docker/Dockerfile.onnx-mlir +++ b/docker/Dockerfile.onnx-mlir @@ -27,7 +27,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_check_op\ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ - && python3 -m pip install --upgrade setuptools==80.9.0 \ + && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation \ && rm -rf ${HOME}/.cache diff --git a/docker/Dockerfile.onnx-mlir-dev b/docker/Dockerfile.onnx-mlir-dev index c9a8752f46..c2182d95f4 100644 --- a/docker/Dockerfile.onnx-mlir-dev +++ b/docker/Dockerfile.onnx-mlir-dev @@ -22,7 +22,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_check_op\ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ - && python3 -m pip install --upgrade setuptools==80.9.0 \ + && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation From e5551b01c331a5f44e459e1dc460c8f6e8ee4c36 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Fri, 17 Oct 2025 14:16:37 -0400 Subject: [PATCH 15/20] adding comments Signed-off-by: Christopher Munoz --- docker/Dockerfile.onnx-mlir | 2 ++ docker/Dockerfile.onnx-mlir-dev | 2 ++ requirements.txt | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile.onnx-mlir b/docker/Dockerfile.onnx-mlir index d4cd3c634e..da4b6aed08 100644 --- a/docker/Dockerfile.onnx-mlir +++ b/docker/Dockerfile.onnx-mlir @@ -27,6 +27,8 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_check_op\ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ + # Required for pip install with `--no-build-isolation` flag. + # setuptools >= 70.x creates conflicts with packaging versions && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation \ diff --git a/docker/Dockerfile.onnx-mlir-dev b/docker/Dockerfile.onnx-mlir-dev index c2182d95f4..ae43f61bab 100644 --- a/docker/Dockerfile.onnx-mlir-dev +++ b/docker/Dockerfile.onnx-mlir-dev @@ -22,6 +22,8 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_check_op\ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ + # Required for pip install with `--no-build-isolation` flag. + # setuptools >= 70.x creates conflicts with packaging versions && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation diff --git a/requirements.txt b/requirements.txt index 7d78c5bef7..9e9d6b80d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -../requirements.txtlit~=15.0 +lit~=15.0 # numpy 1.24 deprecates np.object, np.bool, np.float, np.complex, np.str, # and np.int which are used heavily in onnx-mlir. numpy==2.0.1 From a8a8f494dbea50907a0395cb11d784b43b36f748 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Fri, 17 Oct 2025 15:06:56 -0400 Subject: [PATCH 16/20] fixing mlir test Signed-off-by: Christopher Munoz --- docker/Dockerfile.onnx-mlir | 2 +- docker/Dockerfile.onnx-mlir-dev | 2 +- .../zhigh-constant-propagation-be/quantizedconstprop.mlir | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.onnx-mlir b/docker/Dockerfile.onnx-mlir index da4b6aed08..927a3414ab 100644 --- a/docker/Dockerfile.onnx-mlir +++ b/docker/Dockerfile.onnx-mlir @@ -28,7 +28,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ # Required for pip install with `--no-build-isolation` flag. - # setuptools >= 70.x creates conflicts with packaging versions + # setuptools >= 70.x creates conflicts with packaging versions. && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation \ diff --git a/docker/Dockerfile.onnx-mlir-dev b/docker/Dockerfile.onnx-mlir-dev index ae43f61bab..411624626e 100644 --- a/docker/Dockerfile.onnx-mlir-dev +++ b/docker/Dockerfile.onnx-mlir-dev @@ -23,7 +23,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ # Required for pip install with `--no-build-isolation` flag. - # setuptools >= 70.x creates conflicts with packaging versions + # setuptools >= 70.x creates conflicts with packaging versions. && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation diff --git a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir index 3125c749c7..665dff65aa 100644 --- a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir +++ b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir @@ -26,7 +26,7 @@ func.func @quantized_weight_int8() -> tensor<7x65xi8, #zhigh.layout<{dataLayout // CHECK: } // CHECK: dialect_resources: { // CHECK: builtin: { -// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F4040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F404000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001D721000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" // CHECK: } // CHECK: } From 7dd9cb9cef23cd7a825a1fb3c5bcbd8872f271f9 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Mon, 20 Oct 2025 12:23:50 -0400 Subject: [PATCH 17/20] fixing lit Signed-off-by: Christopher Munoz --- docker/Dockerfile.onnx-mlir | 2 +- docker/Dockerfile.onnx-mlir-dev | 2 +- .../zhigh-constant-propagation-be/quantizedconstprop.mlir | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile.onnx-mlir b/docker/Dockerfile.onnx-mlir index 927a3414ab..3c4d2c4d58 100644 --- a/docker/Dockerfile.onnx-mlir +++ b/docker/Dockerfile.onnx-mlir @@ -28,7 +28,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ # Required for pip install with `--no-build-isolation` flag. - # setuptools >= 70.x creates conflicts with packaging versions. + # setuptools >= 70.x creates conflicts with pip packaging versions. && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation \ diff --git a/docker/Dockerfile.onnx-mlir-dev b/docker/Dockerfile.onnx-mlir-dev index 411624626e..feecf7f92c 100644 --- a/docker/Dockerfile.onnx-mlir-dev +++ b/docker/Dockerfile.onnx-mlir-dev @@ -23,7 +23,7 @@ RUN ONNX_ROOT=${WORK_DIR}/onnx-mlir/third_party/onnx \ absl::log_internal_message\ absl::log_internal_nullguard' CMakeLists.txt \ # Required for pip install with `--no-build-isolation` flag. - # setuptools >= 70.x creates conflicts with packaging versions. + # setuptools >= 70.x creates conflicts with pip packaging versions. && python3 -m pip install --upgrade setuptools==68.2.2 \ && CC=clang CXX=clang++ CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib" \ python3 -m pip install . --no-build-isolation diff --git a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir index 665dff65aa..ad03aedb03 100644 --- a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir +++ b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir @@ -18,7 +18,8 @@ func.func @quantized_weight_int8() -> tensor<7x65xi8, #zhigh.layout<{dataLayout ]> : tensor<7x65xi8>} : () -> tensor<7x65xi8> %res:3 = "zhigh.QuantizedStick"(%inp, %3, %0) {layout = "2D", quantized_type = "WEIGHTS"} : (tensor<7x65xi8>, tensor, tensor) -> (tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>>, tensor, tensor) return %res#0 : tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> -} + +// mlir2FileCheck.py // CHECK-LABEL: func.func @quantized_weight_int8 // CHECK-SAME: () -> tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> { // CHECK: [[VAR_0_:%.+]] = "zhigh.StickifiedConstant"() {alignment = 4096 : i64, value = dense_resource : tensor<8192xi8>} : () -> tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> @@ -26,7 +27,7 @@ func.func @quantized_weight_int8() -> tensor<7x65xi8, #zhigh.layout<{dataLayout // CHECK: } // CHECK: dialect_resources: { // CHECK: builtin: { -// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F404000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001D721000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F4040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" // CHECK: } // CHECK: } - +} From 55b194ed512944fb4312b794cb7a150e64d46012 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Tue, 21 Oct 2025 10:05:24 -0400 Subject: [PATCH 18/20] fixing mlir test Signed-off-by: Christopher Munoz --- .../zhigh-constant-propagation-be/quantizedconstprop.mlir | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir index ad03aedb03..b399b9436f 100644 --- a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir +++ b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir @@ -25,9 +25,11 @@ func.func @quantized_weight_int8() -> tensor<7x65xi8, #zhigh.layout<{dataLayout // CHECK: [[VAR_0_:%.+]] = "zhigh.StickifiedConstant"() {alignment = 4096 : i64, value = dense_resource : tensor<8192xi8>} : () -> tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> // CHECK: return [[VAR_0_]] : tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> // CHECK: } +// CHECK: {-# // CHECK: dialect_resources: { // CHECK: builtin: { // CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F4040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" // CHECK: } // CHECK: } +// CHECK: #-} } From 4c63e9e60bd0d16f42c04e7e076547b20a2d3af2 Mon Sep 17 00:00:00 2001 From: Christopher Munoz Date: Tue, 21 Oct 2025 16:55:51 -0400 Subject: [PATCH 19/20] fixing lit test Signed-off-by: Christopher Munoz --- .../quantizedconstprop.mlir | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir index b399b9436f..932c4f08a8 100644 --- a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir +++ b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir @@ -18,18 +18,14 @@ func.func @quantized_weight_int8() -> tensor<7x65xi8, #zhigh.layout<{dataLayout ]> : tensor<7x65xi8>} : () -> tensor<7x65xi8> %res:3 = "zhigh.QuantizedStick"(%inp, %3, %0) {layout = "2D", quantized_type = "WEIGHTS"} : (tensor<7x65xi8>, tensor, tensor) -> (tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>>, tensor, tensor) return %res#0 : tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> - -// mlir2FileCheck.py +} // CHECK-LABEL: func.func @quantized_weight_int8 // CHECK-SAME: () -> tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> { // CHECK: [[VAR_0_:%.+]] = "zhigh.StickifiedConstant"() {alignment = 4096 : i64, value = dense_resource : tensor<8192xi8>} : () -> tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> // CHECK: return [[VAR_0_]] : tensor<7x65xi8, #zhigh.layout<{dataLayout = "2D", quantizedType = "WEIGHTS"}>> // CHECK: } -// CHECK: {-# // CHECK: dialect_resources: { // CHECK: builtin: { -// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F4040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F404{{[0-9A-F]+}}" // CHECK: } -// CHECK: } -// CHECK: #-} -} +// CHECK: } \ No newline at end of file From cb97552fedffddd00e5f44ae1ac02d0488da5868 Mon Sep 17 00:00:00 2001 From: "Tung D. Le" Date: Tue, 21 Oct 2025 21:21:26 -0400 Subject: [PATCH 20/20] memset the quantized stick buffer Signed-off-by: Tung D. Le --- .../NNPA/Transform/ZHigh/ZHighConstPropagation.cpp | 1 + .../zhigh-constant-propagation-be/quantizedconstprop.mlir | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Accelerators/NNPA/Transform/ZHigh/ZHighConstPropagation.cpp b/src/Accelerators/NNPA/Transform/ZHigh/ZHighConstPropagation.cpp index 723439b0df..aed9a15371 100644 --- a/src/Accelerators/NNPA/Transform/ZHigh/ZHighConstPropagation.cpp +++ b/src/Accelerators/NNPA/Transform/ZHigh/ZHighConstPropagation.cpp @@ -227,6 +227,7 @@ ZHighStickifiedConstantOp createQuantizedConstantForStick( init_ztensor(&pre_tfrmd_desc, &tfrmd_desc, &ztensor); status = allochelper_ztensor_alloc(&ztensor); assert(status == ZDNN_OK); + memset(ztensor.buffer, 0, ztensor.buffer_size); status = quantized_stickify(&ztensor, rawData.data()); assert(status == ZDNN_OK); // Emit a constant global in ZHigh dialect. diff --git a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir index 932c4f08a8..3125c749c7 100644 --- a/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir +++ b/test/mlir/accelerators/nnpa/transform/zhigh-constant-propagation-be/quantizedconstprop.mlir @@ -26,6 +26,7 @@ func.func @quantized_weight_int8() -> tensor<7x65xi8, #zhigh.layout<{dataLayout // CHECK: } // CHECK: dialect_resources: { // CHECK: builtin: { -// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F404{{[0-9A-F]+}}" +// CHECK: zhigh: "0x0100000001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C001FF02FE03FD04FC05FB06FA07F908F809F70AF60BF50CF40DF30EF20FF110F011EF12EE13ED14EC15EB16EA17E918E819E71AE61BE51CE41DE31EE21FE120E021DF22DE23DD24DC25DB26DA27D928D829D72AD62BD52CD42DD32ED22FD130D031CF32CE33CD34CC35CB36CA37C938C839C73AC63BC53CC43DC33EC23FC140C00101020203030404050506060707080809090A0A0B0B0C0C0D0D0E0E0F0F10101111121213131414151516161717181819191A1A1B1B1C1C1D1D1E1E1F1F20202121222223232424252526262727282829292A2A2B2B2C2C2D2D2E2E2F2F30303131323233333434353536363737383839393A3A3B3B3C3C3D3D3E3E3F3F4040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041BF00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" // CHECK: } -// CHECK: } \ No newline at end of file +// CHECK: } +