(where clang --version is version 11.0.0 (https://github.com/llvm/llvm-project.git d812efb121f72958cc88c866f3ed3b80ed052856))
then
llvm-spirv kernel.bc
(where llvm-spirv --version is LLVM version 11.0.0git)
and
spirv-dis kernel.spv
(where spirv-dis --version is SPIRV-Tools v2020.2 unknown hash, 2020-04-01T21:21:27)
will produce OpExecutionMode %4 VecTypeHint 0x0 rather than OpExecutionMode %4 VecTypeHint 0x10000.
This isn't a problem for the llvm-spirv tool since decoding is consistent with encoding and the zero length vectors in the SPIRV hint are correctly converted back to IR vectors of length one. However, this encoding still seems inconsistent with the spec wording above.
For a scalar type e.g.
char
,int
,float
etc. the length of the vector in the SPIRV encoding of the hint is0
. The spec says:implying that when the hint type is scalar the upper 16 bits should be have a value of
0x0001
rather than0x0000
. (see https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#Execution_Mode).An example of this can be reproduced as follows: For an OpenCL kernel in file
kernel.cl
:calling
clang
with(where
clang --version
isversion 11.0.0 (https://github.com/llvm/llvm-project.git d812efb121f72958cc88c866f3ed3b80ed052856)
)then
(where
llvm-spirv --version
isLLVM version 11.0.0git
)and
(where
spirv-dis --version
isSPIRV-Tools v2020.2 unknown hash, 2020-04-01T21:21:27
)will produce
OpExecutionMode %4 VecTypeHint 0x0
rather thanOpExecutionMode %4 VecTypeHint 0x10000
.This isn't a problem for the
llvm-spirv
tool since decoding is consistent with encoding and the zero length vectors in the SPIRV hint are correctly converted back to IR vectors of length one. However, this encoding still seems inconsistent with the spec wording above.