dasSpirv: base value/vector/matrix/swizzle emit machinery - #3522
Merged
Conversation
added 2 commits
July 20, 2026 17:15
…owering of a[i]) so value-composite indexing compiles under JIT
borisbat
added a commit
that referenced
this pull request
Jul 21, 2026
dasSpirv: resource & stage bindings (stacked on #3522)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the first in a small stacked series that fills out the
dasSpirvdaslang → SPIR-V emitter. It adds the general-purpose base machinery —
the scalar / vector / matrix / struct value core that the later layers
(resource & stage bindings; the fp16/int16/fp64 lattice lowering) build on.
What it adds
structused as a localvar(its ownFunction-storage
OpVariable), as a function parameter and as a functionresult (
OpFunctionParameter/ return), undecorated; field reads lower toOpCompositeExtract(or through the local's pointer). A declared localzero-inits via
OpConstantNull.floatCxR(col0..colN)builds a matrixfrom its columns in one
OpCompositeConstruct; a column readm[i]is anOpCompositeExtract; and the three products stay distinct —OpMatrixTimesVector(m * v),OpVectorTimesMatrix(v * m),OpMatrixTimesMatrix(m * m). A module-scope const-columnletmatrixfolds to
OpConstantComposite.g.xyz = vlowers to load /OpVectorShuffle/store.
vec == vec/vec != vecreduced throughOpAll/OpAnyrather than a scalar compare.intBitsToFloat/floatBitsToInt&co →OpBitcast;mod/fmod→OpFMod; plus const arrays and vectorindex / shift.
Compiler fix (
src/ast/ast_inline.cpp)A bare (non-
R2V) variable reference is an lvalue — a reference tostorage, and storage identity is stable for both a local and a global — so
it is inline-pure; only a global's value read (the
R2Vcase) can changemid-inline and is snapshotted (kept impure). Without this, a global array
being indexed inside an inlined call hoists into a local dynamic-array temp,
which the SPIR-V backend cannot represent.
Tests (
tests/spirv)Value structs & local structs, matrix constructors & products, write-swizzle,
whole-vector compare, bit-cast,
fmod, const arrays, vector index / shift,plus fail-closed fixtures (a non-constant matrix column index; a nested local
struct var). All are
spirv-val-clean wherespirv-valis available in CI.Follow-ups in the stack
Resource & stage bindings (samplers, storage images, SSBOs, descriptor
arrays, subgroups, inline ray-query, workgroup size, fragment barycentrics,
mesh output), then the fp16 / int16 / fp64 lattice lowering.