[Mlir-commits] [mlir] faf697e - [mlir] Add support for f8 data	types to LLVM dialect types
    Eugene Zhulenev 
    llvmlistbot at llvm.org
       
    Thu Mar  9 18:52:41 PST 2023
    
    
  
Author: Eugene Zhulenev
Date: 2023-03-09T18:52:36-08:00
New Revision: faf697e49bad099b36770c7738f36917e3d90d2d
URL: https://github.com/llvm/llvm-project/commit/faf697e49bad099b36770c7738f36917e3d90d2d
DIFF: https://github.com/llvm/llvm-project/commit/faf697e49bad099b36770c7738f36917e3d90d2d.diff
LOG: [mlir] Add support for f8 data types to LLVM dialect types
This change allows using fp8 pointers when exporting to LLVM, because we anyway export them as opaque pointers, however full support of fp8 types is not yet implemented on the LLVM side.
Differential Revision: https://reviews.llvm.org/D143008
Added: 
    
Modified: 
    mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
    mlir/test/Target/LLVMIR/llvmir.mlir
Removed: 
    
################################################################################
diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
index 2e6bf86022fa3..4b3b1e183903f 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
@@ -731,6 +731,8 @@ bool mlir::LLVM::isCompatibleOuterType(Type type) {
       Float64Type,
       Float80Type,
       Float128Type,
+      Float8E4M3FNType,
+      Float8E5M2Type,
       LLVMArrayType,
       LLVMFunctionType,
       LLVMLabelType,
@@ -801,6 +803,8 @@ static bool isCompatibleImpl(Type type, DenseSet<Type> &compatibleTypes) {
             Float64Type,
             Float80Type,
             Float128Type,
+            Float8E4M3FNType,
+            Float8E5M2Type,
             LLVMLabelType,
             LLVMMetadataType,
             LLVMPPCFP128Type,
diff  --git a/mlir/test/Target/LLVMIR/llvmir.mlir b/mlir/test/Target/LLVMIR/llvmir.mlir
index 82d05dbf0015a..d19f49d4b2938 100644
--- a/mlir/test/Target/LLVMIR/llvmir.mlir
+++ b/mlir/test/Target/LLVMIR/llvmir.mlir
@@ -944,6 +944,11 @@ llvm.func @vector_splat_nonzero_scalable() -> vector<[4]xf32> {
   llvm.return %0 : vector<[4]xf32>
 }
 
+// CHECK-LABEL: @f8_ptrs(ptr {{%.*}}, ptr {{%.*}})
+llvm.func @f8_ptrs(%arg0: !llvm.ptr<f8E5M2>, %arg1: !llvm.ptr<f8E4M3FN>) {
+  llvm.return
+}
+
 // CHECK-LABEL: @ops
 llvm.func @ops(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: i32) -> !llvm.struct<(f32, i32)> {
 // CHECK-NEXT: fsub float %0, %1
        
    
    
More information about the Mlir-commits
mailing list