Repository navigation
Conversation
Copy tensor-backed quantization metadata alongside packed payloads, keep transpose-cache validity, and route clone dispatch to the owning quantized tensor implementation. Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryQuantized tensor clones now copy their scale buffers independently, so replacing a clone does not change the original tensor.
No new actionable issues found. CUDA tests were not run during this review. Reviews (4) · Last reviewed commit: "[PyTorch] Merge current main" · Reviewed by Greptile |
Run a standalone clone and copy scenario from the PyTorch L0 launcher. Cover storage independence, clone updates, Hybrid children, detach aliases, and gradient propagation across the quantized tensor formats. Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
Signed-off-by: Ziming Wang <zimingwang945@gmail.com>
|
Rechecked the current head |
Description
clone()copies the packed payload of the quantized tensor classes and inherits their scaling buffers by reference. A latercopy_()into the clone can therefore change the original tensor's decoded values. WithFloat8CurrentScalingQuantizer, cloning a tensor of ones and copying a separately quantized tensor of twos into the clone changes the original tensor from 1 to 2 on current main.Type of change
Changes
clone().torch.clone()through the NVFP4 and blockwise Float8 clone methods so Hybrid tensor cloning reaches the same storage-copy contract.get_metadata(),_IdentityFunc,detach(), andview()unchanged. Quantizer construction retains its existing configuration-copy and shared calibration-state behavior.Reproduction
Current main prints
1.0, 2.0, 2.0. The patch prints1.0, 1.0, 2.0.Validation
After merging main
925832d7on November 17, all 42 CUDA clone lifecycles passed again. The quantized-tensor implementation and scenario are unchanged, and both the clone scenario and main's new swizzle test remain in the L0 launcher. The official TE 2.21 extension and device limits below still apply.copy_, detach/view aliases, quantizer calibration-state sharing, stale transpose state, and clone backward. The candidate passed 85 observations in each environment.tests/pytorch/scenario_quantized_clone.pyto the PyTorch L0 launcher. Its 42 CUDA lifecycles cover the method andtorch.clone()entry points, both Hybrid storage directions, type preservation, independent buffers, clone replacement, unchanged originals, detach aliases, backward propagation, and native FP8 decoded values. The same committed scenario reports 42 failures on main and 42 passes with the patch.test_identity_opandtest_detach_preserves_subclasscoverage. Both main and candidate reported 5 passed and 3 architecture skips.The native run used an RTX 4090 Laptop GPU, SM 8.9, Python 3.12, Torch 2.8.0+cu129, and official TE 2.21.0 CUDA core and matching PyTorch-extension wheels with the current Python source. cuDNN was explicitly set to 9.12.0.46 to satisfy TE's import check, differing from the Torch wheel's 9.10.2.21 pin. This environment validates the Python storage behavior and native FP8 reproduction. It is separate from a complete current-main native build.
MXFP8, NVFP4, and blockwise FP8 CUDA-buffer checks cover storage operations on this device. Their architecture-specific quantize/GEMM paths, the full L0 suites, and Hopper/Blackwell coverage remain unrun. Please run the relevant L0 quantized-tensor and Hybrid coverage in the supported project environments.