You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_cuda_pack_reconstruction_matches_pytorch_at_scale[iq1_m] fails on Jetson Thor: exact ties exceed the blocks // 1000 bound #2705
tests/gpu/torch/quantization/test_iq_formats_cuda.py::test_cuda_pack_reconstruction_matches_pytorch_at_scale[iq1_m] fails on Jetson Thor:
> assert differing <= blocks // 1000, f"{differing} of {blocks} blocks differ"
E AssertionError: 2 of 1024 blocks differ
E assert 2 <= (1024 // 1000)
Both differing blocks are exact ties. The CUDA encoding and the PyTorch encoding of each block decode to different values (one group of 8 weights uses a different grid point), but they reconstruct the block with bit-identical squared error:
format
block (row, block)
SSE, CUDA
SSE, PyTorch
bytes that differ
iq1_m
(60, 7)
41.883705
41.883705
2
iq1_m
(68, 4)
43.345009
43.345009
1
iq2_xs
(123, 6)
22.985538
22.985538
2
Total relative error matches exactly for all five formats, so the CUDA encoder loses no quality. iq2_xs passes only because it has 1 such block, which is at the bound.
The docstring of test_cuda_pack_matches_pytorch_encoder_and_is_decodable already explains this behavior. The two encoders evaluate the same squared error with different floating-point fusion, so near-ties can round to different sides "in roughly one block in several thousand". That rate depends on how the compiler fuses the CUDA encoder's arithmetic for the target GPU. On Thor it is 2 in 1024 for IQ1_M. The blocks // 1000 bound therefore encodes one GPU's tie rate rather than the property the test's docstring states ("may disagree on a near-tied scale, but not on quality").
Impact: test-only. A GPU test fails on Jetson Thor.
The test passes wherever the CUDA encoder reconstructs each block as well as the reference, which is true on Thor.
Proposed fix: require every differing block to have the same per-block squared error as the reference (rtol=1e-5). Keep the total-error check, and loosen the count bound to 1% of blocks. With that change, flipping a grid-index bit in a single block still fails the test. I'll open a PR.
CUDA: 13.0 (the modelopt_cuda_ext_ggml extension is built for sm_110)
PyTorch: 2.13.0+cu130
Transformers: 5.14.1
TensorRT-LLM: N/A
ONNXRuntime: N/A
TensorRT: N/A
Any other details that may help: Every other test in test_iq_formats_cuda.py passes on Thor, including byte parity on the small fixed input and the comparison with llama.cpp's decoder.
Activity
Check IQ CUDA encoder ties per block instead of by count (#2708)
Measure qtensor GPU memory tests with allocator stats (#2707)