KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator
Reduce resulting file size by ommiting OpName instructions
- Dominant language
- LLVM
- Stars
- 625
- Forks
- 279
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 34
Description
I've noticed that the translator generates bunch of `OpName` instructions which actually don't have any semantic impact and can safely be removed from a module. And by doing so, we can reduce size of the generated SPIR-V file.
As an example, I will take a reproducer from #357:
By default, the translator generates 1379560 bytes (~1.347 KBytes) SPIR-V binary.
If I generate input LLVM IR with `-fdiscard-value-names`, resulting SPIR-V binary will only take 1007104 bytes (~983 KBytes).
On this example, by omitting unnecessary `OpName` instructions, we can reduce the resulting binary size by ~27%.
I agree that for text representation `OpName` is still important thing and I guess that removing these instructions will reduce readability of text representation generated by SPIR-V Tools as well, but we can at least add option similar to `-fdiscard-value-names` from clang.
What do you think?
Contributor guide
Research direction
Start by reviewing the reproducer from issue #357 and the translator's handling of OpName instructions. Compare binary output with and without the proposed option, and consider the stated impact on SPIR-V Tools text output. Done means an option can omit unnecessary OpName instructions and the reported binary-size reduction is demonstrated.
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
- Mostly clear
- Newbie friendliness
- 32/100