#[cfg(test)]
use crate::dispatch_input_cache::OwnedDispatchInputs;
pub use crate::ifds_borrowed_solve::{
solve_borrowed_many_via, solve_borrowed_many_with_scratch_via, solve_borrowed_via,
solve_borrowed_with_scratch_via, solve_prepared_borrowed_into_via,
solve_prepared_borrowed_many_with_scratch_into_via,
solve_prepared_borrowed_many_with_scratch_via, solve_prepared_borrowed_via,
solve_prepared_borrowed_with_adapter_scratch_via,
solve_prepared_borrowed_with_scratch_into_via, solve_prepared_borrowed_with_scratch_via,
solve_via,
};
#[cfg(any(test, feature = "cpu-parity"))]
#[allow(deprecated)]
pub(crate) use crate::ifds_cpu_oracle::solve_cpu;
#[cfg(test)]
use crate::ifds_csr_prepare::build_exploded_csr_borrowed_into_via;
pub use crate::ifds_csr_prepare::{
prepare_ifds_csr_borrowed_via, prepare_ifds_csr_borrowed_with_scratch_via,
};
#[cfg(test)]
pub(crate) use crate::ifds_frontier_decode::ifds_words;
pub(crate) use crate::ifds_frontier_decode::try_ifds_words;
pub use crate::ifds_resident_alloc::{
allocate_resident_ifds_parallel_scratch,
allocate_resident_ifds_parallel_scratch_with_capacities,
allocate_resident_ifds_parallel_scratch_with_iterations, allocate_resident_ifds_scratch,
allocate_resident_ifds_scratch_with_seed_capacity, free_resident_ifds_parallel_scratch,
free_resident_ifds_scratch, free_resident_prepared_ifds_csr, prepare_ifds_csr_resident_via,
upload_prepared_ifds_csr_resident,
};
pub use crate::ifds_resident_solve::{
solve_resident_prepared_many_parallel_via,
solve_resident_prepared_many_parallel_with_scratch_and_host_into_via,
solve_resident_prepared_many_parallel_with_scratch_and_host_via,
solve_resident_prepared_many_parallel_with_scratch_via, solve_resident_prepared_many_via,
solve_resident_prepared_many_with_scratch_and_host_into_via,
solve_resident_prepared_many_with_scratch_into_via,
solve_resident_prepared_many_with_scratch_via, solve_resident_prepared_via,
};
pub use crate::ifds_resident_types::{
IfdsBorrowedSolveScratch, IfdsPrepareScratch, IfdsResidentDispatch, IfdsSolveScratch,
PreparedIfdsCsr, ResidentIfdsHostScratch, ResidentIfdsParallelHostScratch,
ResidentIfdsParallelScratch, ResidentIfdsScratch, ResidentPreparedIfdsCsr,
};
pub use crate::ifds_shape::validate_ifds_problem;
pub use crate::ifds_shape::IfdsShape;
use vyre_foundation::ir::Program;
use vyre_primitives::graph::csr_forward_traverse::csr_forward_traverse;
#[cfg(test)]
use vyre_primitives::graph::exploded::{MAX_BLOCK_ID, MAX_FACT_ID, MAX_PROC_ID};
use vyre_primitives::graph::program_graph::ProgramGraphShape;
pub const OP_ID: &str = "weir::ifds_gpu";
inventory::submit! {
vyre_harness::OpEntry::new(
OP_ID,
|| {
csr_forward_traverse(
ProgramGraphShape::new(4, 3),
"fin",
"fout",
u32::MAX,
)
},
Some(|| {
let to_bytes = crate::dispatch_decode::pack_u32;
vec![vec![
to_bytes(&[0, 0, 0, 0]),
to_bytes(&[0, 1, 2, 3, 3]),
to_bytes(&[1, 2, 3]),
to_bytes(&[1, 1, 1]),
to_bytes(&[0, 0, 0, 0]),
to_bytes(&[0b0001]),
to_bytes(&[0b0001]),
]]
}),
Some(|| {
let to_bytes = crate::dispatch_decode::pack_u32;
vec![vec![to_bytes(&[0b0011])]]
}),
).with_category("dataflow")
}
inventory::submit! {
vyre_harness::ConvergenceContract {
op_id: OP_ID,
max_iterations: 128,
}
}
#[cfg(test)]
#[path = "ifds_gpu_tests.rs"]
mod ifds_gpu_tests;
pub fn ifds_gpu_step(
shape: IfdsShape,
frontier_in: &str,
frontier_out: &str,
) -> Result<Program, String> {
if !shape.fits() {
return Err(format!(
"Fix: ifds_gpu_step dimensions exceed 32-bit exploded-node encoding: procs={} blocks={} facts={}",
shape.num_procs, shape.blocks_per_proc, shape.facts_per_proc
));
}
let domain = shape.node_domain()?;
let pg_shape = ProgramGraphShape::new(domain.element_count(), shape.edge_count);
Ok(csr_forward_traverse(
pg_shape,
frontier_in,
frontier_out,
u32::MAX,
))
}
pub fn ifds_gpu(
_exploded_adj: &str,
frontier_in: &str,
frontier_out: &str,
) -> Result<Program, String> {
ifds_gpu_step(
IfdsShape {
num_procs: 1,
blocks_per_proc: 1,
facts_per_proc: 1,
edge_count: 1,
},
frontier_in,
frontier_out,
)
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct IfdsGpu;
impl super::soundness::SoundnessTagged for IfdsGpu {
fn soundness(&self) -> super::soundness::Soundness {
super::soundness::Soundness::Exact
}
}
impl super::soundness::SoundnessTagged for IfdsShape {
fn soundness(&self) -> super::soundness::Soundness {
super::soundness::Soundness::Exact
}
}
#[cfg(test)]
#[allow(deprecated)]
#[path = "ifds_gpu_core_tests/mod.rs"]
mod tests;
#[cfg(test)]
#[path = "ifds_resident_solve_tests/mod.rs"]
mod resident_tests;