[Mlir-commits] [mlir] [mlir][tosa] Add FP8 support (PR #127730)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Feb 19 08:48:31 PST 2025


================
@@ -258,14 +263,22 @@ static LogicalResult verifyConvOp(T op) {
     return failure();
   }
 
-  if (isa<Float8E5M2Type>(inputEType) || isa<Float8E4M3FNType>(inputEType) ||
-      isa<Float8E5M2Type>(weightEType) || isa<Float8E4M3FNType>(weightEType)) {
+  if (llvm::isa<Float8E5M2Type>(inputEType) ||
+      llvm::isa<Float8E4M3FNType>(inputEType) ||
+      llvm::isa<Float8E5M2Type>(weightEType) ||
+      llvm::isa<Float8E4M3FNType>(weightEType)) {
     if (inputEType != weightEType) {
       op.emitOpError(
           "expect both input and weight to have same element type, got ")
           << inputEType << " and " << weightEType;
       return failure();
     }
+
+    if (!resultEType.isF16()) {
+      op.emitOpError("expect bias and result element type to be f16, got ")
----------------
Jerry-Ge wrote:

Good idea. Since we currently don't have anything for dtype checkings here: https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Tosa/Transforms/TosaValidation.cpp. Feels like it should be another separate patch. 

https://github.com/llvm/llvm-project/pull/127730


More information about the Mlir-commits mailing list