Repository navigation
Conversation
On SM 12.0/12.1 the exact RHT test takes the column-wise reference from TE's unfused kernel, including the padded scale rows and columns that the reference quantizer does not compute. That padding is not initialized, so the test failed whenever the column-wise scale tensor is padded (e.g. 256x272, 304x304, 32x128). Slice the native reference to the shape of the reference quantizer's scales, as the test already does for the kernel under test. Signed-off-by: rlaope <105429536+rlaope@users.noreply.github.com>
Contributor
[Low impact] This test-only change appears safe to merge. SummaryFixes the SM12x NVFP4 RHT test by comparing only computed column-wise scales.
No actionable issues found. GPU tests were not run during this review. Reviews (1) · Last reviewed commit: "[PyTorch] Compare only computed NVFP4 RH..." · Reviewed by Greptile |
8 of 13 tasks
Collaborator
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.
Description
tests/pytorch/nvfp4/test_nvfp4_rht_quantize_exact.pyfails 32 of 300 cases on SM 12.0 atmain. The failing cases aretest_rht_with_quantization_block_tiling_versus_referenceandtest_nvfp4_quantization_noncontiguous_inputswithcolumnwise_onlyorboth_directionsat shapes whose column-wise scale tensor is padded (256x272, 304x304, 8192x11328, 32x128). Only the column-wise scale comparison fails:The data, amax and the computed scales all match bit for bit. On SM 12.0/12.1 the test takes the column-wise reference from TE's unfused kernel (
NVTE_NVFP4_DISABLE_RHT_CAST_FUSION=1, added in #3300). For a 256x272 input that tensor is padded to (384, 16), while the reference quantizer's scales are (272, 16). The test slices the kernel under test to the reference shape (sx_t[: ref_sx_t_shape[0], : ref_sx_t_shape[1]]), but it takesref_sx_t_shapefrom the padded native tensor, so the comparison includes padding. The padding is not initialized. In two back-to-back calls on the same input it held 0 and then 1791 nonzero bytes in the fused output, and 1791 and then 1784 in the unfused output.This PR slices the native reference to the reference quantizer's scale shape. It changes the test only.
Type of change
Changes
tests/pytorch/nvfp4/test_nvfp4_rht_quantize_exact.py: in the SM12x branch, slicenative._columnwise_scale_invto the shape ofx_nvfp4_ref.scale_tbefore comparing.Testing
RTX PRO 6000 Blackwell Max-Q (SM 12.0), driver 590.48.01, TE
mainat a6393d0 built withNVTE_CUDA_ARCHS=120, CUDA 13.0, torch 2.14.1+cu130. Same library for both runs. Only the test file differs.pytest -p no:randomly tests/pytorch/nvfp4/test_nvfp4_rht_quantize_exact.py, three runs each:Other architectures are unaffected because they do not take this branch. Not run: SM 12.1.
Checklist: