[PATCH] D102334: [AMDGPU] Sort LDS globals based on thier size and alignment.

Mahesha S via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 18:20:49 PDT 2021


hsmhsm added a comment.

In D102334#2754812 <https://reviews.llvm.org/D102334#2754812>, @rampitec wrote:

> In D102334#2754646 <https://reviews.llvm.org/D102334#2754646>, @JonChesterfield wrote:
>
>> This seems to put all variables into one struct. I was suggesting a struct type and instance per kernel, populated by the subset of variables that can be accessed by kernel and functions called by it. Strictly speaking this does do that, but the subset can usually be smaller than the set of all variables in the module.
>
> Right, I think we need a minimal (or as small as we can if not minimal) set per kernel.

As I have mentioned in the email -

(1)  Which means to further improve the pass - "LowerModuleLDS" implemented by Jon, we need to run this pass twice (a) - before promoteAlloca and (b) afterPromoteAlloca, and I am not sure, if we face any hurdle doing this.
(2)  Carefully implement a logic to traverse the call graph to find out all reachable LDS globals
(3)  Create a separate struct type per kernel based on their reachable LDS set
(4)  Create an instance of respective struct type within each kernel
(5)  Replace within non kernel-function uses of LDS by their respective struct member offset counter-part which would be different for different kernels.

Item (2) is problamtic in the presence of call graph. But, we can probably conservatively make an attempt and see if it works
Item (5) whichI have no idea how to do it.  @JonChesterfield do you have any idea in mind w.r.t this?

All in all, it is going to take time.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102334/new/

https://reviews.llvm.org/D102334



More information about the llvm-commits mailing list