use crate::events::{CircuitNodeMeta, LayerKind, ProofEvent};
#[derive(Debug, Clone)]
pub struct CircuitLayerDesc {
pub layer_idx: usize,
pub node_id: usize,
pub kind: LayerKind,
pub input_shape: (usize, usize),
pub output_shape: (usize, usize),
pub trace_cost: usize,
pub input_layers: Vec<usize>,
}
pub fn circuit_compiled_event(
layers: &[CircuitLayerDesc],
total_layers: usize,
input_shape: (usize, usize),
output_shape: (usize, usize),
) -> ProofEvent {
let nodes: Vec<CircuitNodeMeta> = layers
.iter()
.map(|l| CircuitNodeMeta {
layer_idx: l.layer_idx,
node_id: l.node_id,
kind: l.kind,
input_shape: l.input_shape,
output_shape: l.output_shape,
trace_cost: l.trace_cost,
input_layers: l.input_layers.clone(),
})
.collect();
ProofEvent::CircuitCompiled {
total_layers,
input_shape,
output_shape,
nodes,
has_simd: false,
simd_num_blocks: 0,
}
}
pub fn matmul_trace_cost(m: usize, k: usize, n: usize) -> usize {
let raw = m * k * n;
raw.next_power_of_two()
}