Expand description
Memory estimation for tensor expressions.
This module provides tools for estimating the memory footprint of compiled tensor expressions. This is useful for:
- Planning batch sizes
- Deciding on execution strategies
- GPU memory allocation
- Optimization decisions
§Usage
use tensorlogic_compiler::optimize::{estimate_memory, MemoryEstimate};
use tensorlogic_compiler::CompilerContext;
use tensorlogic_ir::{TLExpr, Term};
let mut ctx = CompilerContext::new();
ctx.add_domain("Person", 1000);
ctx.add_domain("Thing", 500);
let expr = TLExpr::pred("knows", vec![Term::var("x"), Term::var("y")]);
let estimate = estimate_memory(&expr, &ctx);
println!("Estimated memory: {} bytes", estimate.total_bytes);
println!("Peak memory: {} bytes", estimate.peak_bytes);Structs§
- Memory
Estimate - Detailed memory estimate for an expression.
Functions§
- estimate_
batch_ memory - Estimate memory for a batch of similar expressions.
- estimate_
memory - Estimate memory usage for an expression.