Skip to main content

Module runtime

Module runtime 

Source
Expand description

The XLA runtime: PJRT clients and the cache of compiled functions.

Jitted functions run on one platform per process:

  • set_platform sets it explicitly;
  • otherwise, the environment variable RUXLA_PLATFORM (cpu or cuda) is used;
  • otherwise, the CPU.

The plugin of a platform is taken from set_plugin_path, then from RUXLA_PJRT_CPU_PLUGIN or RUXLA_PJRT_CUDA_PLUGIN, then from the directory RUXLA_PJRT_PLUGIN_DIR (Platform::plugin_file: libpjrt_cpu.so, libpjrt_cpu.dylib on macOS, xla_cuda_plugin.so), where scripts/fetch-pjrt-plugins.sh can put them. Without any of these:

  • the cache RUXLA_CACHE_DIR/pjrt (or ~/.cache/ruxla/pjrt);
  • for CUDA on Linux, the plugin of the JAX installed for Python (jax[cuda13] or jax[cuda12], found with RUXLA_PYTHON or python3);
  • for the CPU on x86-64 and AArch64 Linux and on Apple silicon macOS, a prebuilt plugin downloaded into the cache on first use (with curl and tar, checked against a pinned SHA-256); RUXLA_PJRT_DOWNLOAD=0 turns the download off.

On other platforms (Windows, Intel macOS, …), there is no plugin to download: XLA from Rust needs a plugin given with set_plugin_path or the variables above. Everything that does not run XLA from Rust (the Native backend, tracing, VecEnv, environments compiled ahead of time, and the export to JAX) works without a plugin.

Compiled executables are cached in memory, keyed by the platform and the serialized IR, which includes the input types.

Enums§

Error
An error of the XLA runtime.
Platform
A platform that runs jitted functions.

Functions§

client
Returns the client of a platform, creating it on first use.
platform
Returns the platform that runs jitted functions (see the module documentation).
set_platform
Sets the platform for the rest of the process.
set_plugin_path
Sets the path of the PJRT plugin of a platform.