KhronosGroup / KhronosGroup/SPIRV-Tools
spirv-opt: CombineAccessChains doesn't support identical pointer types
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
[data.zip](https://github.com/KhronosGroup/SPIRV-Tools/files/5078616/data.zip)
```
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %4 "main" %9
OpExecutionMode %4 OriginUpperLeft
OpSource ESSL 320
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%12 = OpTypeVector %6 2
%14 = OpConstant %6 1
%13 = OpConstantComposite %12 %14 %14
%7 = OpTypePointer Private %6
%8 = OpTypePointer Private %6
%15 = OpTypePointer Private %12
%9 = OpVariable %15 Private %13
%4 = OpFunction %2 None %3
%5 = OpLabel
%10 = OpAccessChain %7 %9 %14
%11 = OpAccessChain %8 %10
OpReturn
OpFunctionEnd
```
spirv-opt produces the following error
> error: line 20: Expected Result Type and Operand type to be the same
%11 = OpCopyObject %_ptr_Private_int_0 %10
>
> error: line 0: Validation failed after pass combine-access-chains
if executed with the following command `spirv-opt -o out.spv --validate-after-all --combine-access-chains`.
Can be reproduced on c20995ef.
Contributor guide
Research direction
Reproduce the failure with spirv-opt using --validate-after-all and --combine-access-chains on the attached SPIR-V input. Start at the combine-access-chains pass entry point and trace handling of the two identical-looking pointer types. Done means the reproduced module passes validation after the optimization without the OpCopyObject type mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100