Phase 1 — templated GLSL shader synthesis.
Renders a chain shader from a per-family spec. The template skeleton is ~80 lines of GLSL identical across families (push-constants, bindings, per-thread state, leapfrog control flow, parallel reduction). The spec fills in three holes:
push_fields— additional push-constant scalarsgrad_expr(qi)—dlogp/dqformula referencing the positionqilogp_expr(qi)— per-element log-density contributionlogp_final— how the workgroup-reduced sum becomes theper-step `logp_chain[k]` (e.g. add a constant host-side normalizer × n)
Call render/1 with a %FamilySpec{} to get a GLSL source string.
Pipe to Nx.Vulkan.Synthesis.compile/2 to land SPIR-V on
disk + load via Vulkan.
See Nx.Vulkan.ChainShaderSpecs for the catalog of family specs.
Summary
Functions
Render a %FamilySpec{} to GLSL source.