[PATCH] D127052: [amdgpu][nfc] Allocate kernel-specific LDS struct deterministically

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 07:24:49 PDT 2022


JonChesterfield added a comment.

In D127052#3563622 <https://reviews.llvm.org/D127052#3563622>, @scchan wrote:

> In D127052#3560815 <https://reviews.llvm.org/D127052#3560815>, @JonChesterfield wrote:
>
>> Hoping this is uncontroversial - got more patches to follow up with if we can land this,
>
> This patch essentially turns the module scope LDS layout struct into creating a function scope thing for every kernel using global LDS?

No. A patch by Stas some months ago adapted the module scope LDS lowering to stash remaining kernel variables in a per-kernel struct.

All this patch does, if that per-kernel struct is present, is put it at a predictable address instead of leaving it to the whims of block iteration order.



================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp:90
+  std::string KernelLDSName = "llvm.amdgcn.kernel.";
+  KernelLDSName += F.getName();
+  KernelLDSName += ".lds";
----------------
arsenm wrote:
> Need to be careful about multiple anonymous functions
How so? By the time they're functions in IR they have unique names as far as I know. If they don't, the current lowering is already broken for them as it assumes a struct can be uniquely associated with a function by deriving the variable name from the function name


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127052/new/

https://reviews.llvm.org/D127052



More information about the llvm-commits mailing list