[PATCH] D140088: Add LLVM type support for fp8

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 13:38:06 PST 2023


nikic added a subscriber: nlopes.
nikic added a comment.

To clarify, I'm not necessarily saying that we can't move forward with this implementation approach, just that it should go through an RFC to have a wider discussion on the topic. The outcome of that may well be that we should just carry on as before.

I should also clarify that I'm definitely not excepting a fully-generic floating point system in the same vein as we have for integers, but rather some more consolidated handling for floating-point types (as a single floating point type parameterized over semantics, rather than a collection of many separate types). Based on @stellaraccident's comment, that would be similar to what MLIR does? This should be much simpler to do than fully-generic floats.

Finally, I think something very important when it comes to these specific types (as opposed to "more float types" in general) is that these types deviate from IEEE semantics in ways that existing types don't, so need to be careful about how these affect IR semantics and middle-end optimization. I'm pretty sure that just exposing the existing code to these types will cause miscompiles in some cases -- e.g. it looks like creating an infinity value of these types will create a NaN instead, so if we create Inf as a neutral value for min/max, we'll now use NaN instead, which would be incorrect. There's probably more things like this lurking in various transforms.

In order to be reasonably confident about optimization correctness for these types, what we'd want is to land basic LangRef + IR support first, then work with @nlopes for Alive2 support (ironing out and specifying any details about semantics along the way) and then duplicating key bits of existing tests for the new types, and checking that alive2 does not detect miscompiles.



================
Comment at: llvm/tools/llvm-c-test/echo.cpp:83
       case LLVMBFloatTypeKind:
         return LLVMHalfTypeInContext(Ctx);
       case LLVMFloatTypeKind:
----------------
Drive-by note: This is creating the wrong type...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140088/new/

https://reviews.llvm.org/D140088



More information about the llvm-commits mailing list