gitmyhub

HVM2

Cuda ★ 11k updated 1y ago

A massively parallel, optimal functional runtime in Rust

A low-level runtime that runs programs on GPUs by distributing computation across thousands of processors simultaneously using interaction combinators, designed as a compile target for high-level languages, not written by hand.

CUDARustCsetup: hardcomplexity 5/5

Higher-order Virtual Machine 2 (HVM2) is a runtime system that runs programs on massively parallel hardware such as GPUs. It is built around a theoretical model of computation called interaction combinators, which allows work to be spread across thousands of processors simultaneously with near-ideal efficiency.

The practical goal is to let programs written in high-level languages like Python or Haskell run on GPU hardware without the programmer having to write manual parallel code. Those languages compile down to HVM2's internal representation, and HVM2 handles distributing the computation in parallel.

HVM2 is a low-level compile target, not a language designed for humans to write directly. Its syntax describes "interaction nets," which are the internal wiring structures of computations. The README is explicit about this: the raw syntax is intentionally unreadable. The companion project Bend is the human-facing language that compiles to HVM2, and is what most users would work with instead.

Programs can be run through a Rust interpreter, compiled to C, or compiled to CUDA for GPU execution. The C compilation path is recommended for production use because the CUDA path offers higher peak performance but is described as less stable. Windows is not directly supported, but the README suggests using WSL as a workaround.

HVM2 is the second generation of this project, replacing HVM1 from 2022. It is described as simpler, faster, and more correct than its predecessor. The company HigherOrderCO provides long-term support for features documented in the accompanying research paper.

Where it fits