[DSv4.1] Fuse native-layout vision RoPE backward and QKV gradient packing - #1122
Draft
YangXu1990uiuc wants to merge 1 commit into
Draft
YangXu1990uiuc wants to merge 1 commit into
YangXu1990uiuc wants to merge 1 commit into
Conversation
…king Signed-off-by: Yang Xu <yanxu@nvidia.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
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.
The published DSv4.1 vision attention path produces BF16 Q/V gradients in HTD storage and K gradients in HDT storage. This adds
VisionRoPEBackwardand its allocation wrapper withbackend="frost": one SM100 kernel reads those layouts directly, applies split-half rotary backward, and writes contiguous packed dQKV. It removes the separate K-layout copy and fuses Q/K rotation with V packing.The API supports dynamic token counts without recompilation, caller-owned output, explicit streams, and CUDA Graph capture. It validates dtype, layout, alignment, device, and output overlap. Trigonometric tables use FP32; multiply and add/subtract round separately before BF16 output. The implementation targets 16 heads and head dimension 64.
The mathematical contract follows DeepSeek-V4.1-Flash vision.py. The GPU addressing, shared-memory transpose, and fused packing are authored for this implementation.
Validation:
The following backward operator speedups use the fastest same-run control, which was the copy-dK-plus-FROST implementation:
Across these shapes, public-API Graph GPU speedup is 1.34–1.42x and Graph wall-time speedup is 1.29–1.42x. Every paired block exceeds 1.05x for both Graph clocks and cache regimes. Relative to the fastest external provider, Graph GPU speedup is 1.76–1.91x. Eager wall-time medians improve 1.03–1.13x, with smaller and noisier gains.
A separate B200 timing run covers forward plus checkpointed backward of the full 32-layer vision tower and aligner, using the same actual checkpoint, six image geometries, two input banks, and all nine providers. Each geometry uses eight paired blocks with three samples per provider; compilation is excluded and outputs/gradients are rechecked after timing. Relative to the fastest same-run control, median whole-phase wall-time ratios are 0.999–1.003x, and CUDA-event span ratios are 0.999–1.003x; against only the numerically exact controls, wall-time ratios are 1.001–1.006x. None of the six geometries shows a stable >5% whole-phase gain. These results do not demonstrate an overall vision-training speedup.
The performance benefit demonstrated here is confined to the RoPE backward-and-pack operator. The vision tests retain the source 3D math attention path and exclude optimizer updates and the language backbone. Only the kernel, public API, user documentation, and focused tests are included.