Spirv-val error of CLSPV output with program-scope "const" variable
- Dominant language
- LLVM
- Stars
- 729
- Forks
- 110
- Avg merge
- 17h 51m
- Merged PRs (30d)
- 23
Description
`./clspv -cl-std=CL2.0 -inline-entry-points input.sl`
```Cpp
const float M = 4.3f;
kernel void myKernel( global float * my_out)
{
size_t g = get_global_id(0);
*my_out = M;
}
```
https://godbolt.org/z/714de5ved
The tool `spirv-val` returned error for the above spirv output from CLSPV.
(I was supposed to **get a spv input for vulkan run**, and it ended up with failing as below.)
I've done with set target as vulkan1.1 ~ 1.4.
`spirv-val.exe --target-env "vulkan1.1" a.spv`
`spirv-val.exe --target-env "vulkan1.2" a.spv`
`spirv-val.exe --target-env "vulkan1.3" a.spv`
`spirv-val.exe --target-env "vulkan1.4" a.spv`
```bash
error: line 45: [VUID-StandaloneSpirv-Uniform-06807] StorageBuffer OpVariable '4[%4]' has illegal type.
From Vulkan spec:
Variables identified with the StorageBuffer storage class are used to access transparent buffer backed resources. Such variables must be typed as OpTypeStruct, or an array of this type
%4 = OpVariable %_ptr_StorageBuffer_float StorageBuffer %float_4_30000019
```
https://registry.khronos.org/vulkan/specs/latest/man/html/StandaloneSpirv.html#VUID-StandaloneSpirv-Uniform-06807
Is it likely that the above command(`OpVariable ~~~`) was generated incorrectly? If so, What would be the reasonable fix for that?
Contributor guide
Assessment
This issue has not been assessed yet.