This document is relevant for: Inf2, Trn1, Trn2, Trn3
Neuron Explorer Environment Variables#
This page documents all environment variables that affect Neuron Explorer profiling, profile capture, and profile processing. For the full list of Neuron Runtime variables, see Profiling in the Neuron Runtime reference.
Environment variables are read at two different times:
Compile time.
NKI_DEBUG_INFO,XLA_IR_DEBUG, andXLA_HLO_DEBUGchange what the compiler writes into the NEFF. See Source code and debug info.Run time.
NEURON_RT_*variables control whether the Neuron Runtime captures a profile and what it captures. Set them before the workload starts.
Which mechanism turns profiling on#
Each capture method turns profiling on in a different way.
Warning
Set NEURON_RT_INSPECT_ENABLE=1 only for environment-variable capture. Don’t combine it
with torch.profiler or jax.profiler.trace. The two mechanisms conflict.
Capture method |
What turns profiling on |
Run-time variables to set |
|---|---|---|
Environment variables (any framework, containers, EKS) |
|
|
PyTorch ( |
|
None required. Configure capture through |
JAX ( |
|
|
|
The |
None. Configure capture with command-line flags. |
|
The |
None. Configure capture with command-line flags. |
Profiling control#
These run-time variables enable and configure environment-variable capture. Except where
noted, they have no effect unless NEURON_RT_INSPECT_ENABLE=1.
Variable |
Description |
Default |
Values |
|---|---|---|---|
|
Master switch for environment-variable capture. Required when you capture with environment variables alone. |
|
|
|
Directory where profile output is written. |
|
Any valid path |
|
Capture system-level runtime events and operations. |
|
|
|
Capture device-level hardware traces (
|
|
|
|
Add host CPU utilization sampling ( |
|
|
|
Add host memory usage sampling ( |
|
|
|
Number of executions to skip before device profiling begins. When set
to N, the first N executions of each model are skipped and only the
(N+1)-th execution is profiled. Only supported with model mode
( |
|
|
NEURON_RT_INSPECT_DEVICE_PROFILE_NUM_WARMUP usage:
Use this variable to bypass warmup noise and profile steady-state behavior.
For example, setting NEURON_RT_INSPECT_DEVICE_PROFILE_NUM_WARMUP=5 skips the
first 5 executions of each model and profiles the 6th. Each model’s execution
count is tracked independently — if two different models are loaded, their
warmup counters are separate.
Source code and debug info#
Set these variables before compiling. They change what the compiler writes into the NEFF, so recompile after setting them. A NEFF loaded from the compilation cache doesn’t have the debug info.
Variable |
Description |
Default |
|---|---|---|
|
Also writes the compiled NEFF and the HLO module to the working
directory. Applies to XLA-based workloads. Does not affect what the
profile contains. Use it to get a NEFF file to pass to
|
|
|
Enables NKI kernel debug info capture. Produces
|
|
|
Enables XLA IR debug info for richer operation names in profiles. |
|
|
Enables XLA HLO debug info for descriptive layer names in the hierarchy view. |
|
DGE and DMA configuration#
Variable |
Description |
Default |
|---|---|---|
|
Enables Descriptor Generation Engine notifications so DMA transfers are labeled
with their tensor variable name (instead of |
|
|
Device memory, in MB, reserved for recording host-device DMA events
in device profiles. Events after the buffer fills are dropped. Set to
|
|
Warning
Enabling DGE notifications adds overhead and can cause timeouts for very
large NEFFs. If profiling hangs or times out, disable this flag and
re-capture. The profile will be complete but DMA variable names will
show unknown.
Capture filtering (capture-time)#
These reduce memory and file size by filtering events at capture time. Data not captured is permanently lost.
Variable |
Description |
Default |
|---|---|---|
|
Only capture events from specified NeuronCores. Accepts comma-separated indices or ranges. |
All cores |
|
Only capture specified event types or categories. |
All events |
|
Maximum system trace events per NeuronCore before ring buffer overwrites oldest. Increase if you see dropped events. |
1,000,000 |
For examples and the C API, see Capture-time filtering.
NEFF cache and artifact control#
Variable |
Description |
Default |
|---|---|---|
|
Directory for the NEFF compilation cache. When set, cached NEFFs are automatically available in the profile output directory. |
System default |
|
Enable profiling before graph cache is populated. Useful for capturing the first execution of a model. |
|
PyTorch-specific#
Variable |
Description |
Default |
|---|---|---|
|
Enable host-mediated collective communication for distributed profiling. |
|
|
Enable asynchronous Neuron Runtime for overlapping compute and communication. |
|
Runtime configuration#
Variable |
Description |
Default |
|---|---|---|
|
Number of NeuronCores to use for the workload. |
All available |
|
Number of physical NeuronCores per virtual NeuronCore (VNC). |
1 |
Quick reference: recommended combinations#
NKI kernel (compile-time only):
# Set BEFORE compiling the kernel. Capturing with neuron-explorer capture
# afterward needs no run-time variables.
export NKI_DEBUG_INFO=True
export XLA_IR_DEBUG=1
export XLA_HLO_DEBUG=1
For the full workflow, see Profile a NKI Kernel.
System profile only (lightweight):
export NEURON_RT_INSPECT_ENABLE=1
export NEURON_RT_INSPECT_OUTPUT_DIR=./output
System + device profile (full picture):
export NEURON_RT_INSPECT_ENABLE=1
export NEURON_RT_INSPECT_DEVICE_PROFILE=1
export NEURON_RT_INSPECT_OUTPUT_DIR=./output
Full debug info (system + device + source code + NKI + DMA names):
# Set BEFORE compilation
export NEURON_FRAMEWORK_DEBUG=1
export NKI_DEBUG_INFO=True
export XLA_IR_DEBUG=1
export XLA_HLO_DEBUG=1
# Set BEFORE execution
export NEURON_RT_INSPECT_ENABLE=1
export NEURON_RT_INSPECT_DEVICE_PROFILE=1
export NEURON_RT_ENABLE_DGE_NOTIFICATIONS=1
export NEURON_RT_INSPECT_OUTPUT_DIR=./output
Inference / vLLM (session-based device profile):
export NEURON_RT_INSPECT_ENABLE=1
export NEURON_RT_INSPECT_DEVICE_PROFILE=session
export NEURON_RT_INSPECT_OUTPUT_DIR=./output
Large distributed workload (filtered to reduce size):
export NEURON_RT_INSPECT_ENABLE=1
export NEURON_RT_INSPECT_DEVICE_PROFILE=1
export NEURON_RT_INSPECT_EVENT_FILTER_NC=0,1
export NEURON_RT_INSPECT_OUTPUT_DIR=./output
This document is relevant for: Inf2, Trn1, Trn2, Trn3