zezba9000
zezba9000

Reputation: 3383

LLVM IR 10-bit floats / float width?

Does LLVM support 10 or 11 bit floats? Looking at the docs: https://llvm.org/docs/BitCodeFormat.html
I see "TYPE_CODE_HALF" 16-bit but no way to specify a float width.

I notice this is possible with integers can be any bit-width but what about floats for special hardware cases?

Reason for this question is I'm interested in the feasibility of targeting GPU assembly that supports 10-bit floats: https://learn.microsoft.com/en-us/windows/desktop/direct3d10/d3d10-graphics-programming-guide-resources-float-rules

Or if this isn't possible is it possible to declare custom types or attributes where this specialization could be taken into account when making an LLVM backend?

Upvotes: 0

Views: 237

Answers (1)

Anton Korobeynikov
Anton Korobeynikov

Reputation: 9324

LLVM does not support arbitrary precision floats. Though, you could emulate the behavior. There are multiple ways of doing so, e.g. via intrinsics.

Upvotes: 2

Related Questions