cpu_cache/
cpu_cache.rs

1use custos_math::{
2    custos::{Ident, CPU},
3    Matrix,
4};
5
6fn main() {
7    let device = CPU::new();
8
9    let a = Matrix::<i16>::new(&device, (100, 100));
10    let b = Matrix::<i16>::new(&device, (100, 100));
11
12    let out = a + b;
13    let ptr = {
14        let cache = device.cache.borrow();
15        let mut node = Ident::new(100 * 100);
16        node.idx = 0;
17        cache.nodes.get(&node).unwrap().ptr
18    };
19
20    assert!(ptr == out.as_buf().ptr.ptr as *mut u8);
21}