mlir icon indicating copy to clipboard operation
mlir copied to clipboard

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

Open antiagainst opened this issue 6 years ago • 6 comments

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 avatar Oct 17 '19 19:10 antiagainst

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

antiagainst avatar Oct 17 '19 19:10 antiagainst

@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!

denis0x0D avatar Dec 04 '19 11:12 denis0x0D

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

antiagainst avatar Dec 04 '19 13:12 antiagainst

@antiagainst does anyone have plans for this task?

denis0x0D avatar May 31 '20 14:05 denis0x0D

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

antiagainst avatar Jun 02 '20 15:06 antiagainst

@antiagainst thanks!

denis0x0D avatar Jun 02 '20 20:06 denis0x0D