KhronosGroup / SPIRV-Headers

SPIRV-Headers
Other
271 stars 258 forks source link

Inconsistent operands names in extended grammar files #186

Open sfricke-samsung opened 3 years ago

sfricke-samsung commented 3 years ago

This is a really minor issue, but did catch me off guard.

The extinst.nonsemantic.clspvreflection.grammar.json grammar file for has the operands for the extended instructions as

{ "kind" : "IdRef", "name" : "Kernel" },

while every other grammar file has

{ "kind" : "IdRef", "name" : "'Format'" },

Where the name is wrapped in the single quote. This is easy to check, but annoying to not know it isn't consistent everywhere

johnkslang commented 3 years ago

I did some grepping, and found this is pretty consistent, in that all grammars except for clspvreflection always have the formatting '...' while the clspvreflection grammar never does, with one exception where the core grammar has { "kind" : "LiteralString", "name" : "The name of the opaque type." }.

The convention is to use emphasized operand names, so maybe clspvrelfection should also do that. @dneto0?

The exception in the core grammar shows flexibility in use of name, but as this has evolved to be considered a name (the writing predates the grammar representation), it could be made to match the other opcodes, using something like "'Type Name'" which is then described in the instruction description instead of this attempt to describe it in the operand name itself. @raunraun?

(If we completed this as an enforced formalization, the '...' could move inside of tooling instead of being in the grammar files.)