[LLVMdev] [PATCH] OpenCL half support
Anton Lokhmotov
Anton.Lokhmotov at arm.com
Mon Mar 21 03:44:21 PDT 2011
> Adding half float to LLVM IR is *only* reasonable if you have hardware
> that supports half float, or if you want to add softfloat operations
> for these.
Yes, our graphics hardware natively supports some fp16 arithmetic
operations.
> Just like C compilers need to know sizeof(long), sizeof(void*) and
> many many other target specific details, an OpenCL compiler would need
> to know whether to generate fp16 or not.
Yes, it's just another example of LLVM-IR non-portability. Basically, any
fp16 arithmetic code can be generated only if the cl_khr_fp16 extension is
supported (otherwise, the frontend would reject even declaring fp16
variables, leave alone performing arithmetic on them).
Anton.
More information about the llvm-dev
mailing list