test/heap_test.bend source
test/heap_test.bend on the hub · documented module
# Heap.home after GPU work: runs a `!` call (so the heap is CUDA managed memory), then moves the heap home twice and# prints what each call covered. Build: bend heap_test.bend -o heap_test && HEAP_TRACE=1 ./heap_testimport Baseimport ../heap.bend as HPdef pow2(+n: Nat) -> U32: match n: case 0n: 1 case 1n+p: a b = pow2(p) pow2(p) (a + b : U32)def main() -> IO(Unit): do IO<Unit>: IO.print("GPU: " ++ U32.show(pow2!(16n))) a : U32 <- HP.Heap.home(0) b : U32 <- HP.Heap.home(256) IO.print("Heap.home: " ++ U32.show(a) ++ " MiB, then " ++ U32.show(b) ++ " MiB")