Introduction
Bend is a programming language by HigherOrderCO that runs on massively parallel hardware like GPUs without requiring explicit thread management. Programs written in a Python-like syntax are automatically parallelized through interaction net reduction, turning any compatible algorithm into a parallel workload.
What Bend Does
- Executes high-level functional code on GPUs with automatic parallelism
- Eliminates manual thread, mutex, and synchronization boilerplate
- Supports pattern matching, algebraic data types, and folds
- Compiles via the HVM2 runtime for interaction net evaluation
- Scales performance linearly with available cores
Architecture Overview
Bend compiles source code into interaction nets, a graph-based model of computation where independent reductions happen simultaneously. The HVM2 runtime schedules these reductions across GPU threads or CPU cores. Because interaction nets are inherently parallel, any algorithm expressible as a fold or recursive traversal benefits from hardware concurrency without code changes.
Self-Hosting & Configuration
- Install via
cargo install bend-lang(requires Rust toolchain) - GPU execution needs CUDA-compatible hardware and drivers
- Run programs with
bend run(CPU) orbend run-cu(GPU) - No configuration files needed; all options are CLI flags
- Build from source via
git cloneandcargo build --release
Key Features
- Python-like syntax with functional semantics
- Automatic parallelism without any concurrency primitives
- Near-linear speedup on multi-core CPUs and GPUs
- Built-in support for algebraic data types and folds
- Open-source HVM2 runtime written in Rust and CUDA
Comparison with Similar Tools
- CUDA/OpenCL — require manual kernel programming; Bend auto-parallelizes high-level code
- Futhark — functional GPU language but more array-oriented; Bend supports recursive structures
- Haskell — lazy evaluation with limited auto-parallelism; Bend's interaction nets parallelize aggressively
- Chapel — parallel language for HPC; Bend targets a broader audience with simpler syntax
- Mojo — focuses on Python-compatible AI performance; Bend focuses on general parallel computation
FAQ
Q: Do I need a GPU to run Bend? A: No. Bend runs on multi-core CPUs as well. GPU execution via CUDA is optional for greater speedup.
Q: What kinds of programs benefit most? A: Recursive algorithms, tree traversals, and fold-based computations see the greatest parallel speedups.
Q: Is Bend production-ready? A: Bend is experimental. It demonstrates a novel approach to parallelism and is evolving rapidly.
Q: How does Bend relate to HVM? A: HVM2 is the runtime that executes Bend programs. Bend is the high-level language; HVM2 handles the parallel reduction.