use super::super::*;
use super::support::{traversal_graph, RecordingResidentDispatcher};
use vyre_primitives::graph::adaptive_traverse::{
adaptive_four_russians_dense_step, adaptive_sparse_dense_step,
};
#[test]
fn the_sparse_dense_release_path_dispatches_the_primitive_traversal_program() {
let dispatcher = RecordingResidentDispatcher::default();
let graph = ResidentAdaptiveTraversalGraph {
..traversal_graph()
};
let mut scratch = AdaptiveTraversalResidentScratch::default();
let mut frontier_out = Vec::new();
adaptive_traverse_resident_graph_step_with_scratch_into(
&dispatcher,
&graph,
&[1, 0],
u32::MAX,
25,
&mut scratch,
&mut frontier_out,
)
.expect("Fix: recording dispatcher should complete the sparse/dense resident sequence");
let expected = adaptive_sparse_dense_step(
"frontier_in",
"frontier_out",
"frontier_popcount",
"edge_offsets",
"edge_targets",
"edge_kind_mask",
"adj_rows_dense",
graph.node_count,
graph.edge_count,
u32::MAX,
25,
)
.fingerprint();
let launched = dispatcher.last_step_programs();
assert_eq!(
launched.len(),
3,
"sparse/dense step must launch clear, popcount, and traverse"
);
assert_eq!(
launched[2], expected,
"the traversal Program the release path launches must be the one \
vyre-primitives::graph::adaptive_traverse::adaptive_sparse_dense_step builds"
);
}
#[test]
fn the_four_russians_release_path_dispatches_the_primitive_dense_program() {
let dispatcher = RecordingResidentDispatcher::default();
let graph = ResidentAdaptiveFourRussiansDenseGraph {
node_count: 33,
words: 2,
layout_hash: 11,
lut_handle: 203,
};
let mut scratch = AdaptiveTraversalResidentScratch::default();
let mut frontier_out = Vec::new();
adaptive_traverse_resident_graph_four_russians_dense_step_with_scratch_into(
&dispatcher,
&graph,
&[1, 0],
&mut scratch,
&mut frontier_out,
)
.expect("Fix: recording dispatcher should complete the Four-Russians dense step");
let expected = adaptive_four_russians_dense_step(
"frontier_in",
"four_russians_tile_lut",
"frontier_out",
graph.node_count,
)
.fingerprint();
assert_eq!(
dispatcher.last_step_programs(),
vec![expected],
"the Four-Russians dense step must launch exactly the Program \
vyre-primitives::graph::adaptive_traverse::adaptive_four_russians_dense_step builds"
);
}