MCPcopy Create free account
hub / github.com/YuminosukeSato/ironkernel / eval_elementwise

Function eval_elementwise

src/ir/compiler.rs:42–48  ·  view source on GitHub ↗

Evaluate an elementwise expression over input arguments, producing a new Buffer. Compilation results are cached by expression structure via [`CompileCache`]. Expressions without `Select` use the flat interpreter. Expressions with `Select` use a lazy tree evaluator so dead branches are not evaluated.

(expr: &Expr, args: &[ArgValue])

Source from the content-addressed store, hash-verified

40/// Expressions without `Select` use the flat interpreter.
41/// Expressions with `Select` use a lazy tree evaluator so dead branches are not evaluated.
42pub fn eval_elementwise(expr: &Expr, args: &[ArgValue]) -> ParsecResult<Buffer> {
43 let program = global_cache().get_or_compile(expr);
44 match program.as_ref() {
45 CompiledProgram::Flat(flat) => crate::ir::flat::eval_flat_elementwise(flat, args),
46 CompiledProgram::LazyTree(tree) => crate::ir::evaluator::eval_lazy_elementwise(tree, args),
47 }
48}
49
50fn contains_select(expr: &Expr) -> bool {
51 match expr {

Callers 15

execute_mapFunction · 0.85
saxpy_basicFunction · 0.85
saxpy_1m_elementsFunction · 0.85
elementwise_infFunction · 0.85
elementwise_one_div_zeroFunction · 0.85
elementwise_sqrt_negFunction · 0.85
elementwise_empty_bufferFunction · 0.85
select_reluFunction · 0.85

Calls 4

global_cacheFunction · 0.85
eval_flat_elementwiseFunction · 0.85
eval_lazy_elementwiseFunction · 0.85
get_or_compileMethod · 0.80

Tested by 15

saxpy_basicFunction · 0.68
saxpy_1m_elementsFunction · 0.68
elementwise_infFunction · 0.68
elementwise_one_div_zeroFunction · 0.68
elementwise_sqrt_negFunction · 0.68
elementwise_empty_bufferFunction · 0.68
select_reluFunction · 0.68