weirflow 0.1.0

GPU-first dataflow analysis primitives for Vyre and Santh compiler pipelines.
Documentation
use super::super::{DirectResidentIfdsBatch, DirectResidentIfdsGraph, DirectResidentIfdsGraphKey};
use crate::ifds_gpu::IfdsResidentDispatch;

impl<R> DirectResidentIfdsBatch<R>
where
    R: Clone,
{
    /// Solve many seed sets, preparing and caching the direct-resident CSR if
    /// needed.
    #[allow(clippy::too_many_arguments)]
    pub fn solve_many<D>(
        &mut self,
        dispatch: &D,
        num_procs: u32,
        blocks_per_proc: u32,
        facts_per_proc: u32,
        intra_edges: &[(u32, u32, u32)],
        inter_edges: &[(u32, u32, u32, u32)],
        flow_gen: &[(u32, u32, u32)],
        flow_kill: &[(u32, u32, u32)],
        seed_sets: &[&[(u32, u32, u32)]],
        max_iterations: u32,
    ) -> Result<Vec<Vec<u32>>, String>
    where
        D: IfdsResidentDispatch<Resource = R>,
    {
        let mut results = crate::staging_reserve::reserved_vec(
            seed_sets.len(),
            "direct resident IFDS result row",
        )?;
        self.solve_many_into(
            dispatch,
            num_procs,
            blocks_per_proc,
            facts_per_proc,
            intra_edges,
            inter_edges,
            flow_gen,
            flow_kill,
            seed_sets,
            max_iterations,
            &mut results,
        )?;
        Ok(results)
    }

    /// Solve many seed sets with a borrowed graph view, preparing and caching
    /// the direct-resident CSR if needed.
    pub fn solve_many_with_graph_view<D>(
        &mut self,
        dispatch: &D,
        graph: DirectResidentIfdsGraph<'_>,
        seed_sets: &[&[(u32, u32, u32)]],
        max_iterations: u32,
    ) -> Result<Vec<Vec<u32>>, String>
    where
        D: IfdsResidentDispatch<Resource = R>,
    {
        let mut results = crate::staging_reserve::reserved_vec(
            seed_sets.len(),
            "direct resident IFDS graph-view result row",
        )?;
        self.solve_many_with_graph_view_into(
            dispatch,
            graph,
            seed_sets,
            max_iterations,
            &mut results,
        )?;
        Ok(results)
    }

    /// Solve many seed sets with a precomputed graph key, preparing and
    /// caching the direct-resident CSR if needed.
    #[allow(clippy::too_many_arguments)]
    pub fn solve_many_with_graph_key<D>(
        &mut self,
        dispatch: &D,
        graph_key: DirectResidentIfdsGraphKey,
        num_procs: u32,
        blocks_per_proc: u32,
        facts_per_proc: u32,
        intra_edges: &[(u32, u32, u32)],
        inter_edges: &[(u32, u32, u32, u32)],
        flow_gen: &[(u32, u32, u32)],
        flow_kill: &[(u32, u32, u32)],
        seed_sets: &[&[(u32, u32, u32)]],
        max_iterations: u32,
    ) -> Result<Vec<Vec<u32>>, String>
    where
        D: IfdsResidentDispatch<Resource = R>,
    {
        let mut results = crate::staging_reserve::reserved_vec(
            seed_sets.len(),
            "direct resident IFDS graph-key result row",
        )?;
        self.solve_many_with_graph_key_into(
            dispatch,
            graph_key,
            num_procs,
            blocks_per_proc,
            facts_per_proc,
            intra_edges,
            inter_edges,
            flow_gen,
            flow_kill,
            seed_sets,
            max_iterations,
            &mut results,
        )?;
        Ok(results)
    }
}