Expand description
The XLA runtime: PJRT clients and the cache of compiled functions.
Jitted functions run on one platform per process:
set_platformsets it explicitly;- otherwise, the environment variable
RUXLA_PLATFORM(cpuorcuda) 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]orjax[cuda12], found withRUXLA_PYTHONorpython3); - 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
curlandtar, checked against a pinned SHA-256);RUXLA_PJRT_DOWNLOAD=0turns 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§
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.