[Perf][GEMV] Fix coalescing, add cp.async pipeline, expand test coverage#244
[Perf][GEMV] Fix coalescing, add cp.async pipeline, expand test coverage#244superAngGao merged 1 commit intotile-ai:mainfrom
Conversation
- O1: Swap thread dims to (reduce_threads, block_n) for coalesced B access - O3: Pipeline B tile loads via T.Pipelined + cp.async (disable_tma=True); autotune space: block_n in [1,2,4,8,16], num_stages in [1,2,3] - Fix A: Remove num_stages=0 sentinel; T.Pipelined requires num_stages>=1 - Fix B: Call self.kernel directly in forward() to eliminate Python closure overhead - Default config (SM90): block_n=8, reduce_threads=32, num_stages=2 - Tests: add 4 LLM production-scale shapes (Llama-3 70B, DeepSeek-V3 MoE) - Skills: add tune, tune-multiplication, kernel-debug skill docs Co-authored-by: RMLYC <RMLYC@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary of ChangesHello, 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 delivers substantial performance enhancements for GEMV operations by addressing critical memory access patterns and leveraging advanced GPU features like asynchronous data transfers. It also refines the kernel's internal logic and Python integration for efficiency. Furthermore, the changes significantly broaden the testing scope to cover real-world LLM scenarios and introduce detailed documentation to guide future kernel development and optimization efforts. 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
|
There was a problem hiding this comment.
Code Review
This pull request delivers substantial performance enhancements for the GEMV kernel by addressing memory coalescing issues, introducing a cp.async pipeline, and optimizing host-side dispatch overhead. The changes are well-supported by an expanded test suite with relevant large-scale shapes and a more effective autotuning configuration. A standout feature of this PR is the excellent new documentation that captures the debugging and tuning journey, which will be highly valuable for the team. My review is positive, with only one minor suggestion to correct a unit typo (GB/s instead of TB/s) in some of the new documentation's benchmark tables to ensure clarity.
ef8e497 to
6ce3baf
Compare
Summary
cp.asyncpipeline viaT.Pipelinedfor B tile loads (O3)num_stages=0sentinel (Fix A); eliminate Python closure overhead inforward()(Fix B)Closes #232
Benchmark Results (H200 SXM, 4.8 TB/s peak HBM)
fp16
bf16
Autotune best configs (SM90 / H200)
block_n=1, reduce_threads=32, num_stages=3block_n=1, reduce_threads=32, num_stages=3block_n=2, reduce_threads=32, num_stages=3block_n=2, reduce_threads=32, num_stages=3block_n=2, reduce_threads=32, num_stages=3Test plan
python -m pytest tests/ops/test_gemv.py -vvs— all 10 cases passpython -m pytest benchmarks/ops/bench_gemv.py -vvs— benchmark results match tables aboveAuthors
Co-authored-by: @RMLYC (https://github.com/RMLYC)
🤖 Generated with Claude Code