Expand description
Exploded-supergraph builder - (CFG × fact) pairs as graph vertices
so IFDS/IDE reduces to csr_forward_traverse.
Exploded supergraph primitive (G3).
§What this is
IFDS / IDE reframes interprocedural dataflow as a reachability
problem on the exploded supergraph: each (proc, block, fact) triple is a graph vertex, and the edges are the flow
functions (GEN / KILL + summary + call-to-return). Once
expanded, the analysis collapses to a BFS over this graph -
which is the exact shape
crate::graph::csr_forward_traverse already handles.
This module owns the node encoding - the bit-layout that
packs (proc_id, block_id, fact_id) into a single u32 node id
- plus a CPU reference that builds the exploded CSR so tests in
vyre-libs::dataflow::ifds_gpucan prove the GPU kernel produces byte-identical CSR output.
§Bit layout
bits 31..20 proc_id (12 bits - 4096 procedures per module)
bits 19..10 block_id (10 bits - 1024 blocks per procedure)
bits 9..0 fact_id (10 bits - 1024 facts per workgroup;
matches FACTS_PER_WORKGROUP and the
NFA subgroup sizing)This deliberately leaves no room for >4096 procedures in a single module. Any real codebase that exceeds that split along a module boundary first - doing interprocedural dataflow over 10 000+ procs in one pass is a different problem that we don’t solve here and shouldn’t pretend to.
§Status
Node encoding, CSR builder, and tests. The GPU Program wrapper
(the actual kernel that walks edges in parallel) lives in
vyre-libs::dataflow::ifds_gpu and composes this encoding with
csr_forward_traverse.
Structs§
- Exploded
Ifds CpuScratch - CPU-reference CSR builder for the exploded supergraph.
- Ifds
CsrDispatch Plan - Primitive-owned dispatch plan for exploded IFDS CSR construction.
- Ifds
CsrLayout - Checked dispatch layout for an exploded IFDS CSR build.
- Ifds
CsrProgram Cache Key - Primitive-owned cache identity for exploded IFDS CSR construction Programs.
- Ifds
CsrRule Columns - Caller-owned structure-of-arrays rule columns for IFDS CSR dispatch.
- Ifds
CsrRule Input Fingerprint - Stable identity for IFDS rule tuples supplied to the CSR builder.
- Ifds
CsrStatic Input Key - Primitive-owned identity for reusable exploded IFDS static inputs.
Constants§
- BLOCK_
BITS - Bits reserved for the basic-block component of the packed node id.
- FACTS_
PER_ WORKGROUP - Number of facts per workgroup lane. A 32-lane subgroup x
32 bits = 1024 facts; wider subgroup layouts preserve the same budget.
Matches the
NFA window sizing in
nfa::subgroup_nfaso both subsystems share occupancy budget. - FACT_
BITS - Bits reserved for the fact component of the packed node id.
- IFDS_
CSR_ COL_ IDX_ BUFFER - Canonical dispatch output label for CSR column indices.
- IFDS_
CSR_ COL_ LEN_ BUFFER - Canonical dispatch output label for emitted column length.
- IFDS_
CSR_ EMPTY_ DISPATCH_ GRID - Minimum grid for empty no-rule IFDS dispatch plans.
- IFDS_
CSR_ GEN_ BLOCK_ BUFFER - Canonical dispatch input label for GEN rule blocks.
- IFDS_
CSR_ GEN_ FACT_ BUFFER - Canonical dispatch input label for GEN rule facts.
- IFDS_
CSR_ GEN_ PROC_ BUFFER - Canonical dispatch input label for GEN rule procedures.
- IFDS_
CSR_ INTER_ DST_ BLOCK_ BUFFER - Canonical dispatch input label for inter-procedural destination blocks.
- IFDS_
CSR_ INTER_ DST_ PROC_ BUFFER - Canonical dispatch input label for inter-procedural destination procedures.
- IFDS_
CSR_ INTER_ SRC_ BLOCK_ BUFFER - Canonical dispatch input label for inter-procedural source blocks.
- IFDS_
CSR_ INTER_ SRC_ PROC_ BUFFER - Canonical dispatch input label for inter-procedural source procedures.
- IFDS_
CSR_ INTRA_ DST_ BLOCK_ BUFFER - Canonical dispatch input label for intra-procedural destination blocks.
- IFDS_
CSR_ INTRA_ PROC_ BUFFER - Canonical dispatch input label for intra-procedural procedure ids.
- IFDS_
CSR_ INTRA_ SRC_ BLOCK_ BUFFER - Canonical dispatch input label for intra-procedural source blocks.
- IFDS_
CSR_ KILLED_ BUFFER - Canonical dispatch scratch label for the dense kill bitmap.
- IFDS_
CSR_ KILL_ BLOCK_ BUFFER - Canonical dispatch input label for KILL rule blocks.
- IFDS_
CSR_ KILL_ FACT_ BUFFER - Canonical dispatch input label for KILL rule facts.
- IFDS_
CSR_ KILL_ PROC_ BUFFER - Canonical dispatch input label for KILL rule procedures.
- IFDS_
CSR_ ROW_ CURSOR_ BUFFER - Canonical dispatch scratch label for row cursors.
- IFDS_
CSR_ ROW_ PTR_ BUFFER - Canonical dispatch output label for CSR row pointers.
- IFDS_
CSR_ WORKGROUP_ SIZE - Serial workgroup for exploded IFDS CSR construction.
- MAX_
BLOCK_ ID - Maximum encodable basic-block id.
- MAX_
FACT_ ID - Maximum encodable fact id.
- MAX_
PROC_ ID - Max values for each component - one less than the available space because zero is a valid id.
- OP_ID
- Canonical op id for the IFDS CSR construction program.
- PROC_
BITS - Bits reserved for each component of the packed node id.
Functions§
- build_
cpu_ reference - Returns
(row_ptr, col_idx)in the dense index spaceidx(p, b, f) = p * blocks * facts + b * facts + f. This is the space every traversal kernel operates in - packing viacrate::graph::exploded::encode_nodeis only used at the I/O boundary when the caller needs to report results as(proc, block, fact)triples. The two spaces coincide only in the degenerate caseblocks_per_proc == 1 << BLOCK_BITSandfacts_per_proc == 1 << FACT_BITS; the dense layout works for any dimensions that fit in 32-bit encoding. - build_
ifds_ csr_ program - Build a GPU Program that emits the exploded-supergraph CSR.
- canonicalize_
csr_ within_ rows - Return a row-canonical CSR copy.
- canonicalize_
csr_ within_ rows_ in_ place - Sort each CSR row in place after validating row ranges.
- decode_
node - Unpack a node id back into
(proc_id, block_id, fact_id). - dense_
to_ encoded - Convert a dense
(proc, block, fact)index - the spacebuild_cpu_reference(requires thecpu-parityfeature) operates in - into the packedencode_nodeform for reporting or cross-subsystem handoff. - encode_
node - Pack a
(proc_id, block_id, fact_id)triple into a 32-bit node id. - encoded_
to_ dense - Inverse of
dense_to_encoded. - fits
- Whether a
(proc, block, fact)triple fits in the packed 32-bit representation. Callers on the production path should verify this before callingencode_node. - ifds_
csr_ dispatch_ grid - Dispatch grid for exploded IFDS CSR construction.
- ifds_
node_ count_ checked - Checked exploded-supergraph node count.
- ifds_
node_ count_ saturating - Saturating exploded-supergraph node count for capacity planning UIs.
- ifds_
program_ cache_ key_ from_ program - Recover the exploded IFDS program cache key baked into a generated CSR
builder
Program. - max_
ifds_ col_ count - Maximum column count needed by the deterministic IFDS CSR builder.
- plan_
ifds_ csr_ dispatch - Validate caller-owned IFDS rules and return the complete primitive dispatch plan.
- split_
ifds_ rule_ quads_ into - Split IFDS quadruple rules into primitive-owned structure-of-arrays columns.
- split_
ifds_ rule_ triples_ into - Split IFDS triple rules into primitive-owned structure-of-arrays columns.
- try_
build_ cpu_ reference - Fallible CPU-reference CSR builder for the exploded supergraph.
- try_
build_ cpu_ reference_ into - Fallible CPU-reference CSR builder into caller-owned output and scratch.
- validate_
ifds_ csr_ inputs - Validate the full IFDS CSR dispatch contract from caller-owned rule slices.
- validate_
ifds_ csr_ layout - Validate dimensions/counts and return the exact dispatch buffer layout.
- validate_
ifds_ csr_ readback - Validate CSR data returned by an exploded IFDS backend.