[PATCH] D122091: [amdgpu] Elide module lds allocation in kernels with no callees
Jon Chesterfield via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 06:22:49 PDT 2022
JonChesterfield added a comment.
The other passes do know how much is allocated. I don't want to go digging around the IR looking for the llvm.donothing call, which iirc is removed before instruction selection
I can invert the sense of the attribute if you deem that important. Call it amdgpu-no-module-lds-needed or similar, with the same allocate when missing attribute behaviour.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp:380
+ const CallGraphNode *N = CG[&Func];
+ const bool CalleesRequireModuleLDS = N->size() > 0;
+
----------------
arsenm wrote:
> I don't think this actually works for indirect calls (or even calls through aliases)
Indirect calls are represented as an edge from 'outside', I'll check that external edge is accounted under size.
Indirect calls in general need careful handling, but this initial patch is only checking for any calls at all.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp:36
+ const char *Attr = "amdgpu-requires-module-lds";
+ if (F.hasFnAttribute(Attr))
+ CalleeRequiresModuleLDS = F.getFnAttribute(Attr).getValueAsBool();
----------------
arsenm wrote:
> You can just do getFnAttribute, you don't need a second query
That returns 'false' for a missing attribute though, and I want the default state to be 'true'
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122091/new/
https://reviews.llvm.org/D122091
More information about the llvm-commits
mailing list