Revert "optimize get_topk_ragged by fusing get k and k_scale triton kernel"#18471
Revert "optimize get_topk_ragged by fusing get k and k_scale triton kernel"#18471
Conversation
…ernel (#…" This reverts commit 760ae93.
Summary of ChangesHello @Fridge003, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request rolls back a prior optimization that attempted to improve performance by fusing K and scale data retrieval into a single Triton kernel capable of handling batched, ragged sequences. The revert simplifies the underlying Triton kernel to process one sequence at a time, shifting the responsibility for batch iteration back to the Python layer. This change likely addresses stability or performance issues encountered with the more complex batched kernel implementation. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
/rerun-stage stage-c-test-8-gpu-h200 |
|
/rerun-stage stage-c-test-4-gpu-b200 |
|
✅ Triggered |
|
✅ Triggered |
There was a problem hiding this comment.
Code Review
This pull request reverts a previous optimization that fused the get_k and k_scale Triton kernel for batched requests. The changes correctly revert the batched kernel to a simpler, non-batched version that is called in a loop for each sequence. The related function signatures, calls, and tests are updated consistently across the codebase. I've found one minor opportunity for improvement to avoid a redundant tensor concatenation. Overall, the revert appears to be implemented correctly.
| if _is_fp8_fnuz: | ||
| k_fp8 = k_fp8.view(torch.float8_e4m3fnuz) | ||
| k_fp8 = torch.cat(k_fp8_list, dim=0).view(torch.float8_e4m3fnuz) | ||
| else: | ||
| k_fp8 = k_fp8.view(torch.float8_e4m3fn) | ||
|
|
||
| k_scale = k_scale.view(torch.float32).squeeze(-1) | ||
| k_fp8 = torch.cat(k_fp8_list, dim=0).view(torch.float8_e4m3fn) |
Reverts #16043