| Issue |
171455
|
| Summary |
[SPIRV] Add combiner rules for SPIR-V insert and extract intrinsics
|
| Labels |
HLSL,
backend:SPIR-V
|
| Assignees |
s-perron
|
| Reporter |
s-perron
|
The SPIR-V generated for matrix code is very poor. The are many instructions to manipulate the data for the matrix. The main source of this problem is the loads and stores. The memory representation of the matrix in the llvm-ir is an array, but the loads and an store treat it as a vector. To make this work, a load of a matrix will loads each element of the matrix, and then create the vector using inserts. A store will extract each element of the vector, and then store them.
Then during legalization, the vectors for the matrix are further manipulated to make sure the vectors stay small.
An example is: https://godbolt.org/z/hWG379ccr.
Proposal for combinations to fold:
```
cv = c0..cn
e = insert cv, v, i
becomes
e = build_vector c0..c{i-1}, v, c{i+1}..cn
```
```
b = build_vector c0..cn
e = extract b, i
becomes
e = ci
```
similarly fold a build vector feeding a vector shuffle.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs