The first releases of the Bend project have been published, developing a high-level programming language for parallel computing, positioned as an alternative to low-level languages like CUDA and Metal, featuring expressive syntax and development convenience typically seen in languages like Python and Haskell. The project code is written in Rust and is distributed under the Apache 2.0 license.
Among the features of the Bend language are rapid object distribution, the ability to use higher-order functions, closures, continuations, unlimited recursion, pattern matching, recursive matches (folds), and loops (bends), as well as integer, string, and list types. Two syntax styles are supported — Python style and Haskell style. Programs do not require management annotations for parallelization, explicit thread creation, or locking. Parallelization is performed automatically; for example, when evaluating the expression ‘((1 + 2) + (3 + 4))’, the operations ‘1 + 2’ and ‘3 + 4’ will be executed in parallel.
Programs written in Bend can run on hardware that supports massive parallelism, such as GPUs, demonstrating nearly linear performance growth depending on the number of computational cores. Bend code is compiled to a low-level intermediate representation called HVM2 (Higher-order Virtual Machine 2), which is then compiled to C and CUDA representation. Currently, the project only supports execution on NVIDIA GPUs.
Regarding performance, a test application implementing bitonic sorting was completed in 12.15 seconds when run in a single thread on an Apple M3 Max CPU, in 0.96 seconds with 16 threads, and in 0.21 seconds using an NVIDIA RTX 4090 GPU with 16,000 threads. def sort(d, s, tree): switch d: case 0: return tree case _: (x,y) = tree lft = sort(d-1, 0, x) rgt = sort(d-1, 1, y) return rots(d, s, lft, rgt) def rots(d, s, tree): switch d: case 0: return tree case _: (x,y) = tree return down(d, s, warp(d-1, s, x, y)) …
Source: opennet.ru
