hello @antiagainst
Right now I am working on finalizing the Serializer for the Matrix type but I found an issue, in the spv.AccessChain, according to the specification, the type of the index should be an integer that will be treated as signed (SPIR-V Specification). And in the provided example in SPIRV Dialect you can see the index constant represented this way:
%0 = "spv.constant"() { value = 1: i32} : () -> i32
%1 = spv.Variable : !spv.ptr<!spv.struct<f32, !spv.array<4xf32>>, Function>
%2 = spv.AccessChain %1[%0] : !spv.ptr<!spv.struct<f32, !spv.array<4xf32>>, Function>
However, when I created a SPIRV binary for testing the Matrix data type, I get the following:
%16 = spv.constant 2 : si32
%17 = spv.AccessChain %1[%16] : !spv.ptr<!spv.matrix<3 x vector<3xf32>>, Function>
This si32 causes the following error in the AccessChain:
error: use of value '%16' expects different type than prior uses: 'i32' vs 'si32'
I traced this error to Parser.cpp â resolveSSAUse method. The method is expecting i32 type but it finds si32 so it raises this error.
To fix this issue, I modified the method parseAccessChainOp in SPIRVOps.cpp basically I replaced this line:
Type indicesType = parser.getBuilder().getIntegerType(32);
to be:
Type indicesType = parser.getBuilder().getIntegerType(32, true);
I no longer get the error above and I believe this is the cause of the error I posted earlier this month, and it should be compliant with the specification that the accesschain indices are signed (si32) not (i32). Please correct me if my analysis and fix here are not the expected behavior from the code.