KhronosGroup / KhronosGroup/SPIRV-Registry

Clarification regarding OpAccessChain indexes

Open
#425 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
149
Forks
99
Avg merge
4d 21h
Merged PRs (30d)
2

Description

A recent [PR ](https://github.com/llvm/llvm-project/pull/201663) 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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Review the OpAccessChain instruction description and its stated word count in the SPIR-V specification, then compare that wording with spirv-val behavior and PR 201663. Done means the specification explicitly resolves whether an index-less OpAccessChain is legal and makes the operand wording consistent.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.