[Mlir-commits] [mlir] [mlir][tosa] Adding integer data layout operation support to PRO-FP (PR #229777)
Luke Hutton
llvmlistbot at llvm.org
Thu Oct 8 01:52:58 PDT 2026
https://github.com/lhutton1 updated https://github.com/llvm/llvm-project/pull/229777
>From 3e077c5a6c9aec407b1a19e1c291b07dd1b308e3 Mon Sep 17 00:00:00 2001
From: Rogid Rajkumar <Rogid.Rajkumar at arm.com>
Date: Wed, 7 Oct 2026 13:35:13 +0100
Subject: [PATCH] [mlir][tosa] Adding integer data layout operation support to
PRO-FP
---
.../Dialect/Tosa/IR/TosaComplianceData.h.inc | 35 ++++++++---
.../Tosa/profile_pro_int_unsupported.mlir | 6 --
...a-validation-version-1p1-pro-fp-valid.mlir | 62 +++++++++++++++++++
3 files changed, 90 insertions(+), 13 deletions(-)
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc b/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
index e3789986735fa..eae0457129a3f 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
@@ -345,7 +345,10 @@ profileComplianceMap = {
{{i32T, i32T}, SpecificationVersion::V_1_0}}},
{{Profile::pro_fp},
{{{fp16T, fp16T}, SpecificationVersion::V_1_0},
- {{fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+ {{fp32T, fp32T}, SpecificationVersion::V_1_0},
+ {{i8T, i8T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i16T, i16T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i32T, i32T}, SpecificationVersion::V_1_1_DRAFT}}}}},
{"tosa.pad",
{{{Profile::pro_int, Profile::pro_fp},
{{{boolT, boolT, boolT}, SpecificationVersion::V_1_0}},
@@ -356,7 +359,10 @@ profileComplianceMap = {
{{i32T, i32T, i32T}, SpecificationVersion::V_1_0}}},
{{Profile::pro_fp},
{{{fp16T, fp16T, fp16T}, SpecificationVersion::V_1_0},
- {{fp32T, fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+ {{fp32T, fp32T, fp32T}, SpecificationVersion::V_1_0},
+ {{i8T, i8T, i8T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i16T, i16T, i16T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i32T, i32T, i32T}, SpecificationVersion::V_1_1_DRAFT}}}}},
{"tosa.reshape",
{{{Profile::pro_int, Profile::pro_fp},
{{{boolT, boolT}, SpecificationVersion::V_1_0}},
@@ -367,7 +373,10 @@ profileComplianceMap = {
{{i32T, i32T}, SpecificationVersion::V_1_0}}},
{{Profile::pro_fp},
{{{fp16T, fp16T}, SpecificationVersion::V_1_0},
- {{fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+ {{fp32T, fp32T}, SpecificationVersion::V_1_0},
+ {{i8T, i8T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i16T, i16T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i32T, i32T}, SpecificationVersion::V_1_1_DRAFT}}}}},
{"tosa.reverse",
{{{Profile::pro_int, Profile::pro_fp},
{{{boolT, boolT}, SpecificationVersion::V_1_0}},
@@ -378,7 +387,10 @@ profileComplianceMap = {
{{i32T, i32T}, SpecificationVersion::V_1_0}}},
{{Profile::pro_fp},
{{{fp16T, fp16T}, SpecificationVersion::V_1_0},
- {{fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+ {{fp32T, fp32T}, SpecificationVersion::V_1_0},
+ {{i8T, i8T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i16T, i16T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i32T, i32T}, SpecificationVersion::V_1_1_DRAFT}}}}},
{"tosa.slice",
{{{Profile::pro_int, Profile::pro_fp},
{{{boolT, boolT}, SpecificationVersion::V_1_0}},
@@ -389,7 +401,10 @@ profileComplianceMap = {
{{i32T, i32T}, SpecificationVersion::V_1_0}}},
{{Profile::pro_fp},
{{{fp16T, fp16T}, SpecificationVersion::V_1_0},
- {{fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+ {{fp32T, fp32T}, SpecificationVersion::V_1_0},
+ {{i8T, i8T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i16T, i16T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i32T, i32T}, SpecificationVersion::V_1_1_DRAFT}}}}},
{"tosa.tile",
{{{Profile::pro_int, Profile::pro_fp},
{{{boolT, boolT}, SpecificationVersion::V_1_0}},
@@ -400,7 +415,10 @@ profileComplianceMap = {
{{i32T, i32T}, SpecificationVersion::V_1_0}}},
{{Profile::pro_fp},
{{{fp16T, fp16T}, SpecificationVersion::V_1_0},
- {{fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+ {{fp32T, fp32T}, SpecificationVersion::V_1_0},
+ {{i8T, i8T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i16T, i16T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i32T, i32T}, SpecificationVersion::V_1_1_DRAFT}}}}},
{"tosa.transpose",
{{{Profile::pro_int, Profile::pro_fp},
{{{boolT, boolT}, SpecificationVersion::V_1_0}},
@@ -411,7 +429,10 @@ profileComplianceMap = {
{{i32T, i32T}, SpecificationVersion::V_1_0}}},
{{Profile::pro_fp},
{{{fp16T, fp16T}, SpecificationVersion::V_1_0},
- {{fp32T, fp32T}, SpecificationVersion::V_1_0}}}}},
+ {{fp32T, fp32T}, SpecificationVersion::V_1_0},
+ {{i8T, i8T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i16T, i16T}, SpecificationVersion::V_1_1_DRAFT},
+ {{i32T, i32T}, SpecificationVersion::V_1_1_DRAFT}}}}},
{"tosa.gather",
{{{Profile::pro_int},
{{{i8T, i32T, i8T}, SpecificationVersion::V_1_0},
diff --git a/mlir/test/Dialect/Tosa/profile_pro_int_unsupported.mlir b/mlir/test/Dialect/Tosa/profile_pro_int_unsupported.mlir
index ee6ecb81ec623..fb6ac647f2386 100644
--- a/mlir/test/Dialect/Tosa/profile_pro_int_unsupported.mlir
+++ b/mlir/test/Dialect/Tosa/profile_pro_int_unsupported.mlir
@@ -201,7 +201,6 @@ func.func @test_reduce_sum(%arg0: tensor<13x21x3xi32>) -> tensor<1x21x3xi32> {
func.func @test_pad(%arg0: tensor<13x21x3xi8>) -> tensor<13x21x3xi8> {
%padding = tosa.const_shape values(dense<0> : tensor<6xindex>) : () -> !tosa.shape<6>
%pad_const = "tosa.const"() <{values = dense<1> : tensor<1xi8>}> : () -> tensor<1xi8>
- // expected-error at +1 {{'tosa.pad' op illegal: requires any of [pro_int] profiles/extensions to be specified in the target environment}}
%0 = tosa.pad %arg0, %padding, %pad_const : (tensor<13x21x3xi8>, !tosa.shape<6>, tensor<1xi8>) -> tensor<13x21x3xi8>
return %0 : tensor<13x21x3xi8>
}
@@ -209,14 +208,12 @@ func.func @test_pad(%arg0: tensor<13x21x3xi8>) -> tensor<13x21x3xi8> {
// -----
func.func @test_reshape(%arg0: tensor<13x21x3xi8>) -> tensor<1x819xi8> {
%1 = tosa.const_shape values(dense<[1, 819]> : tensor<2xindex>) : () -> !tosa.shape<2>
- // expected-error at +1 {{'tosa.reshape' op illegal: requires any of [pro_int] profiles/extensions to be specified in the target environment}}
%0 = tosa.reshape %arg0, %1 : (tensor<13x21x3xi8>, !tosa.shape<2>) -> tensor<1x819xi8>
return %0 : tensor<1x819xi8>
}
// -----
func.func @test_reverse(%arg0: tensor<13x21x3xi8>) -> tensor<13x21x3xi8> {
- // expected-error at +1 {{'tosa.reverse' op illegal: requires any of [pro_int] profiles/extensions to be specified in the target environment}}
%0 = tosa.reverse %arg0 axis(0) : (tensor<13x21x3xi8>) -> tensor<13x21x3xi8>
return %0 : tensor<13x21x3xi8>
}
@@ -225,7 +222,6 @@ func.func @test_reverse(%arg0: tensor<13x21x3xi8>) -> tensor<13x21x3xi8> {
func.func @test_slice(%arg0: tensor<13x21x3xi8>) -> tensor<4x11x1xi8> {
%size = tosa.const_shape values(dense<[4, 11, 1]> : tensor<3xindex>) : () -> !tosa.shape<3>
%start = tosa.const_shape values(dense<[6, 8, 0]> : tensor<3xindex>) : () -> !tosa.shape<3>
- // expected-error at +1 {{'tosa.slice' op illegal: requires any of [pro_int] profiles/extensions to be specified in the target environment}}
%2 = tosa.slice %arg0, %start, %size : (tensor<13x21x3xi8>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<4x11x1xi8>
return %2 : tensor<4x11x1xi8>
}
@@ -233,14 +229,12 @@ func.func @test_slice(%arg0: tensor<13x21x3xi8>) -> tensor<4x11x1xi8> {
// -----
func.func @test_tile(%arg0: tensor<13x21x3xi8>) -> tensor<39x21x6xi8> {
%cst = tosa.const_shape values(dense<[3, 1, 2]> : tensor<3xindex>) : () -> !tosa.shape<3>
- // expected-error at +1 {{'tosa.tile' op illegal: requires any of [pro_int] profiles/extensions to be specified in the target environment}}
%0 = tosa.tile %arg0, %cst: (tensor<13x21x3xi8>, !tosa.shape<3>) -> tensor<39x21x6xi8>
return %0 : tensor<39x21x6xi8>
}
// -----
func.func @test_transpose(%arg0: tensor<13x21x3xi8>, %arg1: tensor<3xi32>) -> tensor<3x13x21xi8> {
- // expected-error at +1 {{'tosa.transpose' op illegal: requires any of [pro_int] profiles/extensions to be specified in the target environment}}
%1 = tosa.transpose %arg0 perms([2, 0, 1]) : (tensor<13x21x3xi8>) -> tensor<3x13x21xi8>
return %1 : tensor<3x13x21xi8>
}
diff --git a/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-pro-fp-valid.mlir b/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-pro-fp-valid.mlir
index ad53f94c2524d..467ea4bed436b 100644
--- a/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-pro-fp-valid.mlir
+++ b/mlir/test/Dialect/Tosa/tosa-validation-version-1p1-pro-fp-valid.mlir
@@ -31,3 +31,65 @@ func.func @test_row_gather_block_scaled_i8_i32(%input: tensor<13x27x3xi8>, %indi
%gather = tosa.row_gather_block_scaled %input, %indices, %row_count block_size<BLOCK_SIZE_1> : (tensor<13x27x3xi8>, tensor<13x26xi32>, tensor<1xi32>) -> (tensor<13x52x3xi8>)
return %gather : tensor<13x52x3xi8>
}
+
+// -----
+
+// CHECK-LABEL: test_concat_i8
+func.func @test_concat_i8(%arg0: tensor<13x21x3xi8>, %arg1: tensor<13x21x3xi8>) -> tensor<26x21x3xi8> {
+ %0 = tosa.concat %arg0, %arg1 axis(0) : (tensor<13x21x3xi8>, tensor<13x21x3xi8>) -> tensor<26x21x3xi8>
+ return %0 : tensor<26x21x3xi8>
+}
+
+// -----
+
+// CHECK-LABEL: test_pad_i16
+func.func @test_pad_i16(%arg0: tensor<13x21x3xi16>) -> tensor<13x21x3xi16> {
+ %0 = "tosa.const"() <{values = dense<3> : tensor<1xi16>}> : () -> tensor<1xi16>
+ %padding = tosa.const_shape values(dense<0> : tensor<6xindex>) : () -> !tosa.shape<6>
+ %1 = tosa.pad %arg0, %padding, %0 : (tensor<13x21x3xi16>, !tosa.shape<6>, tensor<1xi16>) -> tensor<13x21x3xi16>
+ return %1 : tensor<13x21x3xi16>
+}
+
+// -----
+
+// CHECK-LABEL: test_reshape_i32
+func.func @test_reshape_i32(%arg0: tensor<13x21x3xi32>) -> tensor<1x819xi32> {
+ %1 = tosa.const_shape values(dense<[1, 819]> : tensor<2xindex>) : () -> !tosa.shape<2>
+ %0 = tosa.reshape %arg0, %1 : (tensor<13x21x3xi32>, !tosa.shape<2>) -> tensor<1x819xi32>
+ return %0 : tensor<1x819xi32>
+}
+
+// -----
+
+// CHECK-LABEL: test_reverse_i8
+func.func @test_reverse_i8(%arg0: tensor<13x21x3xi8>) -> tensor<13x21x3xi8> {
+ %0 = tosa.reverse %arg0 axis(0) : (tensor<13x21x3xi8>) -> tensor<13x21x3xi8>
+ return %0 : tensor<13x21x3xi8>
+}
+
+// -----
+
+// CHECK-LABEL: test_slice_i16
+func.func @test_slice_i16(%arg0: tensor<13x21x3xi16>) -> tensor<4x11x1xi16> {
+ %size = tosa.const_shape values(dense<[4, 11, 1]> : tensor<3xindex>) : () -> !tosa.shape<3>
+ %start = tosa.const_shape values(dense<[6, 8, 0]> : tensor<3xindex>) : () -> !tosa.shape<3>
+ %2 = tosa.slice %arg0, %start, %size : (tensor<13x21x3xi16>, !tosa.shape<3>, !tosa.shape<3>) -> tensor<4x11x1xi16>
+ return %2 : tensor<4x11x1xi16>
+}
+
+// -----
+
+// CHECK-LABEL: test_tile_i32
+func.func @test_tile_i32(%arg0: tensor<13x21x3xi32>) -> tensor<39x21x6xi32> {
+ %cst = tosa.const_shape values(dense<[3, 1, 2]> : tensor<3xindex>) : () -> !tosa.shape<3>
+ %0 = tosa.tile %arg0, %cst: (tensor<13x21x3xi32>, !tosa.shape<3>) -> tensor<39x21x6xi32>
+ return %0 : tensor<39x21x6xi32>
+}
+
+// -----
+
+// CHECK-LABEL: test_transpose_i8
+func.func @test_transpose_i8(%arg0: tensor<13x21x3xi8>) -> tensor<3x13x21xi8> {
+ %1 = tosa.transpose %arg0 perms([2, 0, 1]) : (tensor<13x21x3xi8>) -> tensor<3x13x21xi8>
+ return %1 : tensor<3x13x21xi8>
+}
\ No newline at end of file
More information about the Mlir-commits
mailing list