[llvm] [AMDGPU] Update code object metadata for kernarg preload (PR #134666)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Fri May 30 10:26:55 PDT 2025


================
@@ -95,11 +98,79 @@ inline raw_ostream &operator<<(raw_ostream &OS, const ArgDescriptor &Arg) {
   return OS;
 }
 
-struct KernArgPreloadDescriptor : public ArgDescriptor {
-  KernArgPreloadDescriptor() {}
-  SmallVector<MCRegister> Regs;
+namespace KernArgPreload {
+
+enum HiddenArg {
+  HIDDEN_BLOCK_COUNT_X,
+  HIDDEN_BLOCK_COUNT_Y,
+  HIDDEN_BLOCK_COUNT_Z,
+  HIDDEN_GROUP_SIZE_X,
+  HIDDEN_GROUP_SIZE_Y,
+  HIDDEN_GROUP_SIZE_Z,
+  HIDDEN_REMAINDER_X,
+  HIDDEN_REMAINDER_Y,
+  HIDDEN_REMAINDER_Z,
+  END_HIDDEN_ARGS
 };
 
+// Stores information about a specific hidden argument.
+struct HiddenArgInfo {
+  // Offset in bytes from the location in the kernearg segment pointed to by
+  // the implicitarg pointer.
+  uint8_t Offset;
+  // The size of the hidden argument in bytes.
+  uint8_t Size;
+  // The name of the hidden argument in the kernel signature.
+  const char *Name;
+};
----------------
shiltian wrote:

nit:

```suggestion
struct HiddenArgInfo {
  // Offset in bytes from the location in the kernearg segment pointed to by
  // the implicitarg pointer.
  uint8_t Offset = 0;
  // The size of the hidden argument in bytes.
  uint8_t Size = 0;
  // The name of the hidden argument in the kernel signature.
  const char *Name = nullptr;
};
```

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


More information about the llvm-commits mailing list