[Mlir-commits] [mlir] [mlir][spirv] Add 8-bit float type emulation (PR #148811)
Jakub Kuderski
llvmlistbot at llvm.org
Mon Jul 21 09:29:35 PDT 2025
================
@@ -318,6 +328,44 @@ static Type convertSubByteIntegerType(const SPIRVConversionOptions &options,
type.getSignedness());
}
+/// Converts 8-bit float types to integer types with the same bit width.
+/// Returns a nullptr for unsupported 8-bit float types.
+static Type convert8BitFloatType(const SPIRVConversionOptions &options,
+ FloatType type) {
+ if (!options.emulateUnsupportedFloatTypes)
+ return nullptr;
+ // F8 types are converted to integer types with the same bit width.
+ if (isa<Float8E5M2Type, Float8E4M3Type, Float8E4M3FNType, Float8E5M2FNUZType,
+ Float8E4M3FNUZType, Float8E4M3B11FNUZType, Float8E3M4Type,
+ Float8E8M0FNUType>(type))
+ return IntegerType::get(type.getContext(), type.getWidth());
+ LLVM_DEBUG(llvm::dbgs() << "unsupported 8-bit float type\n");
----------------
kuhar wrote:
Print the unsupported type?
https://github.com/llvm/llvm-project/pull/148811
More information about the Mlir-commits
mailing list