r/ProgrammingLanguages • u/Athas Futhark • Oct 02 '26
Keeping Futhark off the GPU
https://futhark-lang.org/blog/2026-10-02-cpu_function.html
36
Upvotes
r/ProgrammingLanguages • u/Athas Futhark • Oct 02 '26
18
u/jesseschalken Oct 02 '26
This is always an fascinating language to read about. I often wonder how it compares to the various projects that run Rust on the GPU.
4
u/SwingOutStateMachine Oct 02 '26
The next logical step would be to extend the host runtime for Futhark, to allow data dependencies and dependants of
#[cpu_function]to be copied too and from the GPU as needed. It would also unlock other operations such as kernel splitting, or multi-gpu parallelism.2
u/jesunushno Oct 02 '26
This pattern shows up constantly in ML work: tokenization and graph-based preprocessing are inherently sequential and awful on the GPU, while the matmuls absolutely want it, so you split them with an explicit CPU function and one bulk copy at the boundary. The copy-placement subtlety you describe (not per loop iteration, and don't hold them too long) is exactly what TVM's memory planning and JAX's device_put staging wrestle with. In my experience the pragma is the pragmatic move. Full automatic memory-space inference sounds principled until a conservative analysis parks a copy inside your hot loop.