Skip to content
riptide-computePublic

Latest commit

 

History

374 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Raya

One language, from the GPU kernel to the app.

riptidecompute.com/raya · Documentation · Install · Raya vs C and C++ · Every benchmark · Every change, with its test · Support Raya


Raya is a programming language, compiler and runtime from Riptide. It has sound null safety, a fast VM with hot reload for development, and ahead-of-time compilation to native code. And it goes further for the code we write every day: exact maths, values that live in registers, native SIMD, and the CPU's matrix unit, in the language.

// main.ray
data class Point(final int x, final int y);

void main() {
  final a = Point(3, 4);
  print(a);                   // Point(x: 3, y: 4)
  print(a == Point(3, 4));    // true
  print(a.copyWith(y: 5));    // Point(x: 3, y: 5)
}
raya run --enable-experiment=raya-data-classes main.ray

Source files are .ray. The core libraries are raya: (raya:core, raya:typed_data, raya:io, raya:concurrent …). The tool is raya.

What Raya offers

  • Faster than C and C++ where it counts: exact matrix maths 84× faster than C, binary-trees 1.97× faster than C++, float64 matrix multiply on one core 2.5× faster than Apple's Accelerate (1024³).
  • Exact maths in the language: whole numbers and fractions that never round, so geometry gives every answer right where C and C++ miss some.
  • The CPU's matrix unit and native SIMD, built in: no BLAS to install, no intrinsics to write.
  • Values that live in registers: value classes and data classes with no heap allocation in hot loops.
  • Fast to work in: sound null safety, hot reload while you develop, one native executable to ship.
  • Thousands of packages, ready on day one: raya add <package> downloads one and converts it to Raya.

How many times faster Raya is than C and C++: 84× on exact int8 matrix multiply at 2048³ vs C loops, 68× at 1024³, 2.5× on float64 on one core vs Apple Accelerate (1024³), 1.54× (C) and 1.97× (C++) on binary-trees, 1.66× on exact geometry, 1.38× on float32 vs Apple Accelerate (1024³), 1.25× on spectral-norm, 1.32× on a hash map vs C++

Documentation

docs/raya: getting started, the language (value classes, data classes, shared data), performance (SIMD, the matrix unit, integer loops faster than C, allocation-free loops), exact maths, the raya tool, packages, experiments and an FAQ. Every runnable sample in the docs is run by tool/raya_docs_check.sh, so the docs can't drift from the language.

Install

Raya 0.4.1 runs on macOS (Apple silicon and Intel), Linux (x64 and arm64) and Windows x64.

macOS and Linux curl -fsSL https://riptidecompute.com/raya/install.sh | sh
Windows (PowerShell) irm https://riptidecompute.com/install.ps1 | iex
Homebrew (macOS, Linux) brew install riptide-compute/tap/raya
APT (Ubuntu, Debian) sudo apt install raya from Riptide's signed APT repository: setup on riptidecompute.com/install
Scoop (Windows) scoop bucket add riptide https://github.com/riptide-compute/scoop-bucket then scoop install riptide/raya
mise mise use -g github:riptide-compute/raya@0.4.0
Download from Releases: raya-0.4.0-<os>-<arch>.zip for macos-arm64, macos-x64, linux-x64, linux-arm64 and windows-x64 (each zip holds one raya-sdk/ folder), the macOS disk images Raya-0.4.0-macos-arm64.dmg / Raya-0.4.0-macos-x64.dmg, and the Windows installer RayaSetup-0.4.0.exe; checksums in SHA256SUMS
From source see Build from source

The installers put the SDK in ~/.raya (Windows: %LOCALAPPDATA%\Raya) and add its bin to your PATH; RAYA_VERSION=0.4.0 picks a version. The SDK's bin/ holds raya (the tool), rayaaotruntime (runs AOT snapshots) and rayavm (the VM); on Windows they are raya.exe, rayaaotruntime.exe and rayavm.exe.

Libraries come through Raya's package manager:

raya create my_app      # a new project
cd my_app
raya add <package>      # add a dependency to pubspec.yaml
raya run
raya compile exe bin/my_app.ray   # one native executable

Raya vs C and C++

Apple M5 Pro, macOS 27.2.1, Apple clang 21.0.0 -O3 -mcpu=native (C++ -std=c++20), measured November 23, 2026. 15 runs of every variant in shuffled order, each started with the machine's load under 4.5; medians with 95% confidence intervals. Every result was checked: each language printed the same answer. Ratio = their time ÷ Raya's time (above 1 means Raya is faster).

Matrix maths: built into the runtime, on the CPU's matrix unit

Raya C C++ Raya is
exact int8 → int32 multiply, 1024³ 0.63 ms 42.9 ms (clang-vectorized loops) 42.0 ms 68× faster than C
exact int8 → int32 multiply, 2048³ 3.99 ms 337 ms 336 ms 84× faster than C
float64 multiply, 1024³, one core each (VECLIB_MAXIMUM_THREADS=1) 5.42 ms 13.6 ms with Apple's Accelerate on one core 121 ms (loops) 2.5× faster than Accelerate on one core
float32 multiply, 1024³ 1.18 ms 1.62 ms with Apple's Accelerate – 1.38× faster than Accelerate

Matrix multiply times in milliseconds: Raya 0.63 vs C 42.9 and C++ 42.0 (int8 1024³); 3.99 vs 337 and 336 (int8 2048³); 5.42 vs 13.6 and 121 (float64, one core each); 1.18 vs 1.62 (float32)

All 1,048,576 int8 results match C exactly. Apple's Accelerate has no int8 matrix multiply, so plain loops are what C gets out of the box; Raya calls its runtime's matrix kernels from ordinary Raya code.

Exact geometry: 8 million pairs of 3D vectors, which are within 45° of each other?

