[clang] [Clang][AMDGPU] Add a new builtin type for buffer rsrc (PR #94830)

Krzysztof Drewniak via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 08:41:10 PDT 2024


================
@@ -2201,6 +2207,9 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
     Align = 8;                                                                 \
     break;
 #include "clang/Basic/WebAssemblyReferenceTypes.def"
+    case BuiltinType::AMDGPUBufferRsrc:
+      Width = 0;
+      Align = 256;
----------------
krzysz00 wrote:

Hold on, there're two types that it'd make sense to builtin here.

The first is the "buffer rsrc", which the ISA manual calls a `V#`. This is a 128-bit data structure that's quite opaque as far as C semantics go. LLVM-wise they're `ptr addrspace(8)`

The other are the various flavor of buffer fat pointer, which are 160- or 192-bit values that are a buffer resource with offset bits hanging off the other end. `ptr addrspace(7)` can act like a pointer-pointer if you squint and there are LLVM lowerings to make it work

https://github.com/llvm/llvm-project/pull/94830


More information about the cfe-commits mailing list