docs(csrc): condense verbose comments (comments-only, no code change)#4061
Draft
carlushuang wants to merge 11 commits into
Draft
docs(csrc): condense verbose comments (comments-only, no code change)#4061carlushuang wants to merge 11 commits into
carlushuang wants to merge 11 commits into
Conversation
Contributor
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
|
zufayu
approved these changes
Jul 3, 2026
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.
What
Condense over-verbose comments across the C/C++/HIP sources under
csrc/andgradlib/. This is a comments-only change: no code, no behavior, no build changes.Motivation: a lot of kernels have grown 10+ line prose essays explaining a single
constexpror wrapping code in decorative==== TITLE ====banners. The canonical example is theMXFP4_MOE_SORT_COALESCED_LDS_WORK_MAXgate, which carried a 12-line rationale essay for one integer. These essays bury the load-bearing facts and make the kernels harder to read.Scope
86 files changed, net ~1,650 fewer lines. All changes are comment text only.
Condensed: rationale/"why" essays, decorative banner boxes, comments that merely restate the adjacent code, and duplicated explanations.
Preserved verbatim: SPDX/license headers, ASCII memory-layout and bit-packing diagrams, math derivations, correctness invariants, TODO/FIXME/BUG notes, and all code (including commented-out dead code).
Every technical fact in a condensed comment is still recoverable from the shorter version.
Example
Before (
csrc/kernels/quant_kernels.cu):After:
Verification
For every changed file, comments were stripped from both the base and the edited version and the remaining code token streams compared: byte-identical in all 86 files. No code was altered.
Largest reductions:
custom_kernels.cu(-201),fused_qk_norm_rope_cache_quant.cu(-180),topk_plain_kernels.cu(-92), and theopus_gemmgfx950 pipelines.