[Mlir-commits] [mlir] [mlir][tosa] Add accumulator verifier for FP8 types for AvgPool2D (PR #134727)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Apr 7 13:49:01 PDT 2025


https://github.com/Jerry-Ge created https://github.com/llvm/llvm-project/pull/134727

None

>From fe88ebd6150b47809c71bc237cd456f38fe7c03a Mon Sep 17 00:00:00 2001
From: Jerry Ge <jerry.ge at arm.com>
Date: Mon, 7 Apr 2025 13:47:10 -0700
Subject: [PATCH] [mlir][tosa] Add accumulator verifier for FP8 types for
 AvgPool2D

Signed-off-by: Jerry Ge <jerry.ge at arm.com>
Change-Id: I04b34f62e622893b52417a96ab33166c96c846d7
---
 mlir/lib/Dialect/Tosa/IR/TosaOps.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index c8e9ad8bd3346..80bcc7a618080 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -600,6 +600,11 @@ LogicalResult tosa::AvgPool2dOp::verify() {
   if (inputETy.isF32() && !accType.isF32())
     return emitOpError("accumulator type for f32 tensor is not f32");
 
+  if ((llvm::isa<Float8E5M2Type>(inputETy) ||
+       llvm::isa<Float8E4M3FNType>(inputETy)) &&
+      !accType.isF16())
+    return emitOpError("accumulator type for f8 tensor is not f16");
+    
   if (inputETy != inputZpETy)
     return emitOpError("expect both input and its zero point are the same "
                        "element type, got ")



More information about the Mlir-commits mailing list