[Refactor] Align RMSNorm with current FlyDSL kernel style#902
Open
jhinpan wants to merge 4 commits into
Open
Conversation
Cache JIT launchers so plain and fused forward hot paths can use the existing raw-stream fast dispatcher without rebuilding stream wrappers or device guards. Co-authored-by: Cursor <[email protected]>
Keep only path and invariant comments so the forward and backward implementations reflect the current layout APIs and dispatch behavior. Co-authored-by: Cursor <[email protected]>
Remove redundant numeric wrappers and duplicate store dtype plumbing, and use the canonical Vector.filled surface throughout the RMSNorm kernels. Co-authored-by: Cursor <[email protected]>
Route quantization scale writes through the shared typed scalar-store primitive instead of maintaining an equivalent local implementation. Co-authored-by: Cursor <[email protected]>
coderfeli
reviewed
Jul 25, 2026
| store_rstd=store_rstd, | ||
| eps=eps, | ||
| weight_dtype_str=weight_dtype_str, | ||
| ) |
Collaborator
There was a problem hiding this comment.
why remove flyc.compile
coderfeli
reviewed
Jul 25, 2026
| compiled(x, residual, weight, out, residual_out, rstd, M, stream) | ||
| else: | ||
| compiled(x, residual, weight, out, residual_out, M, stream) | ||
| launcher = _get_fused_add_fwd_launcher( |
Collaborator
There was a problem hiding this comment.
why remove flyc.compile
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.
Summary
This is a behavior-preserving cleanup of the RMSNorm forward/backward implementation using the repository's
kernel-code-cleanupguidance._run_compiled/ raw-stream pattern already used by maintained FlyDSL kernelsfx.Int32/fx.Float32wrapping and use Python literals where the typed operand already determines the runtime typefull(...)calls with the canonicalfx.Vector.filled(...)surface and remove duplicate store-dtype plumbing from the RMSNorm scalar-store helperThe goal is coding consistency and maintainability rather than a shape-specific speedup. Kernel math, memory layouts, and backward dispatch policy are unchanged.
Test plan
bash scripts/check_python_style.sh --base upstream/mainHIP_VISIBLE_DEVICES=7 FLYDSL_RUNTIME_ENABLE_CACHE=0 python3 -m pytest tests/kernels/test_rmsnorm.py -q -m 'not benchmark and not large_shape and not multi_gpu'(30 passed, 6 deselected)HIP_VISIBLE_DEVICES=6,7 FLYDSL_RUNTIME_ENABLE_CACHE=0 python3 -m pytest tests/kernels/test_rmsnorm.py::test_rmsnorm_multi_gpu tests/kernels/test_rmsnorm.py::test_fused_add_rmsnorm_device_mismatch -q(2 passed)