KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator
Specialization constant representation in LLVM
- Dominant language
- LLVM
- Stars
- 625
- Forks
- 279
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
How do we represent, and carry forward, specialization constants in LLVM during the translation step?
Tim Renouf raised this issue in an email.
"Currently the AMD code passes the constant values into readSpirv() and
does the specialization inside the spir-v reader.
That's the most pragmatic approach, and we should probably go with it on
the basis that it meets our need and obviously no-one else has yet found
a need to support specialization constants at all :-).
But you could argue that a goal of the spir-v reader is to represent
everything from spir-v in llvm IR, and thus the specialization should
not be done in readSpirv(). In that case, there would need to be a
representation in IR of specialization constants. That seems difficult
to me, in that you can use a specialization constant anywhere you can
use a normal constant, including the initializer of a global variable."
A follow up discussion has concluded that we should allow the specialization constants to be passed in on the command line, however, it feels that if we could represent the spec constants in llvm using some mechanism, this would be really useful.
Contributor guide
Research direction
Start with the readSpirv() translation path and the current AMD handling of specialization values. Review the follow-up command-line approach and determine what an LLVM IR representation would need to preserve; the work is done when the representation and translation behavior are specified and validated across relevant uses.
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
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100