[Mlir-commits] [mlir] [mlir][tosa] Allow i64 accumulators (PR #228427)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Oct 2 05:59:04 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Michael Platings (mplatings)
<details>
<summary>Changes</summary>
This can be helpful for incremental lowerings to/from TOSA.
---
Full diff: https://github.com/llvm/llvm-project/pull/228427.diff
2 Files Affected:
- (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td (+1-1)
- (added) mlir/test/Dialect/Tosa/accumulator-i64.mlir (+9)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 8b5803c3074f0..339061b2aee83 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -103,7 +103,7 @@ def Tosa_ArgMinOp : Tosa_InferShapedTypeOp<"argmin", [NoMemoryEffect]> {
// Accumulator types.
//===----------------------------------------------------------------------===//
-def Tosa_AccType : AnyTypeOf<[I<32>, I<48>, F16, F32, BF16]>;
+def Tosa_AccType : AnyTypeOf<[I<32>, I<48>, I<64>, F16, F32, BF16]>;
//===----------------------------------------------------------------------===//
// Operator: avg_pool2d
diff --git a/mlir/test/Dialect/Tosa/accumulator-i64.mlir b/mlir/test/Dialect/Tosa/accumulator-i64.mlir
new file mode 100644
index 0000000000000..6f1dec31084a5
--- /dev/null
+++ b/mlir/test/Dialect/Tosa/accumulator-i64.mlir
@@ -0,0 +1,9 @@
+// RUN: mlir-opt %s --verify-each | FileCheck %s
+
+// Allow i64 accumulators to facilitate incremental lowerings to/from TOSA.
+// CHECK-LABEL: func.func @conv2d_i64
+// CHECK: acc_type(i64)
+func.func @conv2d_i64(%input: tensor<1x1x1x1xi16>, %weight: tensor<1x1x1x1xi8>, %bias: tensor<1xi64>, %izp: tensor<1xi16>, %wzp: tensor<1xi8>) -> tensor<1x1x1x1xi64> {
+ %0 = tosa.conv2d %input, %weight, %bias, %izp, %wzp pad([0, 0, 0, 0]) stride([1, 1]) dilation([1, 1]) acc_type(i64) : (tensor<1x1x1x1xi16>, tensor<1x1x1x1xi8>, tensor<1xi64>, tensor<1xi16>, tensor<1xi8>) -> tensor<1x1x1x1xi64>
+ return %0 : tensor<1x1x1x1xi64>
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/228427
More information about the Mlir-commits
mailing list