From: Eugene Zhulenev Date: Wed, 1 Feb 2023 21:48:50 +0000 (-0800) Subject: [mlir] Add support for f8 data types to LLVM dialect types X-Git-Tag: upstream/17.0.6~15300 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=faf697e49bad099b36770c7738f36917e3d90d2d;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp index 2e6bf8602..4b3b1e1 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 &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 82d05db..d19f49d 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, %arg1: !llvm.ptr) { + 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