[all-commits] [llvm/llvm-project] 935aba: AMDGPU: Use module level register maximums for unk...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Fri Feb 4 12:56:17 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 935abab65cafb509f60e76bd7255dfe03befde85
      https://github.com/llvm/llvm-project/commit/935abab65cafb509f60e76bd7255dfe03befde85
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2022-02-04 (Fri, 04 Feb 2022)

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

  Log Message:
  -----------
  AMDGPU: Use module level register maximums for unknown callees

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 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.


  Commit: 4622afa94c014dff814952b34ba5c9447a7c48c6
      https://github.com/llvm/llvm-project/commit/4622afa94c014dff814952b34ba5c9447a7c48c6
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2022-02-04 (Fri, 04 Feb 2022)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.h
    M llvm/test/CodeGen/AMDGPU/agpr-register-count.ll
    M llvm/test/CodeGen/AMDGPU/amdpal-callable.ll
    M llvm/test/CodeGen/AMDGPU/attr-amdgpu-flat-work-group-size-vgpr-limit.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage-agpr.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage0.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage1.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage2.ll
    M llvm/test/CodeGen/AMDGPU/call-alias-register-usage3.ll
    M llvm/test/CodeGen/AMDGPU/call-graph-register-usage.ll
    M llvm/test/CodeGen/AMDGPU/indirect-call.ll
    M llvm/test/CodeGen/AMDGPU/ipra.ll
    M llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
    M llvm/test/CodeGen/AMDGPU/spill-vgpr-to-agpr.ll
    M llvm/test/CodeGen/AMDGPU/trap.ll

  Log Message:
  -----------
  AMDGPU: Convert AMDGPUResourceUsageAnalysis to a Module pass

This is more precise in the face of indirect calls and aliases, still
assuming the call target is defined somewhere in the current module.

This sometimes changes the order the functions are printed, and also
changes the point where context errors are printed relative to
stdout. This also likely has negative consequences for compile time
and memory usage.


Compare: https://github.com/llvm/llvm-project/compare/679f8a885b65...4622afa94c01


More information about the All-commits mailing list