A recent PR in the SPIR-V BE made me realize that, IMO, it's not clear in the current wording of the spec if index-less OpAccessChain is legal. On the one hand, spirv-val doesn't report any issue, and the spec says the word count for OpAccessChain is "4 + variable", which would be consistent with not requiring any index at all. On the other hand, the wording of the instruction description can lead to think at least one index is required. For example, look at the excerpt shown below:
Indexes walk the type hierarchy to the desired depth, potentially down to scalar granularity. The first index in Indexes selects the top-level [...]
IMO, the sentence above implies that there is at least one index. Also, when some of the operands is optional, the spec usually specifies it with Optional, which is not present in OpAccessChain's Indexes operand. Can we get a clarification about this?
A recent PR in the SPIR-V BE made me realize that, IMO, it's not clear in the current wording of the spec if index-less OpAccessChain is legal. On the one hand, spirv-val doesn't report any issue, and the spec says the word count for OpAccessChain is "4 + variable", which would be consistent with not requiring any index at all. On the other hand, the wording of the instruction description can lead to think at least one index is required. For example, look at the excerpt shown below:
IMO, the sentence above implies that there is at least one index. Also, when some of the operands is optional, the spec usually specifies it with
Optional, which is not present inOpAccessChain'sIndexesoperand. Can we get a clarification about this?