KhronosGroup / KhronosGroup/SPIRV-Tools
spirv-val: Variable pointer might not have a required storage class
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
The spec says
> Variable pointer: A pointer of logical pointer type that results from one of the following instructions:
...
OpPhi
...
It also says that
> A variable pointer must point to one of the following storage classes:
StorageBuffer
Workgroup (if the VariablePointers capability is declared)
However, the following code
```
OpCapability VariablePointers
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main"
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 310
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeFloat 32
%11 = OpConstant %6 23
%7 = OpTypePointer Function %6
%4 = OpFunction %2 None %3
%5 = OpLabel
%8 = OpVariable %7 Function
OpBranch %9
%9 = OpLabel
%10 = OpPhi %7 %8 %5
OpStore %10 %11
OpReturn
OpFunctionEnd
```
passes the validation even though the result of the `OpPhi` (`%10`) has `Function` storage class.
Contributor guide
Research direction
Start by running the supplied SPIR-V module through spirv-val and tracing validation for OpPhi results with pointer types. Add coverage for the Function storage class case and make validation reject the module because the variable pointer does not use an allowed storage class; done means the regression case fails validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100