Phase 1 — end-to-end shader synthesis driver.
Render template → write GLSL to disk → compile to SPIR-V via
glslangValidator → cache by content hash → return SPV path
ready for Nx.Vulkan.Native.leapfrog_chain_synth/6.
Cache layout
~/.exmc/gpu_node/spv/{spec_hash}.spvwhere spec_hash = :crypto.hash(:sha256, glsl_source) |> Base.encode16(case: :lower).
Re-synthesizing the same spec is a hash-match → instant cache hit (no disk write, no glslangValidator call).
Usage
iex> spec = Nx.Vulkan.ChainShaderSpecs.beta()
iex> {:ok, spv_path} = Nx.Vulkan.Synthesis.compile(spec)
iex> push = Nx.Vulkan.ChainShaderSpecs.beta_push(1, 32, 0.05, 2.0, 5.0)
iex> Nx.Vulkan.Native.leapfrog_chain_synth(q_ref, p_ref, inv_mass_ref,
...> push, 32, spv_path)
{:ok, {q_chain, p_chain, grad_chain, logp_chain}}
Summary
Functions
Clear the SPV cache directory. Useful for tests.
Compile a %FamilySpec{} to SPIR-V on disk.
Render + compile + return both spv_path AND the rendered GLSL source. Useful for debugging — when something goes wrong post-compile (e.g. a GPU dispatch failure), you have the source string at hand.
Functions
Clear the SPV cache directory. Useful for tests.
Compile a %FamilySpec{} to SPIR-V on disk.
Returns {:ok, spv_path} on success or {:error, reason} on
glslangValidator failure.
Render + compile + return both spv_path AND the rendered GLSL source. Useful for debugging — when something goes wrong post-compile (e.g. a GPU dispatch failure), you have the source string at hand.