KhronosGroup / KhronosGroup/SPIRV-Tools
Fix handling of DebugScope on OpLine
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 709
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 28
Description
The encoding of the debug scope in spirv-opt's representation of the IR allows for an OpLine to have a different debug scope than the instruction to which the OpLine applies. However, when turning the spir-v binary into spirv-opt's representation, it is assumed that an OpLine must have the same debug scope as the instructions it applies to.
Conceptually, this assumption makes sense. We could also say that an Opline does not have a debug scope. Since it is itself a debug instruction, what does it mean for it to existing in a debug scope.
This needs to be clarified because there are some spirv-opt passes that might change the debug scope of an instruction so that its OpLine has a different debug scope. This can break some passes. See #4910.
TODOs:
[ ] Clarify with the SPIR working group how the debug scope and opline should interact. If necessary get the spec clarified. It is currently pretty vague.
[ ] Modify spirv-opt to match what we hear from the working group.
[ ] If an OpLine can have a different debug scope, the reader will have to handle that case, and add a few tests to some passes.
[ ] If not, we have to revisit the fix for #4910. We will have to fix the ssarewriter instead.
Contributor guide
Assessment
This issue has not been assessed yet.