[rollout, sglang] feat: support sglang ROCm backend via aiter defaults and ray init env - #1
Open
xiaohong42 wants to merge 1 commit into
Open
[rollout, sglang] feat: support sglang ROCm backend via aiter defaults and ray init env#1xiaohong42 wants to merge 1 commit into
xiaohong42 wants to merge 1 commit into
Conversation
…s and ray init env On ROCm (torch.version.hip is not None), default the SGLang attention backend to "aiter" when the user has not set one. The non-attention kernels (RMSNorm/RoPE/MoE/quant) are routed through AITER via SGLANG_USE_AITER, which is now injected through the platform abstraction (PlatformROCm.rollout_env_vars()) instead of os.environ.setdefault: the SGLang server actor's runtime_env consumes get_platform().rollout_env_vars() and ray_noset_envvars(), mirroring the vLLM/trtllm rollout servers. Both remain overridable: an explicit engine_kwargs.sglang.attention_backend or an exported SGLANG_USE_AITER still win. Also inject RAY_ACCEL_ENV_VAR_OVERRIDE_ON_ZERO=0 into PPO_RAY_RUNTIME_ENV on ROCm so Ray 2.x does not force-clear accelerator visibility for the num_gpus=0 SGLang server actor (otherwise the actor sees no GPU). Scoped to ROCm to keep Ray's default behavior on other platforms. AI assistance (Cursor) was used; the change was reviewed line-by-line. Co-authored-by: Cursor <cursor@cursor.com> Signed-off-by: xiaohong42 <940683523@qq.com>
xiaohong42
force-pushed
the
feat/sglang-rocm-aiter-default
branch
from
June 12, 2026 08:14
0cbf93f to
d21601c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Enable the SGLang rollout backend to run out-of-the-box on AMD ROCm GPUs.
On ROCm (
torch.version.hip is not None), this PR:aiterwhen the user has not explicitly set one (previously it fell through toflashinfer/fa3).SGLANG_USE_AITER=1viaos.environ.setdefault, so the non-attention kernels (RMSNorm / RoPE / MoE / quant) also take the AITER path. This is decoupled from the attention backend selection and is set for ROCm regardless of which attention backend is chosen.RAY_ACCEL_ENV_VAR_OVERRIDE_ON_ZERO=0intoPPO_RAY_RUNTIME_ENVso Ray 2.x does not force-clear accelerator visibility for thenum_gpus=0SGLang server actor (otherwise the actor sees no GPU).All three are scoped to ROCm and remain user-overridable: an explicit
engine_kwargs.sglang.attention_backendor an exportedSGLANG_USE_AITERstill win, and CUDA / NPU behavior is unchanged.Checklist Before Starting
[{modules}] {type}: {description}[rollout, sglang] feat: support sglang ROCm backend via aiter defaults and ray init envTest
Validated on AMD ROCm (MI3xx). Both rollout integration paths train end-to-end:
main_ppo, GRPO + SGLang): ranlaunch_smoke_qwen3_8b.sh.fully_async_policy, SGLang): randapo_7b_math_fsdp2_4_4.sh.Both smoke runs complete the training steps successfully. The SGLang server log shows the expected
ROCm detected: attention_backend=aiter, SGLANG_USE_AITER=1.API and Usage Example
No API changes. The new behavior is automatic on ROCm and overridable:
Design & Code Changes
verl/workers/rollout/sglang_rollout/async_sglang_server.pyattention_backend="aiter"when unset.SGLANG_USE_AITER=1viasetdefault, decoupled from the attention backend, plus an info log of the resolved values.verl/trainer/constants_ppo.pyRAY_ACCEL_ENV_VAR_OVERRIDE_ON_ZERO=0toPPO_RAY_RUNTIME_ENV(conditional dict, mirroring the existing_gb200_nccl_envpattern).Checklist Before Submitting
pre-commit run --files <changed files> --show-diff-on-failure --color=always): all hooks pass.ci-requestchannel. — To be done when opening the upstream PR.recipesubmodule.