use vyre_primitives::bitset::bitset_words;
#[must_use]
#[deprecated(
note = "reference oracle only; production code must dispatch the Weir Program on a concrete GPU backend or use weir::oracle for parity evidence"
)]
pub(crate) fn summarize_function_cpu(
fn_ast_in: &[u32],
callgraph_in: &[u32],
cached_summary_in: &[u32],
bit_count: u32,
) -> Vec<u32> {
let words = bitset_words(bit_count).max(1) as usize;
crate::dispatch_decode::require_bitset_words("summarize_function_cpu fn_ast", fn_ast_in, words)
.expect("summarize_function CPU oracle received malformed AST bitset");
crate::dispatch_decode::require_bitset_words(
"summarize_function_cpu callgraph",
callgraph_in,
words,
)
.expect("summarize_function CPU oracle received malformed callgraph bitset");
crate::dispatch_decode::require_bitset_words(
"summarize_function_cpu cached_summary",
cached_summary_in,
words,
)
.expect("summarize_function CPU oracle received malformed cached-summary bitset");
let mut out = crate::staging_reserve::reserved_vec(words, "summary CPU oracle output")
.unwrap_or_else(|error| panic!("summary CPU oracle output reservation failed: {error}"));
for idx in 0..words {
out.push(fn_ast_in[idx] | callgraph_in[idx] | cached_summary_in[idx]);
}
out
}
#[cfg(test)]
#[allow(deprecated)]
mod tests {
use super::summarize_function_cpu;
#[test]
#[should_panic(expected = "summarize_function CPU oracle received malformed AST bitset")]
fn summarize_rejects_bad_fn_ast() {
let _ = summarize_function_cpu(&[0b1, 0b0], &[0b1], &[0b1], 2);
}
#[test]
#[should_panic(expected = "summarize_function CPU oracle received malformed callgraph bitset")]
fn summarize_rejects_bad_callgraph() {
let _ = summarize_function_cpu(&[0b1], &[0b1, 0b0], &[0b1], 2);
}
#[test]
#[should_panic(
expected = "summarize_function CPU oracle received malformed cached-summary bitset"
)]
fn summarize_rejects_bad_cached_summary() {
let _ = summarize_function_cpu(&[0b1], &[0b1], &[0b1, 0b0], 2);
}
}