[all-commits] [llvm/llvm-project] bc78c0: [amdgpu] Elide module lds allocation in kernels wi...

Jon Chesterfield via All-commits all-commits at lists.llvm.org
Wed May 4 14:42:28 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bc78c099524283b5de44517ee5fbb805d09a7cdc
      https://github.com/llvm/llvm-project/commit/bc78c099524283b5de44517ee5fbb805d09a7cdc
  Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
  Date:   2022-05-04 (Wed, 04 May 2022)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
    M llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
    M llvm/lib/Target/AMDGPU/SIISelLowering.cpp
    M llvm/test/CodeGen/AMDGPU/lower-kernel-and-module-lds.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds-constantexpr.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds-offsets.ll
    M llvm/test/CodeGen/AMDGPU/lower-module-lds.ll

  Log Message:
  -----------
  [amdgpu] Elide module lds allocation in kernels with no callees

Introduces a string attribute, amdgpu-requires-module-lds, to allow
eliding the module.lds block from kernels. Will allocate the block as before
if the attribute is missing or has its default value of true.

Patch uses the new attribute to detect the simplest possible instance of this,
where a kernel makes no calls and thus cannot call any functions that use LDS.

Tests updated to match, coverage was already good. Interesting cases is in
lower-module-lds-offsets where annotating the kernel allows the backend to pick
a different (in this case better) variable ordering than previously. A later
patch will avoid moving kernel variables into module.lds when the kernel can
have this attribute, allowing optimal ordering and locally unused variable
elimination.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D122091




More information about the All-commits mailing list