Expand description
SPIR-V binary emitter for vyre KernelDescriptor.
Substrate parity strategy: route the descriptor through
vyre-emit-naga to get a naga::Module, then use
naga::back::spv::Writer to produce a SPIR-V binary. This shares
the lossless lowering work with the wgpu/naga path - both backends
see the exact same naga::Module - and avoids forking a second
KernelOp → SPIR-V translation table.
§Op coverage
Inherits from vyre-emit-naga. Anything that emit-naga refuses
also fails here. Anything emit-naga accepts gets converted to a
valid SPIR-V binary if naga’s spv-out can lower it (essentially
everything except SPIR-V-specific extensions naga doesn’t model).
§Validation gate
naga::valid::Validator runs before naga::back::spv::Writer, so
any invalid module is rejected at the boundary. The emitted SPIR-V
binary is guaranteed to satisfy SPIR-V’s structural requirements
per naga’s spec compliance. Optional external spirv-val validation
sits in the integration-test surface (added when CI has spirv-tools).
Re-exports§
pub use anchor_dfa_offload::SpirvAnchorDfaOffloadEvidence;pub use anchor_dfa_offload::SPIRV_ANCHOR_DFA_OFFLOAD_SCHEMA_VERSION;
Modules§
- anchor_
dfa_ offload - SPIR-V anchor-DFA offload evidence. SPIR-V anchor-DFA offload evidence.
- patterns
- SPIR-V-specific emit-time patterns.
Enums§
Constants§
- SPIRV_
MAGIC - SPIR-V magic number -
0x07230203per the spec. Useful for integration tests and consumer-side sanity checks.
Functions§
- emit
- Emit a SPIR-V binary from a
KernelDescriptor. - emit_
bytes - Convenience: emit SPIR-V as raw little-endian bytes (the form most runtime loaders accept directly).
- emit_
from_ naga_ module - Lower-level entry: emit SPIR-V from a pre-built naga::Module.
Useful when callers want to apply naga-level analyses or rewrites
between
vyre-emit-naga::emitand SPIR-V conversion. - emit_
optimized - Emit a SPIR-V binary from an optimized form of
desc- runs the full vyre rewrite stack before lowering. Recommended overemitfor production use. - emit_
optimized_ bytes - Like
emit_bytesbut runs the optimization pipeline first. Recommended for production loaders that want minimal SPIR-V binary size + already-optimized contents. - emit_
optimized_ bytes_ with_ stats - Combined optimization + bytes + stats.
- emit_
optimized_ with_ stats - Like
emit_optimizedbut also returnsvyre_lower::rewrites::OptimizationStats.