time answer
Raya, exact whole-number geometry 36.0 ms 1,179,183: every pair right
C, sqrt + acos 59.9 ms 1,179,023: misses 160 pairs at exactly 45°
C++, std::sqrt + std::acos 60.4 ms 1,179,023: misses 160 pairs

Exact geometry: Raya 0 wrong answers in 36.0 ms; C and C++ 160 wrong each, in 59.9 and 60.4 ms

Raya's exact form is 1.66× faster than C's usual form, and right. (C written with the same integer test is exact too; docs/benchmarks.md has every row.)

The classic benchmarks

Raya C C++ vs C vs C++
binary-trees, depth 18 403 ms 620 ms 794 ms (std::unique_ptr) 1.54× 1.97×
spectral-norm, n = 3000 221 ms 276 ms 276 ms 1.25× 1.25×
fannkuch-redux, n = 10 150 ms 159 ms 132 ms 1.06×
hash map, 2M keys / 8M operations 304 ms 117 ms 402 ms (std::unordered_map) 1.32×

binary-trees: Raya 403 ms, C 620, C++ 794; spectral-norm: Raya 221, C 276, C++ 276; exact geometry: Raya 36.0, C 59.9, C++ 60.4

The full table, including the benchmarks where C is still ahead today (start-up time, string building, n-body, mandelbrot, JSON), is in docs/benchmarks.md, with how each was measured.

What's in Raya

Every change is listed in RAYA_PATCHES.md with the test that guards it. A change without a guarding test isn't accepted, and main only moves when every test passes.

In main today (the full guide)

  • Value classes (@pragma('raya:value')): no identity, so vectors, rotors and fractions live in registers instead of on the heap; their fields are stored inline in other objects, one unboxed slot each.
  • Data classes: ==, hashCode, toString, copyWith and JSON (toJson / fromJson) from the primary constructor, with no code generator (--enable-experiment=raya-data-classes).
  • Allocation-free hot loops: escape analysis turns records and value classes into registers, and bounds checks are hoisted out of loops, one proven guard per loop nest.
  • Native SIMD on arm64: Float32x4, Int32x4 and Float64x2 operations become single NEON instructions, with int8 dot products, multiply-accumulate, byte table lookups and a float32 loop vectoriser.
  • The CPU's matrix unit: float32, exact int8 → int32 and int16 → int64 matrix multiply in the runtime.
  • Plain integer loops faster than C: integer loops are vectorised on arm64 and x64, and loop nests that are dot products, polynomial or matrix products, FIR filters or 2-D convolutions go to a kernel tuned for the CPU, beating gcc and clang -O3 -march=native on Graviton3/4, Sapphire Rapids, Ice Lake and Zen 4 (Integer loops, faster than C).
  • LLVM for numeric code: raya compile exe can compile numeric loops with LLVM (@pragma('raya:native')).
  • Code push for iOS: patch a released app's functions with verified bytecode, no new App Store build.
  • Shared data between isolates (raya:concurrent) on stable builds.
  • Const functions that run at compile time (--enable-experiment=raya-const-functions).
  • Packages: raya add / raya get / raya pkg, registry packages converted to Raya as they download, and build hooks that generate sources every tool sees, with no generated files in git.
  • Parallel AOT compilation: raya compile uses every core.
  • Zero failing and zero skipped tests on macOS arm64, JIT and AOT.
  • SDKs for every desktop: macOS arm64 and x64, Linux x64 and arm64, Windows x64, with a one-line installer.

Landing next

  • The IDE evaluates const function calls (hover, fixes and assists).

Written in Raya

  • Riptorch: a machine-learning framework that runs PyTorch code; its engine (tensors, autograd) is Raya. import riptorch as torch.
  • An ACPI interpreter, written from the public ACPI 6.5 specification in 4,629 lines of Raya, where the C library it replaces (uACPI) is 35,413.
  • A real-time 3D renderer on Metal and Vulkan: physically based materials, image-based lighting, soft shadows, glTF 2.0, character animation with IK, levels of detail and digital humans.
  • Physics: rigid bodies, cloth and soft bodies, fluids, finite elements and heat, orbital mechanics, and typed SI units.

Build from source

Raya's own tools are written in Raya, so building Raya needs a Raya SDK first (the bootstrap). --download fetches it from the latest GitHub release.

git clone https://github.com/riptide-compute/raya.git && cd raya
tool/raya_bootstrap.sh --download            # a released Raya SDK to build with
tool/raya_build.sh                            # builds the SDK and prints its path and version

Before a change lands, tool/raya_gate.sh builds the SDK again and runs every guarding test; see Testing.

The third-party packages are in the repository, so there is no dependency sync step. See docs/Building.md for each platform's toolchain.

Support Raya

Raya is free and open source. If it helps you, help keep it moving:

Sponsors

These spots are open. Claim one and your company's logo goes here and on riptidecompute.com/raya.

Founding Partners

Your logo here: founding spot available Your logo here: founding spot available Your logo here: founding spot available

Gold

Your logo here: gold spot available Your logo here: gold spot available Your logo here: gold spot available Your logo here: gold spot available

Silver

Your logo here: silver spot available Your logo here: silver spot available Your logo here: silver spot available Your logo here: silver spot available Your logo here: silver spot available

Bronze

Your logo here: bronze spot available Your logo here: bronze spot available Your logo here: bronze spot available Your logo here: bronze spot available Your logo here: bronze spot available Your logo here: bronze spot available

Contributing

Issues and pull requests are welcome: see CONTRIBUTING.md. Security reports go to the address in SECURITY.md.

Licence

Licence: BSD 3-Clause (LICENSE); third-party notices in licenses/.

Releases

Packages

Used by

Contributors

Languages