Repository navigation
diskgraph: process each layer's node types in type-id order - #100
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
Change map
|
The sampler built each layer's work queue, and the fused path its final feature flush, by iterating a hash map whose hasher is randomly seeded per sampling state, so which node type was committed first, and with it local node ids, edge order and fused feature batch order, changed from request to request. Both now go in type-id order, so the output is reproducible for a fixed random seed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
0c895ce to
3d3504b
Compare
Summary
This PR makes DiskGraph sampling output reproducible: the same request with the same
random_seednow returns the same local node ids and the same edge order every time.Problem.
Cause. In each layer,
process_layerbuilds its work queue by iteratingSamplingState::type_states, agxhashmap; the fused path's final feature flush iterates the same map. Its hasher is randomly seeded per map instance, so each pooled or freshSamplingStateiterates node types in a different order. When more than one node type is on the frontier, as in every layer after the first in a heterogeneous graph, the type processed first gets the lower local ids for the destinations they share, and its edges are emitted first.Change. The work queue and the fused path's final feature flush are both processed in node type id order. Nothing else changes.
Back-compat
Testing Done
repeated_runs_give_identical_output: two node types that both reach the same destination type in one hop; 16 fresh states per run, fused and non-fused; edges, node records and fused feature batches must be identical. It fails onmain, and also fails if only the flush is left unsorted.cargo test -p diskgraph-engine --libpasses; clippy is clean on the changed code.Checklist
🤖 Generated with Claude Code