Python to SPIR-V Translation
I started working on Spirthon. This far I got a SPIR-V encoder and decoder in the repository. I don't quarrantee I complete this project. Though my rationale to start the project could be interesting:
- SPIR-V and Vulkan being just out, they present convergence of GPU computing and rendering. For the first time, both compute and graphics APIs accept the same program representation.
- SPIR-V is hardware-bound rather than source language-bound representation of a program.
- For the first time GLSL is on the equal footing to any custom shader programming language.
- Specification is still provisional, so there's chance to influence to its contents. And I get to show "how is it done".
So that motivates to writing a shader language compiler. Why translate from pythons bytecode rather than from an unique language? The inspiration comes from languages that have been embedded and used inside an another language in some way:
- Regular expressions
When I was writing an interpreter in rpython, I noticed that I mostly wrote code that generated the repetitive parts of my software, rather than even trying to code it all myself. Writing it was beneficial in python even if the source bytecode was required to be restricted.
Also, I have wanted to write such a translator since I tried out RPython.