[DSV4] Fuse norm and router for low latency scenario - #41263
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
Code Review
This pull request implements a fused RMSNorm and router GEMV kernel specifically optimized for DeepSeek V4 (DSV4-Pro) to reduce kernel launch overhead. The changes include the CUDA kernel implementation, a new NormGatedLinear layer for runtime dispatching between fused and unfused paths, and updates to the DeepSeek V4 model to utilize this optimization. A benchmark script is also provided for performance and correctness verification. Feedback was provided regarding the SM version check in the kernel entry point, which may be overly restrictive for future architectures supported by the build configuration.
| TORCH_CHECK(sm >= 90 && sm <= 103, | ||
| "dsv4_norm_router_gemm requires SM_90 <= CUDA ARCH <= SM_103"); |
There was a problem hiding this comment.
The runtime check restricts the kernel to SM versions up to 103. However, CMakeLists.txt allows building for SM 11.0 and 12.0 (if CUDA 13.0 is used). If the kernel is compiled for these future architectures, it will fail at runtime despite being SM90+ compatible. Consider relaxing the upper bound if the kernel is expected to be forward-compatible.
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
Signed-off-by: jeejeelee <jeejeelee@verda-b300-05.datacrunch.io>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
) Signed-off-by: Jee Jee Li <pandaleefree@gmail.com> Signed-off-by: jeejeelee <jeejeelee@verda-b300-05.datacrunch.io> Co-authored-by: jeejeelee <jeejeelee@verda-b300-05.datacrunch.io> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Signed-off-by: Liuweixiong0118 <lwx34158427@gmail.com>
Purpose
Test Plan
performance
Accuracy
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.