Skip to content

Latest commit

 

History

History
54 lines (45 loc) · 2.46 KB

README.md

File metadata and controls

54 lines (45 loc) · 2.46 KB

r2-sim

r2-sim is a performance simulator of Radiance 2, a hierarchical accelerator. Each node of Radiance 2 has a Neutrino: a scalar core that runs programs, with tables that track their tasks and the dependencies between them. The tasks run on DMA engines, tensor units (Atlas) and SIMT cores (Muon). The specifications are in docs/: the simulator (r2sim.pdf), the Neutrino (neutrino.pdf) and the architecture (radiance2.pdf).

Quick start

Install pixi, then from the repository root (with Rust 1.85 or later already installed, cargo build --release replaces pixi run build):

pixi run build
mkdir -p out
target/release/r2sim run --config configs/2p-smem.yaml --program rv \
  --image crates/nu-rv/tests/fixtures/rv/hello.toml \
  --stats out/hello.json --trace-out out/hello

--program rv runs the RV64 program in the IMEM of the root node. The memory image hello.toml loads the program hello.bin into that IMEM. The program copies two 128 x 128 bf16 tiles from the DRAM of a cluster into the SMEM of an SM, multiplies them on the Atlas of that SM, and copies the product back. The main configuration, configs/2p.yaml, has a tensor memory in every SM, and its Atlas reads its operands from that memory; the hello image keeps its operands in the SMEM, so it runs on configs/2p-smem.yaml. The run prints its end cycle and writes:

  • out/hello.json: the statistics of the run;
  • out/hello/: the trace, as CSV and JSON files (tasks.csv.gz has one row per task, resources.csv.gz the use of each resource over time).

An RV program is an image of the Neutrino ABI: RV64IMC code with the nu.* instructions, which invoke task descriptors (Neutrino specification, Sections 4 and 5). The README in crates/nu-rv/tests/fixtures/rv/ describes the test images and their sources. The calibration programs, which compare the model with measurements on a card, are the RV programs calib-micro and calib-kernels of r2-toolchain (examples/calib-micro and examples/calib-kernels).

pixi run test runs the tests.

The tests include the ISA tests of the Neutrino scalar core (RV64IMC, Zicsr and the nu.* instructions) on its instruction-set simulator, nu-iss. They come from the r2-isa-tests repository, the submodule isa-tests: git submodule update --init --recursive isa-tests fetches them. The crate nu-isa-test builds them with clang and lld, which the pixi environment provides, so run these tests under pixi run.