[PATCH] D155125: [amdgpu][lds] Introduce LDS frame size function attribute
Jon Chesterfield via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 16:25:35 PDT 2023
JonChesterfield added a comment.
The plan for the semantic change following this is:
1/ allocate everything as we do now in the IR pass
2/ add this attribute and allocate based on it in the backend
3/ lower any LDS with absolute metadata to that address provided it is within said frame
4/ other LDS lowered as it is now, in the slightly ad hoc appending fashion
At some point 4/ could usefully be removed. Need to move graphics over to the same scheme first and update promoteAllocaToLDS, at which point _all_ LDS variables will be accounted for by the lower module pass.
Variables with absolute addresses outside of the frame means a miscompile (e.g. the IR pass didn't request a large enough frame) so there's an error raised in D155132 <https://reviews.llvm.org/D155132> for the current case where that can happen.
This will largely decouple the backend and IR pass. Anonymous functions will work fine. The IR pass can get more aggressive in data layout if we wish, e.g. multiple kernels using the same layout.
The backend's model will then be:
1/ allocate the amount of memory requested, probably in the machine function constructor
2/ put LDS variables at the absolute address they requested, error if that's inconsistent with 1/
Complexity and failure modes down. Information passed to backend via a function attribute (which shouldn't be discarded) and absolute_symbol metadata (which shouldn't be discarded), with everything else reified in the IR.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155125/new/
https://reviews.llvm.org/D155125
More information about the llvm-commits
mailing list