[PATCH] D117364: AMDGPU: Use module level register maximums for unknown callees

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 15:11:16 PST 2022


arsenm created this revision.
arsenm added reviewers: rampitec, sebastian-ne, AMDGPU.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Compute the theoretical register budget based on the IR function
signature/attributes, and use the global maximum register budgets for
unknown callees.

      

This should fix the kernel reported register usage in the presence of
indirect calls. The previous fix in
2b08f6af62afbf32e89a6a392dbafa92c62f7bdf <https://reviews.llvm.org/rG2b08f6af62afbf32e89a6a392dbafa92c62f7bdf> was incorrect becauset it was
only taking the maximum in the known call graph, and missing something
that was either outside of it or codegened later.

      

This fixes a second case I discovered where calls to aliases also did
not work as expected. CallGraphAnalysis misses these, so functions
called through aliases were not codegened ahead of callers as
expected. CallGraphAnalysis should probably be fixed to understand
this case, and there's likely a bug with IPRA here. This fixes
numerous failures in the conformance test at -O0.


https://reviews.llvm.org/D117364

Files:
  llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
  llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
  llvm/lib/Target/AMDGPU/GCNSubtarget.h
  llvm/test/CodeGen/AMDGPU/agpr-register-count.ll
  llvm/test/CodeGen/AMDGPU/amdpal-callable.ll
  llvm/test/CodeGen/AMDGPU/attr-amdgpu-flat-work-group-size-vgpr-limit.ll
  llvm/test/CodeGen/AMDGPU/call-alias-register-usage-agpr.ll
  llvm/test/CodeGen/AMDGPU/call-alias-register-usage0.ll
  llvm/test/CodeGen/AMDGPU/call-alias-register-usage1.ll
  llvm/test/CodeGen/AMDGPU/call-alias-register-usage2.ll
  llvm/test/CodeGen/AMDGPU/call-alias-register-usage3.ll
  llvm/test/CodeGen/AMDGPU/call-graph-register-usage.ll
  llvm/test/CodeGen/AMDGPU/indirect-call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117364.400164.patch
Type: text/x-patch
Size: 23940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220114/b8e5370e/attachment-0001.bin>


More information about the llvm-commits mailing list