Skip to content

Clarification regarding OpAccessChain indexes #425

Description

@maarquitos14

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions