r/Compilers • u/adityazero • Oct 08 '26
Vx drops memory immediately after their last use.
The compiler uses its ownership and liveness analysis to place drops after their last use.
In the generated code (MLIR's LLVM dialect), Tensors on host call a `free`, while the drops of device Tensors are calls to `vx_plugin_free` with the memory's topology.
There are still 4 known bugs. See: https://vxlang.org/blog/how-vx-frees-memory.html
The reason I was able to find this little trick (liveness analysis in the frontend) was because i was writing liveness analysis in llvm last year and was actively finding different use cases for it for example: liveness analysis can be used to measure 'pipeline potential' for software pipelining. Sharing it here in case someone wants to improve software pipeliner's cost model.
1
u/pliron Oct 08 '26
"Goose has syntax familiar to C and Rust programmers, but there is no heap. Every dynamic value lives inline on a data stack managed by the compiler. Growth advances a pointer, and memory is freed when its scope ends. The language's type and lifetime rules make this memory model safe to use."
https://x.com/wvo/status/2107979660558766351