How Salsa works This chapter is based on the explanation given by Niko Matsakis in this video about Salsa. To find out more you may want to watch Salsa In More Depth, also by Niko Matsakis. As of November 2022, although Salsa is inspired by...
Memory management in rustc Generally rustc tries to be pretty careful how it manages memory. The compiler allocates a lot of data structures throughout compilation, and if we are not careful, it will take a lot of time and space to do so. O...
Serialization in rustc rustc has to serialize and deserialize various data during compilation. Specifically: • "Crate metadata", consisting mainly of query outputs, are serialized from a binary format into rlib and rmeta files that are outp...
Parallel compilation Tracking issue: https://github.com/rust-lang/rust/issues/113349 As of November 2024, most of the rust compiler is now parallelized. • The codegen part is executed concurrently by default. You can use the -C codegen-unit...
Rustdoc internals This page describes rustdoc's passes and modes. For an overview of rustdoc, see the "Rustdoc overview" chapter. From crate to clean In core.rs are two central items: the rustdoc::core::DocContext struct, and the rustdoc::c...
Rustdoc search Rustdoc Search is two programs: search_index.rs and search.js. The first generates a nasty JSON file with a full list of items and function signatures in the crates in the doc bundle, and the second reads it, turns it into so...
The rustdoc-html test suite This page is about the test suite named rustdoc-html used to test the HTML output of rustdoc. For other rustdoc-specific test suites, see Rustdoc test suites. Each test file in this test suite is simply a Rust so...
The rustdoc-gui test suite FIXME: This section is a stub. Please help us flesh it out! This page is about the test suite named rustdoc-gui used to test the "GUI" of rustdoc (i.e., the HTML/JS/CSS as rendered in a browser). For other rustdoc...
The rustdoc-json test suite This page is specifically about the test suite named rustdoc-json, which tests rustdoc's json output. For other test suites used for testing rustdoc, see §Rustdoc test suites. Tests are run with compiletest, and...
std::offload This module is under active development. Once upstream, it should allow Rust developers to run Rust code on GPUs. We aim to develop a rusty GPU programming interface, which is safe, convenient and sufficiently fast by default....
Installation std::offload is partly available in nightly builds for users. For now, everyone however still needs to build rustc from source to use all features of it. Build instructions First you need to clone and configure the Rust reposit...
Usage This feature is work-in-progress, and not ready for usage. The instructions here are for contributors, or people interested in following the latest progress. We currently work on launching the following Rust kernel on the GPU. To foll...
Contributing Contributions are always welcome. This project is experimental, so the documentation and code are likely incomplete. Please ask on Zulip (preferred) or the Rust Community Discord for help if you get stuck or if our documentatio...
The std::autodiff module in Rust allows differentiable programming: #![feature(autodiff)] use std::autodiff::*; // f(x) = x * x, f'(x) = 2.0 * x // bar therefore returns (x * x, 2.0 * x) #[autodiff_reverse(bar, Active, Active)] fn foo(x: f3...
Installation Most users can enable std::autodiff on their latest nightly toolchain by installing the enzyme component with rustup, if they are using one of these platforms: • Linux: with x86_64-unknown-linux-gnu or aarch64-unknown-linux-gnu...
Reporting backend crashes If after a compilation failure you are greeted by a large amount of llvm-ir code, then our enzyme backend likely failed to compile your code. These cases are harder to debug, so your help is highly appreciated. Ple...
Supported RUSTFLAGS To support you while debugging or profiling, we have added support for an experimental -Z autodiff rustc flag (which can be passed to cargo via RUSTFLAGS), which allow changing the behaviour of Enzyme, without recompilin...
TypeTrees for Autodiff What are TypeTrees? Memory layout descriptors for Enzyme. Tell Enzyme exactly how types are structured in memory so it can compute derivatives efficiently. Structure TypeTree(Vec<Type>) Type { offset: isize, // byte o...
Source Code Representation This part describes the process of taking raw source code from the user and transforming it into various forms that the compiler can work with easily. These are called intermediate representations (IRs). This proc...
Syntax and the AST Working directly with source code is very inconvenient and error-prone. Thus, before we do anything else, we convert raw source code into an Abstract Syntax Tree (AST). It turns out that doing this involves a lot of work,...