[PATCH] D155190: [amdgpu][lds] Remove recalculation of LDS frame from backend

Jon Chesterfield via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 05:30:28 PDT 2023


JonChesterfield created this revision.
JonChesterfield added reviewers: arsenm, jmmartinez.
Herald added subscribers: foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
JonChesterfield requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Do the LDS frame calculation once, in the IR pass, instead of repeating the work in the backend.

Prior to this patch:
The IR lowering pass sets up a per-kernel LDS frame and annotates the variables with absolute_symbol
metadata so that the assembler can build lookup tables out of it. There is a fragile association between
kernel functions and named structs which is used to recompute the frame layout in the backend, with
fatal_errors catching inconsistencies in the second calculation.

After this patch:
The IR lowering pass additionally sets a frame size attribute on kernels. The backend uses the same
absolute_symbol metadata that the assembler uses to place objects within that frame size.

Deleted the now dead allocation code from the backend. Left for a later cleanup:

- enabling lowering for anonymous functions
- removing the elide-module-lds attribute (test churn, it's not used by llc any more)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155190

Files:
  llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
  llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
  llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
  llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  llvm/test/CodeGen/AMDGPU/lower-kernel-and-module-lds.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-all-indirect-accesses.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-constantexpr.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-indirect-extern-uses-max-reachable-alignment.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-via-hybrid.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds-via-table.ll
  llvm/test/CodeGen/AMDGPU/lower-module-lds.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155190.539974.patch
Type: text/x-patch
Size: 23199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230713/6d5cea26/attachment.bin>


More information about the llvm-commits mailing list