Environment Variables¶
RBLN PyTorch reads its configuration from environment variables. TORCH_RBLN_* variables belong to torch-rbln; RBLN_* variables in the device-mapping group belong to the RBLN runtime and are documented here because torch-rbln interprets them. Set variables before the process starts unless a row says the variable is read at runtime.
When a variable is read matters:
| Read at | Meaning | Variables |
|---|---|---|
| Import time | Read once when import torch loads the extension | TORCH_RBLN_LOG_LEVEL, TORCH_RBLN_LOG, TORCH_RBLN_LOG_PATH, TORCH_RBLN_DIAGNOSE, TORCH_RBLN_SKIP_ABI_CHECK |
| First device use | Read when the device mapping is committed; frozen afterwards | RBLN_VISIBLE_DEVICES, RBLN_DEVICES, RBLN_NPUS_PER_DEVICE, RBLN_DEVICE_MAP |
| Every dispatch, check, or allocation | Read live; a change takes effect on the next operator or allocation | TORCH_RBLN_DEPLOY, TORCH_RBLN_DEV_DISABLE_OP_CPU_FALLBACK, TORCH_RBLN_EAGER_MALLOC |
| Per category | unsupported_op is fixed when the extension loads; compile_error and strided_copy_error are read on each check | TORCH_RBLN_DISABLE_FALLBACK |
| Process-group creation | Read when init_process_group runs | RBLN_ROOT_IP, RBLN_LOCAL_IP, RBLN_FORCE_LOOPBACK_CONTROL_PLANE, RBLN_RDMA_IP, RBLN_RDMA_HCA, RBLN_DISABLE_AUTO_RDMA_IP, TORCH_RBLN_C10D_ASYNC |
| RBLN runtime | Read by the RBLN runtime (librbln.so), not by torch-rbln; set before the process starts | RBLN_FORCE_NPU_NAME, RBLN_PROFILER, RBLN_PROFILER_DIR, RBLN_OFFLOAD_DIR |
Logging and diagnostics¶
| Variable | Description | Default |
|---|---|---|
TORCH_RBLN_LOG_LEVEL | Log verbosity: DEBUG, INFO, WARNING, ERROR. CPU fallback notifications are logged at INFO. | WARNING |
TORCH_RBLN_LOG_PATH | Log file path. Debug builds only. | ./torch_rbln.log |
TORCH_RBLN_LOG | Deprecated alias of TORCH_RBLN_LOG_LEVEL. TORCH_RBLN_LOG_LEVEL takes precedence when both are set. | unset |
TORCH_RBLN_DIAGNOSE | 1 makes import torch skip initializing the extension, so that diagnostics still run when the import fails. python -m torch_rbln.diagnose enters this mode by itself; set the variable only when the import fails before the module starts. | unset |
| Level | Description | Use |
|---|---|---|
DEBUG | Internal states, function entry and exit, parameter values | Development on a debug build |
INFO | Runtime information including CPU fallback notifications | Finding operators that run on CPU |
WARNING | Conditions that may affect execution | Default |
ERROR | Errors and critical failures | Alerting |
Execution and fallback¶
| Variable | Description | Default |
|---|---|---|
TORCH_RBLN_DEPLOY | Exactly ON (case-sensitive) skips the NaN/Inf scan of operator inputs that otherwise routes tensors containing invalid values to CPU; any other value leaves the scan on. Use in deployment to remove the scan overhead. Read on every dispatch. | unset |
TORCH_RBLN_DISABLE_FALLBACK | Comma-separated fallback categories to disable. A disabled category raises instead of falling back to CPU. See the category table for when each is read. | unset |
Fallback categories¶
| Category | Default behavior | When disabled |
|---|---|---|
compile_error | A torch.compile failure falls back to CPU execution | The compilation error is raised |
unsupported_op | An operator without an RBLN implementation runs on CPU | An error naming the operator is raised |
non_blocking_copy | Accepted as a category name; no code path consults it at this release | No effect |
strided_copy_error | A batched strided copy failure falls back to CPU | The underlying error is raised |
all | — | Every category above is disabled |
unsupported_op is evaluated once when the extension loads, so set it in the environment before launching the process. compile_error and strided_copy_error are read on each check and can be set and unset from Python around one code path. Operators registered explicitly to the CPU fallback path are unaffected by unsupported_op; see Operators pinned to CPU. The pre-dispatch checks that send an operator to CPU for its dtype, for all-scalar inputs, or for NaN/Inf values are not categories and are not turned into errors by this variable.
Warning
Modify TORCH_RBLN_DEPLOY and the fallback variables only while no RBLN operator dispatch is in progress. Concurrent environment mutation and dispatch are unsupported.
Device mapping¶
By default each physical NPU maps 1:1 to a logical device rbln:N. On ATOM™, to group several NPUs into one logical device for Rebellions Scalable Design (RSD), set one of the grouping variables. On Rebel100™ leave them unset: a card is a fixed RSD-4 group of its four chiplets, and several cards are combined with rbln-ccl (Tutorial: Collectives with rbln-ccl). All ids below are indices into the pool that RBLN_VISIBLE_DEVICES leaves visible.
| Variable | Description | Default |
|---|---|---|
RBLN_VISIBLE_DEVICES | Physical NPUs this process may see, as a comma-separated list of ids. Owned by the RBLN runtime. RBLN_DEVICES is a deprecated alias that takes precedence when both are set. | unset (every NPU on the host) |
RBLN_NPUS_PER_DEVICE | Group visible NPUs uniformly, N per logical device. N must be one of 1, 2, 4, 8, 16, 32. NPUs left over are unused and a warning is printed. | unset (1) |
RBLN_DEVICE_MAP | Explicit groups, for example "[0,1],[2,3,4,5]". Each group size must be one of 1, 2, 4, 8, 16, 32. Takes precedence over RBLN_NPUS_PER_DEVICE. | unset |
Priority: RBLN_DEVICE_MAP > RBLN_NPUS_PER_DEVICE > default 1:1.
Examples with four visible NPUs:
| Setting | Result |
|---|---|
| unset | rbln:0..rbln:3, one NPU each |
RBLN_NPUS_PER_DEVICE=2 | rbln:0 = NPUs [0, 1], rbln:1 = NPUs [2, 3] |
RBLN_NPUS_PER_DEVICE=4 | rbln:0 = NPUs [0, 1, 2, 3] |
RBLN_DEVICE_MAP="[0,1],[2,3]" | Same as RBLN_NPUS_PER_DEVICE=2, stated explicitly |
RBLN_VISIBLE_DEVICES=4,5,6,7 + RBLN_NPUS_PER_DEVICE=2 | rbln:0 = physical NPUs 4, 5; ids in the map are relative to the visible pool |
With six visible NPUs and RBLN_NPUS_PER_DEVICE=4, rbln:0 = NPUs [0, 1, 2, 3] and NPUs 4, 5 stay unused with a warning.
When the mapping takes effect¶
| Stage | What happens | Triggered by |
|---|---|---|
| Plan | The variables are parsed and validated and the logical-to-physical table is computed. No NPU is claimed. | torch.rbln.is_available(), torch.rbln.device_count(), other queries |
| Commit | Each planned logical device is registered with the runtime, which opens a context on every mapped NPU. The mapping is frozen for the process lifetime. | The first actual device use: an allocation, synchronize(), a collective. set_device() does not commit. |
Until commit, changing the variables changes the mapping. After commit, changes are ignored and unsetting a variable does not widen the pool. A launcher may therefore set RBLN_VISIBLE_DEVICES after import torch, as long as it does so before the process's first device use. Device use after fork() is unsupported and not detected; see Execution Semantics › Processes and fork.
Print the resulting topology with torch.rbln.device_summary():
[RBLN] Device Topology Initialized:
+----------------+------------------+---------------------+
| Logical Device | Physical NPU IDs | Status |
+----------------+------------------+---------------------+
| rbln:0 | [ 0, 1 ] | Active (Aggregated) |
| rbln:1 | [ 2, 3 ] | Active (Aggregated) |
+----------------+------------------+---------------------+
When the grouping leaves NPUs over, for example three visible NPUs with RBLN_NPUS_PER_DEVICE=2, the leftover NPUs appear as an Unused row and a warning follows the table:
[RBLN] Device Topology Initialized:
+----------------+------------------+---------------------+
| Logical Device | Physical NPU IDs | Status |
+----------------+------------------+---------------------+
| rbln:0 | [ 0, 1 ] | Active (Aggregated) |
| - | [ 2 ] | Unused |
+----------------+------------------+---------------------+
[Warning] 1 physical NPU(s) are unused due to grouping constraints.
Distributed¶
The control-plane variables are read when torch.distributed.init_process_group(backend="rbln-ccl") creates the process group, not at import.
| Variable | Description | Default |
|---|---|---|
RBLN_ROOT_IP | Control-plane address of rank 0. The default keeps the control plane on one host, so a multi-node run must set it before init_process_group. Owned by the RBLN runtime. | 127.0.0.1 |
RBLN_LOCAL_IP | Control-plane address of this rank. Same rule as RBLN_ROOT_IP. Owned by the RBLN runtime. | 127.0.0.1 |
RBLN_FORCE_LOOPBACK_CONTROL_PLANE | 1 forces both addresses back to 127.0.0.1 even when they were set, for single-node debugging. | unset |
RBLN_RDMA_IP | IPv4 address of the RDMA data-plane interface. Set it explicitly, or name the interface with RBLN_RDMA_HCA and let the process group resolve the address. When neither is set the variable stays unset; a single-host run does not need it. Owned by the RBLN runtime. | unset |
RBLN_RDMA_HCA | RDMA device name as listed under /sys/class/infiniband, for example mlx5_0 or rocep99s0; a :<PORT> suffix is accepted and ignored. When RBLN_RDMA_IP is unset, the IPv4 address of the device's first bound network interface is written to RBLN_RDMA_IP. There is no automatic choice of device, so on a host with several RDMA vendors this is how a NIC is pinned. A failed resolution is logged and leaves RBLN_RDMA_IP unset. | unset |
RBLN_DISABLE_AUTO_RDMA_IP | 1 skips the RBLN_RDMA_HCA resolution above. An explicit RBLN_RDMA_IP always takes priority, so this variable only matters when RBLN_RDMA_IP is unset but RBLN_RDMA_HCA is set. | unset |
TORCH_RBLN_C10D_ASYNC | 1 runs the rbln-ccl process group in asynchronous mode; collectives return work handles to wait on. Unset or any other value runs collectives synchronously. | unset |
On one host the defaults are enough: launch one process per NPU with torchrun, give each process its own NPU through RBLN_VISIBLE_DEVICES before the first device use, and call init_process_group(backend="rbln-ccl"). Tutorial: Collectives with rbln-ccl shows the launch. Across hosts, set RBLN_ROOT_IP and RBLN_LOCAL_IP on every rank before init_process_group, and pin the data-plane NIC with RBLN_RDMA_HCA or RBLN_RDMA_IP when the host has more than one RDMA interface.
Profiling¶
| Variable | Description | Default |
|---|---|---|
RBLN_PROFILER | 1 turns on device profiling in the RBLN runtime. On Rebel100™ NPUs this is what lets the Kineto bridge add RBLN device rows to a torch.profiler trace; it must be set before the runtime starts. On ATOM™ NPUs the bridge stays inactive regardless. Owned by the RBLN runtime; see RBLN Profiler. | unset |
RBLN_PROFILER_DIR | Directory where the runtime writes its profile files. Owned by the RBLN runtime. | runtime default |
With RBLN_PROFILER=1 set for the process, a torch.profiler.profile(activities=[ProfilerActivity.CPU, ProfilerActivity.PrivateUse1]) region records RBLN device events next to the ATen calls, and the runtime writes its own profile file (rbln_<timestamp>.pb) for the RBLN Profiler tools when the process exits. Tutorial: Profiling on Rebel100™ walks through a run.
ABI check¶
import torch verifies that this torch-rbln build and the librbln.so it loads agree on the rebel ABI contract. See Troubleshoot for the messages.
| Variable | Description | Default |
|---|---|---|
TORCH_RBLN_SKIP_ABI_CHECK | 1, ON, TRUE, or YES skips the handshake so a mismatched pair loads together. An escape hatch to unblock a machine while a matching wheel is built. | unset |
Warning
Skipping the check suppresses the diagnosis, not the incompatibility. The mismatch it hides is what would otherwise surface as an undefined symbol import crash or as corruption inside the runtime.
Memory¶
| Variable | Description | Default |
|---|---|---|
RBLN_OFFLOAD_DIR | Directory for the per-process file-offload storage used by torch.rbln.offload(). Owned by the RBLN runtime. | $HOME/.cache/rbln_cache/offload |
TORCH_RBLN_EAGER_MALLOC | 1 allocates NPU memory when a tensor's storage is registered instead of on its first use by a device operation. For allocation experiments and profiling only; keep it unset for applications. Read on every allocation. See Execution Semantics › Lazy device tensors. | unset (lazy allocation) |
Development-only options¶
Development only
Do not use these options in production or deployment environments. Skipping a CPU fallback check can produce silent numerical corruption, hangs, or crashes on inputs the device does not handle. A runtime warning is emitted once per process the first time such a variable is observed.
| Variable | Description | Default |
|---|---|---|
TORCH_RBLN_DEV_DISABLE_OP_CPU_FALLBACK | Comma-separated per-operator fallback checks to skip in eager dispatch. The operator is sent to the device even where it would normally fall back. Read on every dispatch. | unset |
| Case | Default behavior | When disabled |
|---|---|---|
dispatch_mode | Fall back when a non-infrastructure TorchDispatchMode is active | Risks infinite recursion |
trace | Fall back when a Python tracer (pdb, coverage) is active | torch.compile may run under the tracer |
reentrant | Fall back, with a warning, when already inside an RBLN compile operator (print, repr, nested operator) | Risks infinite recursion |
dtype | Fall back on unsupported or mismatched tensor dtypes | Wrong results possible |
scalar | Fall back when every input is a 0-dim scalar | May fail inside the compiler |
storage_offset | Fall back when a contiguous tensor has storage_offset != 0 | May read wrong data |
nan_inf | Fall back when inputs contain NaN or Inf (non-deploy mode only) | Invalid values reach the device |
all | — | Every check above is skipped |
See also¶
- Execution Semantics - the behaviors these variables change
- Troubleshoot - which variable to reach for on each symptom
- RBLN Compiler › Troubleshoot - device selection with
RBLN_VISIBLE_DEVICESfrom the runtime's side - RBLN Profiler -
RBLN_PROFILERand the profiler output