ILGPU icon indicating copy to clipboard operation
ILGPU copied to clipboard

`fp8` and `bfloat16` support

Open lostmsu opened this issue 2 years ago • 4 comments

NVidia actually has two variants of fp8 with different sizes of mantissa/exponent. bfloat16 is also unique. There's also TensorFloat32 which is really more like bfloat19. Perhaps it would make sense to have float<SizeOfMantissa, SizeOfExponent> generic type (hackery).

lostmsu avatar Feb 03 '23 00:02 lostmsu

It looks like Cuda provides a few alternate floating point options, including bf16 and tf32.

This would have to be a Cuda only feature, as there is no equivalent in OpenCL 2.0.

We already have support for Half. Would we add support for BFloat16 and TensorFloat32 types? @m4rs-mt

MoFtZ avatar Feb 03 '23 01:02 MoFtZ

@MoFtZ that's why it might make sense to have the generic-sized float type as I mentioned, with boolean guards. E.g. bool Accelerator.SupportsType(...) function, which would let user choose a different kernel.

lostmsu avatar Feb 03 '23 06:02 lostmsu

@lostmsu @MoFtZ I think this makes sense to add given that NVIDIA GPUs can take serious advantage of these types. I wonder how we can make this happen in a convenient way. Let's get into more detail on Thursday in our talk-to-dev session.

m4rs-mt avatar Feb 07 '23 08:02 m4rs-mt

Based on our last discussions, this is more broadly related to adding support for the Cuda WMMA (Warp Level Matrix Multiply-Accumulate Instructions); adding support for the fp8 and bfloat16 types is not very useful without WMMA support.

MoFtZ avatar Apr 26 '23 11:04 MoFtZ