Skip to content

Disable XLA command buffers by default on ROCm - #3175

Open
wsmoses wants to merge 1 commit into
mainfrom
rocm-disable-command-buffers
Open

wsmoses wants to merge 1 commit into
mainfrom
rocm-disable-command-buffers

Conversation

@wsmoses

@wsmoses wsmoses commented Aug 9, 2026

Copy link
Copy Markdown
Member

Mitigates issue 6 of @ftynse's ROCm findings: SIGSEGV in rocr::core::InterceptQueue::SubmitRocmCommandBuffer::LaunchGraph on the first execution of a while-loop command buffer, on gfx950 / ROCm 7.1 — deterministic, after compile/spinup succeeded, and gone entirely with command buffers off (their smoke08 vs smoke09 runs).

Change

XLA.get_debug_options / make_compile_options now take the client's platform; on "rocm" the xla_gpu_enable_command_buffer list is cleared — the per-compile equivalent of XLA's own documented escape hatch --xla_gpu_enable_command_buffer=. Both compile paths (PJRT compile_mlir! and the IFRT resharding path) pass the platform through.

The override ordering keeps this a default, not a lock-out: user kwargs are applied after, so xla_debug_options=(; xla_gpu_enable_command_buffer=[...]) re-enables them — the right knob for testing whether a newer ROCm stack still crashes.

Cost

Real and worth stating: a time-stepping loop is many small kernels, exactly the shape command buffers accelerate — disabling them pays full per-launch overhead every iteration. But a deterministic crash on the first executed step costs more, and the flag flip back is one line once the HSA/rocprofiler/XLA interaction is isolated upstream.

Verification

Unit-checked on CUDA hardware (no AMD GPU available locally): platform="rocm" produces an empty command-buffer list, platform="cuda" keeps XLA's defaults (CONDITIONAL, CUBLAS, …, FUSION), an explicit user override wins over the ROCm default, and an end-to-end @jit compile on CUDA is unaffected.

🤖 Generated with Claude Code

https://claude.ai/code/session_015drPT8jCwS74HnX6vEBCxz

HIP graph replay of XLA command buffers segfaults inside the HSA
runtime's InterceptQueue on current ROCm stacks -- deterministically, on
the first execution of a while-loop command buffer, after compilation
has succeeded. XLA's own escape hatch is
`--xla_gpu_enable_command_buffer=` (the empty set); apply that as the
default for ROCm clients by clearing the command-buffer type list in the
debug options Reactant builds per compile. An explicit
`xla_debug_options=(; xla_gpu_enable_command_buffer=...)` still wins,
so re-enabling for testing newer ROCm stacks stays a one-liner.

This costs real performance on loop-heavy workloads (full per-launch
overhead each iteration), but a deterministic crash on the first
executed step costs more.

Reported by Alex Zinenko (@ftynse) on gfx950 / ROCm 7.1:
https://gist.github.com/ftynse/5c3816a1cea5daa7dc189b937b62f9ca (issue 6)

Co-authored-by: Alex Zinenko <ftynse@users.noreply.github.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015drPT8jCwS74HnX6vEBCxz
@wsmoses

wsmoses commented Aug 9, 2026

Copy link
Copy Markdown
Member Author

Upstream issue filed: openxla/xla#46952 — once resolved there, reverting this default is a one-liner (drop the platform == "rocm" block in get_debug_options).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant