Repository navigation
Conversation
Signed-off-by: Sylvan Liu <Sylvan.Liu@amd.com>
This branch has not been deployed
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 does this PR do?
Fixes #15457.
RMSNorm(elementwise_affine=False)ranpow,mean,rsqrt, a multiply and a cast as separate kernels. When there is no weight,forwardnow callsF.rms_norm, which does the same computation in one kernel. The affine path and the NPU path are unchanged.On a
[1, 8160, 4096]input (960x544x121 LTX-2 video tokens), per call, torch 2.14.0+rocm10.1.0:The output is not bitwise identical: for bf16, 165 of 33,423,360 elements differ, by one bf16 step at most (fp16: 1,207 elements, one fp16 step; fp32: 24.7% of elements, at most 9.5e-7). The error against an fp32 reference on the largest values is unchanged in bf16 and fp16. The output dtype is unchanged.
Tests:
RMSNormTestsintests/models/test_layers_utils.py: the no-affine output matches the explicit fp32 formula in fp32, fp16 and bf16 and keeps the input dtype. It fails ifepsis changed in the new call.tests/models/transformers/test_models_transformer_ltx2.py(includes thetorch.compiletests) andtests/models/test_layers_utils.py, torch 2.14.0+rocm10.1.0: onmain(facc812ea, Radeon AI PRO R9600D) no failure or error; with this change (Radeon AI PRO R9700) the same results plus the new test, also no failure or error.tests/pipelines/ltx2/test_ltx2.pywas not run to completion. Onmainand on this branch the first 71 results are identical, including two errors at the same position, and the file takes more than an hour on this setup, so I stopped both runs.Self-review notes (diffusers
self-reviewskill).ai/references/review-rules.md, read against the whole diff (two source lines and one test class).utils/check_copies.pypasses (no# Copied fromcopy ofRMSNormexists); ruff 0.17.5 reports no issue on the changed files (the repo pins 0.9.10, which I did not install).F.rms_normis used only where the previous code already took the pure-PyTorch route.Before submitting
self-reviewskill on the diff?Who can review?
@yiyixuxu @sayakpaul