explaingit

higherorderco/hvm2

11,244CudaAudience · researcherComplexity · 5/5Setup · hard

TLDR

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.

Mindmap

mindmap
  root((HVM2))
    What it does
      GPU parallelism
      Interaction nets
      Compile target
    Tech stack
      CUDA
      Rust
      C
    Run modes
      Rust interpreter
      C compilation
      CUDA for GPU
    Audience
      Researchers
      Language designers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Compile programs written in the companion language Bend to run on GPU hardware without writing manual parallel code.

USE CASE 2

Use as a research compilation target for exploring massively parallel functional programming models.

USE CASE 3

Run HVM2 programs via a Rust interpreter for testing, or compile to C for production and CUDA for peak GPU performance.

USE CASE 4

Build language runtimes that take advantage of near-ideal parallelism on multi-core and GPU hardware.

Tech stack

CUDARustC

Getting it running

Difficulty · hard Time to first run · 1day+

CUDA GPU required for GPU execution path, Windows not natively supported (use WSL), requires Rust toolchain and a C compiler.

License terms are not specified in the explanation.

In plain English

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.

Copy-paste prompts

Prompt 1
I want to use the Bend language (which compiles to HVM2) to run a parallel sorting algorithm on a GPU. Help me install Bend and HVM2 on Linux, write the function, and compile it to CUDA.
Prompt 2
Explain how interaction combinators in HVM2 allow automatic parallelism and how this is fundamentally different from traditional thread-based parallel programming.
Prompt 3
I have HVM2 installed and want to compare the C-compiled path against the CUDA path for a benchmark program. Walk me through compiling and running both and interpreting the output.
Prompt 4
Help me set up HVM2 on WSL on Windows since native Windows support is not included, and verify the Rust interpreter path works correctly.
Open on GitHub → Explain another repo

← higherorderco on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.