[clang] [AMDGPU][Clang] Support for type inferring extended image builtins for AMDGPU (PR #164358)
Shilei Tian via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 25 08:28:56 PDT 2025
================
@@ -3,7 +3,7 @@
typedef int int4 __attribute__((ext_vector_type(4)));
typedef float float4 __attribute__((ext_vector_type(4)));
-typedef half half4 __attribute__((ext_vector_type(4)));
+typedef _Float16 half4 __attribute__((ext_vector_type(4)));
----------------
shiltian wrote:
Hmm, these are OpenCL code, so I'd imagine this should be OpenCL type (thus `half`), but since our builtins are used both for OpenCL and HIP, and in HIP we use `_Float16` instead, I'm not sure how we can nicely handle that.
```
// h -> half (__fp16, OpenCL)
// x -> half (_Float16)
// y -> half (__bf16)
```
Based on the document, OpenCL's original `half` (or `__fp16`) is more like a storage type w/ arithmetic operations promoting to `float` for computation.
Maybe here we just need to enable `cl_khr_fp16` extension? WDYT? @arsenm @yxsamliu
https://github.com/llvm/llvm-project/pull/164358
More information about the cfe-commits
mailing list