[PATCH] D102401: [AMDGPU] Allocate LDS globals in sorted order of their size and alignment.
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 13 08:46:08 PDT 2021
rampitec added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp:92-93
+
+ // Sort LDS globals (which are used within kernel K) by size, descending, and
+ // then, by alignment, descending. On ties, sort by name, lexicographical.
+ llvm::stable_sort(
----------------
hsmhsm wrote:
> foad wrote:
> > Why is sorting by size important?
> >
> > I can see that sorting by alignment, descending, avoids alignment gaps (at least in the common case where an object's size is a multiple of its alignment). But sorting by size //first// means that most globals //won't// be sorted by alignment (unless they happened to have the same size and different alignments), so you won't get that benefit.
> I think we need to first sort based on "alignment", then on tie, based on size.
Probably yes. Strategy to sort by size was used along with the super-alignment, so did the same thing.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102401/new/
https://reviews.llvm.org/D102401
More information about the llvm-commits
mailing list