Is there a way to automatically convert a code that has been written to do FP32 calculations on a FP32 GPU, so it can do always FP16 calculations instead of FP32?
What I'm trying to achieve is to run a code for an old GPU (that doesn't support HALF Type), to run on a newer GPU that does - but without going through the code myself.
If not possible, please show me what documentations I should read to do it myself.
(New GPU is Radeon Vega Frontier, driver is ROCm 1.9.1, OS is Ubuntu 18.04)
(the code is extensive and composed by different modules. So I won't be posting it here, unless asked to)
No, there is no standard flag to say "treat float as half". You have to change
float
tohalf
. Also, your device must support fp16 calculations (many don't, just fp16 storage that converts to/from fp32 when you load/store). Thecl_khr_fp16
extension adds support for half scalar and vector types as built-in types that can be used for arithmetic operations. You'll need a#pragma
in any kernels that use it.