weir/
fixed_point_batch.rs1use crate::fixed_point_scratch::FixedPointScratch;
7
8mod ifds;
9mod live;
10mod points_to;
11mod reaching;
12mod slice;
13#[cfg(test)]
14mod tests;
15
16pub use crate::graph_layout::CsrGraph;
17
18#[derive(Clone, Debug, PartialEq)]
20pub struct FixedPointBatch<'a, F> {
21 dispatch: &'a F,
22 scratch: FixedPointScratch,
23 ifds_prepare_scratch: crate::ifds_gpu::IfdsPrepareScratch,
24 ifds_scratch: crate::ifds_gpu::IfdsSolveScratch,
25}
26
27impl<'a, F> FixedPointBatch<'a, F>
28where
29 F: Fn(&vyre::ir::Program, &[&[u8]], Option<[u32; 3]>, &mut Vec<Vec<u8>>) -> Result<(), String>,
30{
31 #[must_use]
33 pub fn new(dispatch: &'a F) -> Self {
34 Self {
35 dispatch,
36 scratch: FixedPointScratch::default(),
37 ifds_prepare_scratch: crate::ifds_gpu::IfdsPrepareScratch::default(),
38 ifds_scratch: crate::ifds_gpu::IfdsSolveScratch::default(),
39 }
40 }
41
42 #[must_use]
44 pub fn scratch(&self) -> &FixedPointScratch {
45 &self.scratch
46 }
47
48 #[must_use]
50 pub fn frontier_density(&self) -> crate::fixed_point_scratch::FrontierDensityTelemetry {
51 self.scratch.frontier_density()
52 }
53
54 #[must_use]
56 pub fn recommended_frontier_execution_mode(
57 &self,
58 ) -> crate::fixed_point_scratch::FrontierExecutionMode {
59 self.scratch.frontier_density().recommended_execution_mode()
60 }
61
62 pub fn execution_plan_for_prepared_graph(
65 &self,
66 graph: &crate::fixed_point_graph::FixedPointForwardGraph,
67 ) -> Result<crate::fixed_point_execution_plan::FixedPointExecutionPlan, String> {
68 crate::fixed_point_execution_plan::plan_prepared_graph(graph, self.frontier_density())
69 }
70
71 pub fn clear(&mut self) {
73 self.scratch.clear();
74 self.ifds_prepare_scratch.clear();
75 self.ifds_scratch.clear();
76 }
77}