Shokado: a C library for building compilers for GPU languages
Shokado is compiler infrastructure for GPU languages, doing for them what LLVM does for CPU languages. It is one C library without dependencies, small enough to vendor, and it is designed to be safe to run on untrusted input. It includes a structured SSA[1] IR[2], in which blocks belong to if and loop instructions rather than to a control flow graph, along with a verifier, linker, optimizer, code generators and a VM. Code is generated for SPIR-V[3], DXIL[4], AIR and GLSL with no other compiler in between. Bento is a GPU language built on Shokado that understands barriers, subgroups, uniformity and uber shaders. The optimizer includes inlining, mem2reg, CSE and rule-driven algebraic simplification, and the project says it is competitive with spirv-opt and with the highest optimization level of DXC. The host supplies memory, files and diagnostics through callbacks, and the project says no source or bytecode can crash the library, hang it or run it out of memory; an input that proves otherwise is worth up to $500 USD under the bug bounty.
Repository Shokado github.com
C library for building compilers for GPU languages: an SSA-based IR with verifier, optimizer and SPIR-V, DXIL, AIR and GLSL code generators.
Read the original shokado.orgDiscussion
Sources
-
shokado.org
Shokado GPU Compiler Infrastructure


