feat(rl-kernel): add ROCm linear logp provider integration - #423
Conversation
Documentation build overview
45 files changed ·
|
There was a problem hiding this comment.
Code Review
This pull request introduces an optional provider boundary for Megatron linear_logp computation, allowing custom provider dispatching, validation, and fallback mechanisms, along with compatibility updates for vLLM. The review feedback focuses on improving robustness and type safety across the new boundary. Key recommendations include safely handling optional fields in _normalize_result, separating provider loading from execution to avoid masking internal bugs, adding explicit torch.Tensor type checks for request and result attributes, handling None values gracefully during vocabulary size parsing, and filtering out non-string action.dest values when collecting vLLM server field names.
Signed-off-by: lamentropetion <3051000145@qq.com>
127dc92 to
eeda543
Compare
There was a problem hiding this comment.
LGTM. I tested the ROCm integration end-to-end on 8× MI300X GPUs. The R/R strict path achieved bitwise-identical training and rollout log probabilities across three rounds, with 0/192 mismatches, while P/P remained on the native vime path. Let’s merge this PR first.
Summary
This PR adds the Vime-side provider boundary required to run RL-Kernel train/rollout consistency on ROCm while keeping Vime responsible for token layout, masking, loss composition, and framework orchestration.
The integration is fail-closed in strict mode, preserves Vime's native implementation when the provider is not configured, and supports the current vLLM CLI and server layouts used by the ROCm TP4/CP2 workload.
The end-to-end implementation and 200-step reference results are documented in RL-Kernel PR #400.
Motivation
Vime currently computes selected-token log probabilities inside its Megatron loss path. RL-Kernel needs the same logical token layout and model projection metadata to provide an operator-level implementation without taking ownership of Vime's training loop.
This PR introduces a narrow provider ABI instead of adding RL-Kernel-specific kernel code to Vime:
Changes
Linear-logp provider contract
Megatron integration
Current vLLM compatibility
Quick Start
Run the strict ROCm TP4/CP2 path on one node with 8 AMD Instinct MI300X GPUs. Set
NUM_ROLLOUT=200for the full reference horizon.To run the matched native control, change
--case R/Rto--case P/P.200-step reference result
The matched ROCm experiment used:
The strict R/R arm achieved bitwise equality for all 200 steps over 9,400,614 compared elements from 1,600 samples.
Training stability
The following figure compares the reported gradient norm and training loss from the two authoritative W&B runs:
The bold curves are trailing 9-step medians and the lighter curves are the raw per-step values. Both runs remain finite. The mean gradient norm is 0.1552 for G10 and 0.2450 for G11. The reported mean training loss is 6.013e-4 for G10 and 2.433e-6 for G11; this scalar difference is descriptive and is not treated as a reward or optimization-quality comparison.
Raw W&B system metrics
The raw 200-step W&B means are 93.79 versus 72.60 tokens/GPU/s for G10 and G11, and 84.52 versus 99.21 seconds for end-to-end step time. These raw trajectories show a 22.6% G11 rollout-throughput reduction and a 17.4% step-time increase. They are included for transparency, not as a normalized performance claim: response lengths differ across the free-running arms, and the result bundle separately reports warmup-excluded, token-normalized, and equal-length views.
TP4/CP2 module ablation
The short integration matrix used Vime 9404528, RL-Kernel a588f11, 8 rollouts, batch size 1, 8 samples per prompt, maximum response length 7,168, seed 1234, and KL coefficient 0.001.
M111 was bitwise equal over 354,543 active tokens. Its rollout throughput was 0.31% above M000 in this short run. M110 removed nearly all average drift, but its 0.133394 maximum remained above the 0.06 numerical threshold; strict Logp removed the remaining tail in M111.
M000, M100, M001, and M101 are marked NOT_COMPARABLE only because production vLLM FFN execution inside the HIP graph did not emit a Python execution record. These arms had no launcher, fallback, sidecar, or numerical errors, but they do not provide the same route-proof strength as the four PASS arms.
Validation
Compatibility and scope