-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Write a pass for Data layout scalarization #107920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Labels
Comments
This was referenced Sep 12, 2024
This was referenced Sep 17, 2024
farzonl
added a commit
to llvm/wg-hlsl
that referenced
this issue
Sep 20, 2024
This proposal covers: - all the cases mentioned in: llvm/llvm-project#107920 - The results of our design discussion - the global multi-d to 1d array flattening cases mentioned in: llvm/llvm-project#89646 - intro, background, and motivation for this work.
Sterling-Augustine
pushed a commit
to Sterling-Augustine/llvm-project
that referenced
this issue
Sep 27, 2024
This change adds a pass to scalarize vectors in global scope into arrays. There are three distinct parts 1. find the globals that need to be updated and define what the new type should be 2. initialize that new type and copy over all the right attributes over from the old type. 3. Use the instruction visitor pattern to update the loads, stores, and geps for the layout of the new data structure. resolves llvm#107920
puja2196
pushed a commit
to puja2196/LLVM-tutorial
that referenced
this issue
Sep 30, 2024
This change adds a pass to scalarize vectors in global scope into arrays. There are three distinct parts 1. find the globals that need to be updated and define what the new type should be 2. initialize that new type and copy over all the right attributes over from the old type. 3. Use the instruction visitor pattern to update the loads, stores, and geps for the layout of the new data structure. resolves llvm/llvm-project#107920
puja2196
pushed a commit
to puja2196/LLVM-tutorial
that referenced
this issue
Oct 2, 2024
This change adds a pass to scalarize vectors in global scope into arrays. There are three distinct parts 1. find the globals that need to be updated and define what the new type should be 2. initialize that new type and copy over all the right attributes over from the old type. 3. Use the instruction visitor pattern to update the loads, stores, and geps for the layout of the new data structure. resolves llvm/llvm-project#107920
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The scalarizer pass does not handle scalarization of data structures. Further there isn't an existing llvm pass that does this.
In this godbolt link we have seven scenarios of Array vectors: https://hlsl.godbolt.org/z/9c35aa9zj
and
The idea behind this is to see the data transformation requirements for vectors defined on the
stack vs those defined globally vs those defined with groupshared or static.
In clang the three different global array of vectors scenarios look roughly the same
with a few attribute differences.
DXC however converts
bArr
(the global nongroupshared
case) into a cbuffer.The cArr
groupshared
global however gets represented as a flattened 12 wide array in DXCAnd dArr the static case the vev4 gets scalarized into 4 3 element arrays.
static in a function scope is represented similarly to a function in global scope with only name mangling differences
aArr, the array defined on the function is optimized away into a series of extract elements.
In the cVec DXC converts the vector into an array of 4 elements:
The working theory is that data layout transformations are needed for data defined globally.
Further there seems to be three specific behaviors we want.
As such The proposal is:
Globals can be iterated over like so:
for (GlobalVariable &GV : M.globals()) {...}
And we will need to update uses like so
The text was updated successfully, but these errors were encountered: