Environment variables
FHElium reads the environment variables that configure the machine and deployment of a process through fhelium.knobs. Each attribute of that module reads its variable when it is accessed; assigning the attribute overrides the variable for the current process, and deleting it returns to the variable. Build variables are read by CMake when libfhelium and the compiler extension are built from source.
Runtime
| Variable | fhelium.knobs attribute | Values | Effect |
|---|---|---|---|
FHELIUM_CACHE_DIR | cache_dir | Directory; "", 0 or off | Root of the persistent compile cache. cache=True stores entries under <root>/mlir, with ~/.cache/fhelium as the root when the variable is unset; "", 0 and off disable persistence for cache=True. A directory passed as cache= is used directly. |
FHELIUM_COMPILE_DISABLE | compile_disable | 1, true, yes or on | Calls of compiled callables (fhelium.compile) run their source functions, so their operations execute in Eager mode and no specialization is prepared. |
FHELIUM_LOG | log | Comma-separated components | compile logs one record per prepared specialization on the fhelium.compile logger. |
FHELIUM_COMPILE_THREADS | compile_threads | Positive integer | Worker threads of the pool that compiles Triton kernels concurrently while a function is linked. Without the variable the pool uses the ThreadPoolExecutor default. The pool is created at the first kernel compilation of the process. |
FHELIUM_COMPILE_DISABLE applies to calls of compiled callables. prepare and refresh_materials of a compiled callable, fhelium.compile.export, loaded artifacts (fhelium.compile.load) and manually composed capture and link pipelines prepare and run compiled schedules as usual, because their results are compiled specializations or artifacts.
With FHELIUM_LOG=compile, each record names the function, its ready seconds and the cache layer that supplied the specialization: source (an entry found by the source key before capture), trace (an entry found by the captured module) or miss (compiled in the process; disabled or the reason the source is not identified follows). When the fhelium.compile logger has no handler, a standard-error handler is attached; an application can configure the logger with Python logging instead. The first call of each specialization ends with a synchronization of the device's current stream, so its compute seconds include the device execution; without the component the first call does not synchronize. The ready seconds are the sum of the preparation stages and are divided into five categories, which CompiledCallable.stats() reports for each specialization under categories:
| Category | Stages |
|---|---|
compile | Source identification, capture, cache lookup and store, the pass pipeline, lowering, linking without its operation tables, schedule translation and planning |
data | The preparation program that derives prepared materials, the operation tables of the link, such as key-switch and rotation tables, and the binding of stored constants |
environment | Construction of the Runner of the first call, including its arena |
compute | The first execution of the Runner |
guard | Construction of the material guard |
Distributed
| Variable | fhelium.knobs attribute | Default | Effect |
|---|---|---|---|
RANK | rank | 0 | Global rank that fhelium.distributed.init() passes to the process group when rank is not given |
WORLD_SIZE | world_size | 1 | Process count that fhelium.distributed.init() passes to the process group when world_size is not given |
LOCAL_RANK | local_rank | 0 | Node-local rank that selects the CUDA device of fhelium.distributed.init() when device_id is not given |
torchrun sets these variables for each process it launches.
Build
Source builds read the following environment variables:
| Variable | Effect |
|---|---|
CMAKE_ARGS | CMake options of the source build, such as the options in the next table |
CMAKE_BUILD_PARALLEL_LEVEL | Number of parallel compilation jobs |
CUDAARCHS | CUDA architecture list; it takes precedence over CMAKE_CUDA_ARCHITECTURES |
CUDACXX | Path of nvcc |
CUDA_HOME, CUDA_PATH | CUDA toolkit roots searched for nvcc when CUDACXX is unset; CUDA_PATH is the Windows installer location |
FHELIUM_MLIR_DIR | lib/cmake/mlir directory of the LLVM/MLIR 23 installation that the compiler extension links; the CMake option of the same name takes precedence |
CMake options are passed through CMAKE_ARGS, for example CMAKE_ARGS="-DFHELIUM_NATIVE_BACKENDS=CPU+CUDA":
| Option | Effect |
|---|---|
FHELIUM_NATIVE_BACKENDS | Native implementation sets compiled into libfhelium: AUTO (follow the selected Torch package), CPU, CUDA, HIP, CPU+CUDA or CPU+HIP |
CMAKE_CUDA_ARCHITECTURES | CUDA architectures that replace the generated list |
CMAKE_HIP_ARCHITECTURES | HIP architectures of a ROCm build |
FHELIUM_MLIR_DIR, MLIR_DIR | lib/cmake/mlir directory of the LLVM/MLIR 23 installation that the compiler extension is built against; the build stops when none is found |