Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

[spirv] Add a pass to convert a sequence of composite insert to one composite construct #196

Open
antiagainst opened this issue Oct 17, 2019 · 6 comments

Comments

@antiagainst
Copy link
Contributor

Sometimes we will see the following code pattern

%0 = spv.undef : vector<3xi32>
%1 = spv.CompositeInsert %val0 into %0 : vector<3xi32>
%2 = spv.CompositeInsert %val1 into %1 : vector<3xi32>
%3 = spv.CompositeInsert %val2 into %2 : vector<3xi32>

for composite types.

The above can be converted into a

%3 = spv.CompositeConstruct %val0, %val1, %val2 : vector<3xi32>

To simplify the code and remove undef.

@antiagainst
Copy link
Contributor Author

https://github.com/google/clspv/blob/master/lib/RewriteInsertsPass.cpp in clspv can serve as an example.

@denis0x0D
Copy link
Contributor

@antiagainst @MaheshRavishankar according to this task, CompositeInsert and CompositeConstruct are not implemented yet, does anyone work on adding this instructions or I can take it?
Thanks!

@antiagainst
Copy link
Contributor Author

SGTM. Please feel free to pick it up! Thanks! :)

@denis0x0D
Copy link
Contributor

@antiagainst does anyone have plans for this task?

@antiagainst
Copy link
Contributor Author

Hey @denis0x0D, I don't think so. Please feel free to take it if you are interested. :)

@denis0x0D
Copy link
Contributor

@antiagainst thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants