From 4f8ab894a5321ba7c1d2150fbda09d8e8af72166 Mon Sep 17 00:00:00 2001 From: Luke Hutton Date: Tue, 28 Oct 2025 17:14:51 +0000 Subject: [PATCH] [mlir][tosa] Remove EXT_MXFP support for cast This was removed in the specification by: https://github.com/arm/tosa-specification/pull/11 Change-Id: Idaf70bc84fddc2e7a3845e8a2ac0e6e744e453ab --- .../Dialect/Tosa/IR/TosaComplianceData.h.inc | 10 +--------- mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td | 2 +- mlir/test/Dialect/Tosa/availability.mlir | 2 +- mlir/test/Dialect/Tosa/invalid_extension.mlir | 7 ------- .../Tosa/tosa-validation-version-1p1-valid.mlir | 16 ---------------- 5 files changed, 3 insertions(+), 34 deletions(-) diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc b/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc index c774d870a8c45..26c6237b6f7af 100644 --- a/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc +++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc @@ -857,15 +857,7 @@ extensionComplianceMap = { {{{fp8e5m2T, fp16T}, SpecificationVersion::V_1_0}, {{fp8e5m2T, fp32T}, SpecificationVersion::V_1_0}, {{fp16T, fp8e5m2T}, SpecificationVersion::V_1_0}, - {{fp32T, fp8e5m2T}, SpecificationVersion::V_1_0}}}, - {{Extension::bf16, Extension::mxfp}, - {{{fp4e2m1T, bf16T}, SpecificationVersion::V_1_1_DRAFT}, - {{fp6e3m2T, bf16T}, SpecificationVersion::V_1_1_DRAFT}, - {{fp6e2m3T, bf16T}, SpecificationVersion::V_1_1_DRAFT}, - {{bf16T, fp4e2m1T}, SpecificationVersion::V_1_1_DRAFT}, - {{bf16T, fp6e3m2T}, SpecificationVersion::V_1_1_DRAFT}, - {{bf16T, fp6e2m3T}, SpecificationVersion::V_1_1_DRAFT}}, - allOf}}}, + {{fp32T, fp8e5m2T}, SpecificationVersion::V_1_0}}}}}, {"tosa.cast_from_block_scaled", {{{Extension::bf16, Extension::mxfp}, {{{fp4e2m1T, fp8ue8m0T, bf16T}, SpecificationVersion::V_1_1_DRAFT}, diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td index 467dba3232f2b..063e5968ecd92 100644 --- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td +++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td @@ -2463,7 +2463,7 @@ def Tosa_CastOp: Tosa_Op<"cast", [Pure, SameOperandsAndResultShape, list availability = [ Profile<[Tosa_PRO_INT, Tosa_PRO_FP]>, - Extension<[Tosa_EXT_FP8E4M3, Tosa_EXT_FP8E5M2, Tosa_EXT_BF16, Tosa_EXT_MXFP, Tosa_EXT_INT64]>, + Extension<[Tosa_EXT_FP8E4M3, Tosa_EXT_FP8E5M2, Tosa_EXT_BF16, Tosa_EXT_INT64]>, ]; let assemblyFormat = "operands attr-dict `:` functional-type(operands, results)"; diff --git a/mlir/test/Dialect/Tosa/availability.mlir b/mlir/test/Dialect/Tosa/availability.mlir index a05f42395778a..6ef8b3e6133be 100644 --- a/mlir/test/Dialect/Tosa/availability.mlir +++ b/mlir/test/Dialect/Tosa/availability.mlir @@ -606,7 +606,7 @@ func.func @test_resize(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x64x64x8xf32> { // CHECK-LABEL: cast func.func @test_cast1(%arg0: tensor<13x21x3xi32>) -> tensor<13x21x3xf32> { // CHECK: profiles: [ [pro_int, pro_fp] ] - // CHECK: extensions: [ [fp8e4m3, fp8e5m2, bf16, mxfp, int64] ] + // CHECK: extensions: [ [fp8e4m3, fp8e5m2, bf16, int64] ] %0 = tosa.cast %arg0 : (tensor<13x21x3xi32>) -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> } diff --git a/mlir/test/Dialect/Tosa/invalid_extension.mlir b/mlir/test/Dialect/Tosa/invalid_extension.mlir index 68a95787b81c7..177192ba5440d 100644 --- a/mlir/test/Dialect/Tosa/invalid_extension.mlir +++ b/mlir/test/Dialect/Tosa/invalid_extension.mlir @@ -562,13 +562,6 @@ func.func @test_const_fp6e3m2(%arg0 : index) -> tensor<4xf6E3M2FN> { return %0 : tensor<4xf6E3M2FN> } -// ----- -func.func @test_cast_f4e2m1(%arg0: tensor<13x21x3xf4E2M1FN>) -> tensor<13x21x3xbf16> { - // expected-error@+1 {{'tosa.cast' op illegal: requires all of [bf16, mxfp] but not enabled in target}} - %0 = tosa.cast %arg0 : (tensor<13x21x3xf4E2M1FN>) -> tensor<13x21x3xbf16> - return %0 : tensor<13x21x3xbf16> -} - // ----- func.func @test_cast_from_block_scaled_static(%arg0: tensor<4x32xf8E5M2>, %arg1: tensor<4x1xf8E8M0FNU>) -> tensor<4x32xf32> { diff --git a/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-valid.mlir b/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-valid.mlir index 9bd7aa8f0783e..304161b1eec41 100644 --- a/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-valid.mlir +++ b/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-valid.mlir @@ -53,14 +53,6 @@ func.func @test_const_fp6e3m2() -> tensor<4xf6E3M2FN> { // ----- -// CHECK-LABEL: test_cast_f4e2m1 -func.func @test_cast_f4e2m1(%arg0: tensor<13x21x3xf4E2M1FN>) -> tensor<13x21x3xbf16> { - %0 = tosa.cast %arg0 : (tensor<13x21x3xf4E2M1FN>) -> tensor<13x21x3xbf16> - return %0 : tensor<13x21x3xbf16> -} - -// ----- - // CHECK-LABEL: test_cast_from_block_scaled_fp8e5m2_fp32 func.func @test_cast_from_block_scaled_fp8e5m2_fp32(%arg0: tensor<4x32xf8E5M2>, %arg1: tensor<4x1xf8E8M0FNU>) -> tensor<4x32xf32> { %0 = tosa.cast_from_block_scaled %arg0, %arg1 {block_size = #tosa.block_size : i32} : (tensor<4x32xf8E5M2>, tensor<4x1xf8E8M0FNU>) -> tensor<4x32xf32> @@ -109,14 +101,6 @@ func.func @test_const_mxint8() -> tensor<2x!tosa.mxint8> { // ----- -// CHECK-LABEL: test_cast_f4e2m1 -func.func @test_cast_f4e2m1(%arg0: tensor<13x21x3xf4E2M1FN>) -> tensor<13x21x3xbf16> { - %0 = tosa.cast %arg0 : (tensor<13x21x3xf4E2M1FN>) -> tensor<13x21x3xbf16> - return %0 : tensor<13x21x3xbf16> -} - -// ----- - // CHECK-LABEL: test_matmul_t_block_scaled_mxint8 func.func @test_matmul_t_block_scaled_mxint8(%arg0: tensor<4x8x32x!tosa.mxint8>, %arg1: tensor<4x8x1xf8E8M0FNU>, %arg2: tensor<4x16x32x!tosa.mxint8>, %arg3: tensor<4x16x1xf8E8M0FNU>) -> tensor<4x8x16xf32> { %0 = tosa.matmul_t_block_scaled %arg0, %arg1, %arg2, %arg3 {block_size = #tosa.block_size} : (tensor<4x8x32x!tosa.mxint8>, tensor<4x8x1xf8E8M0FNU>, tensor<4x16x32x!tosa.mxint8>, tensor<4x16x1xf8E8M0FNU>) -> tensor<4x8x16xf32>