KhronosGroup / KhronosGroup/SPIRV-Registry
Shader SPIR-V needs a better Aliasing story/rules
- Dominant language
- HTML
- Stars
- 149
- Forks
- 99
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 2
Description
As presented at the Shading Language Symposium the way that Shader SPIR-V defaults around aliasing interact effectively prevent Shading Language Compiler developers implementing Closures or capturing lambdas.
[Francisco-Letterio-DevSH_SPIRV-1.pdf](https://github.com/user-attachments/files/25479763/Francisco-Letterio-DevSH_SPIRV-1.pdf)
The issue isn't only that Shader SPIR-V aliasing rules devolve to be more strict than C++ and C's causing "Our New Favourite UB" as presented towards the end of the presentation.
There's a fundamental problem with how extensions interact or forget to handle interactions with the default aliasing rules when they introduce a new storage class or relax some rules around pointer variables.
Furthermore I think this is real stumbling block for OpenCL on Vulkan implementations as the only way to get pointers in certain storage classes to alias is to perform transforms (in the style of clvk or vcc) which destroy all opportunity for the final consumer to optimize since variable lifetimes are lost and everything aliases everything.
Furthermore these transforms make all accesses individual uint8 or uint16.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked Francisco-Letterio-DevSH_SPIRV-1.pdf presentation and the issue's discussion of default aliasing rules, storage classes, pointer variables, and OpenCL on Vulkan. Done would require an agreed specification change that defines consistent aliasing behavior and addresses interactions with extensions.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100