Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/189102
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit e4ccf0b with merge base ec150e9 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@claude review these changes |
|
Claude finished @jansel's task in 4m 24s —— View job PR Review: #189102SummaryAdds a per-op tolerance override ( Full review detailsRoot-cause verification (fix is correctly targeted): The failure traceback shows the default fp16 tolerances ( Testing
Code Quality
Design note (non-blocking)Bumping tolerance masks rather than fixes the underlying fp16 accumulation in inductor's RecommendationApprove — the fix is correctly diagnosed and targeted. Suggest (1) considering |
jansel
left a comment
There was a problem hiding this comment.
address automated feedback from claude
|
added comment, commit message should be updated with PR desc by merge, and I don't have an XPU to locally check for the XPU scenario |
|
@pytorchmergebot lint |
|
Successfully applied lint patches in https://github.com/pytorch/pytorch/actions/runs/29125956368. Please pull locally before pushing more changes. |
|
@pytorchbot rebase -b main |
|
@pytorchbot started a rebase job onto refs/remotes/origin/main. Check the current status here |
|
Successfully rebased |
|
@pytorchmergebot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: trunk / linux-jammy-rocm-py3.10-mi350 / test (distributed, 2, 3, linux.rocm.gpu.gfx950.2) Details for Dev Infra teamRaised by workflow job |
|
@pytorchmergebot merge -i |
Merge startedYour change will be merged while ignoring the following 1 checks: trunk / linux-jammy-rocm-py3.10-mi350 / test (distributed, 2, 3, linux.rocm.gpu.gfx950.2) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…ations_cuda_float16` (pytorch#189102) combinations uses index_put underneath which appears to do fp16 accum in inductor authored with codex example failure ``` _assert_equal_with_significant_stride_check assert_equal_fn( File "/usr/local/lib/python3.12/dist-packages/torch/_dynamo/test_case.py", line 129, in assertEqual return super().assertEqual(x, y, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/torch/testing/_internal/common_utils.py", line 4608, in assertEqual raise error_metas.pop()[0].to_error( # type: ignore[index] AssertionError: Tensor-likes are not close! Mismatched elements: 1 / 4 (25.0%) Greatest absolute difference: 0.001953125 at index (0,) (up to 1e-05 allowed) Greatest relative difference: 0.00199127197265625 at index (0,) (up to 0.001 allowed) ``` Pull Request resolved: pytorch#189102 Approved by: https://github.com/jansel Co-authored-by: PyTorch MergeBot <[email protected]>
|
Real bug here is "index_put underneath which appears to do fp16 accum in inductor" which doesn't match eager behavior. While backward for combinations is not interesting (who uses backward for combinations?) non-matching |
…ations_cuda_float16` (pytorch#189102) combinations uses index_put underneath which appears to do fp16 accum in inductor authored with codex example failure ``` _assert_equal_with_significant_stride_check assert_equal_fn( File "/usr/local/lib/python3.12/dist-packages/torch/_dynamo/test_case.py", line 129, in assertEqual return super().assertEqual(x, y, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/torch/testing/_internal/common_utils.py", line 4608, in assertEqual raise error_metas.pop()[0].to_error( # type: ignore[index] AssertionError: Tensor-likes are not close! Mismatched elements: 1 / 4 (25.0%) Greatest absolute difference: 0.001953125 at index (0,) (up to 1e-05 allowed) Greatest relative difference: 0.00199127197265625 at index (0,) (up to 0.001 allowed) ``` Pull Request resolved: pytorch#189102 Approved by: https://github.com/jansel Co-authored-by: PyTorch MergeBot <[email protected]>
…ations_cuda_float16` (pytorch#189102) combinations uses index_put underneath which appears to do fp16 accum in inductor authored with codex example failure ``` _assert_equal_with_significant_stride_check assert_equal_fn( File "/usr/local/lib/python3.12/dist-packages/torch/_dynamo/test_case.py", line 129, in assertEqual return super().assertEqual(x, y, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/torch/testing/_internal/common_utils.py", line 4608, in assertEqual raise error_metas.pop()[0].to_error( # type: ignore[index] AssertionError: Tensor-likes are not close! Mismatched elements: 1 / 4 (25.0%) Greatest absolute difference: 0.001953125 at index (0,) (up to 1e-05 allowed) Greatest relative difference: 0.00199127197265625 at index (0,) (up to 0.001 allowed) ``` Pull Request resolved: pytorch#189102 Approved by: https://github.com/jansel Co-authored-by: PyTorch MergeBot <[email protected]>
## Motivation #189102 bumped the gradient tolerances for `test_comprehensive_combinations_cuda_float16` after #186595 / #189305 reimplemented `torch.combinations` on top of `index_put`, whose fp16 backward Inductor accumulates in fp16. That PR only added the override to `inductor_override_kwargs["cuda"]`; `inductor_override_kwargs["xpu"]` is a separate dict and never got the equivalent entry, leaving XPU on the default fp16 gradient tolerance (`atol=1e-5, rtol=1e-3`), which is too tight for the fp16 accumulation rounding. Result: #195071 (`test_comprehensive_combinations_xpu_float16`) was disabled on 2026-08-27. ## Root cause on the failing sample Sample 17: `input=(4,) fp16, r=4, with_replacement=True` -> output `(35, 4)`. Each of the 4 inputs is copied into 35 output slots, so its gradient is the sum of 35 fp16 contributions. Forward is bit-identical between eager and Inductor; only the backward differs. Inductor lowers the `index_put(accumulate=True)` backward to a single fp16 atomic scatter (`triton_poi_fused_index_put_new_zeros_1`): ```python tmp6 = tl.load(in_ptr1 + (x0), xmask).to(tl.float32) tl.atomic_add(out_ptr0 + (tl.broadcast_to(tmp4, [XBLOCK])), tmp6, xmask, sem='relaxed') ``` `out_ptr0` is `*fp16`, so the 35 additions per slot round to fp16 on every step, in hardware-scheduling order. The XPU aten `index_put` accumulates in higher precision and rounds once: ``` # accumulate 100 x 0.0002 into an fp16 slot initialised to 1.0 (exact = 1.02) eager index_put_(accumulate=True) -> 1.01953125 inductor same op -> 1.0 (== naive fp16 read-add-write) ``` Against an fp64 reference on the failing sample: ``` grad(input): eager vs ref-fp64: max_rel = 3.65e-04 inductor vs ref-fp64: max_rel = 3.99e-03 inductor vs eager : max_rel = 1.6e-03 .. 4.9e-03 across runs (>> default rtol=1e-3) ``` The run-to-run spread comes from the nondeterministic atomic order: the same input produced 14 distinct fp16 results in 20 Inductor runs, vs 1 for eager. This is intrinsic fp16 accumulation rounding, not a correctness bug on either side, and matches the situation upstream addressed on CUDA in #189102. ## Fix Add the same `(combinations, f16)` override that #189102 added for CUDA to `inductor_override_kwargs["xpu"]`. Observed max abs diff is 1.22e-03 against an allowance of `2e-3 + 0.01 * 0.5 ~= 7e-3`, i.e. about 5.7x headroom. ## Test plan Nightly wheel `torch==2.15.0.dev20260830+xpu`, triton-xpu 3.8.0, on Intel Arc B390. Run from the pytorch checkout root: ``` PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=17 TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # before: FAILED Tensor-likes are not close! 1/4 mismatched, # rel 1.066e-03 > 1e-03 allowed # after: OK ``` All samples, three consecutive runs: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # OK / OK / OK ``` All dtypes, cpu and xpu: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ -k test_comprehensive_combinations -v ``` ``` # Ran 14 tests OK (skipped=2) ``` Fixes #195071 _Note: authored with AI assistance._ Pull Request resolved: #195403 Approved by: https://github.com/etaf, https://github.com/jansel
…195403) ## Motivation pytorch#189102 bumped the gradient tolerances for `test_comprehensive_combinations_cuda_float16` after pytorch#186595 / pytorch#189305 reimplemented `torch.combinations` on top of `index_put`, whose fp16 backward Inductor accumulates in fp16. That PR only added the override to `inductor_override_kwargs["cuda"]`; `inductor_override_kwargs["xpu"]` is a separate dict and never got the equivalent entry, leaving XPU on the default fp16 gradient tolerance (`atol=1e-5, rtol=1e-3`), which is too tight for the fp16 accumulation rounding. Result: pytorch#195071 (`test_comprehensive_combinations_xpu_float16`) was disabled on 2026-08-27. ## Root cause on the failing sample Sample 17: `input=(4,) fp16, r=4, with_replacement=True` -> output `(35, 4)`. Each of the 4 inputs is copied into 35 output slots, so its gradient is the sum of 35 fp16 contributions. Forward is bit-identical between eager and Inductor; only the backward differs. Inductor lowers the `index_put(accumulate=True)` backward to a single fp16 atomic scatter (`triton_poi_fused_index_put_new_zeros_1`): ```python tmp6 = tl.load(in_ptr1 + (x0), xmask).to(tl.float32) tl.atomic_add(out_ptr0 + (tl.broadcast_to(tmp4, [XBLOCK])), tmp6, xmask, sem='relaxed') ``` `out_ptr0` is `*fp16`, so the 35 additions per slot round to fp16 on every step, in hardware-scheduling order. The XPU aten `index_put` accumulates in higher precision and rounds once: ``` # accumulate 100 x 0.0002 into an fp16 slot initialised to 1.0 (exact = 1.02) eager index_put_(accumulate=True) -> 1.01953125 inductor same op -> 1.0 (== naive fp16 read-add-write) ``` Against an fp64 reference on the failing sample: ``` grad(input): eager vs ref-fp64: max_rel = 3.65e-04 inductor vs ref-fp64: max_rel = 3.99e-03 inductor vs eager : max_rel = 1.6e-03 .. 4.9e-03 across runs (>> default rtol=1e-3) ``` The run-to-run spread comes from the nondeterministic atomic order: the same input produced 14 distinct fp16 results in 20 Inductor runs, vs 1 for eager. This is intrinsic fp16 accumulation rounding, not a correctness bug on either side, and matches the situation upstream addressed on CUDA in pytorch#189102. ## Fix Add the same `(combinations, f16)` override that pytorch#189102 added for CUDA to `inductor_override_kwargs["xpu"]`. Observed max abs diff is 1.22e-03 against an allowance of `2e-3 + 0.01 * 0.5 ~= 7e-3`, i.e. about 5.7x headroom. ## Test plan Nightly wheel `torch==2.15.0.dev20260830+xpu`, triton-xpu 3.8.0, on Intel Arc B390. Run from the pytorch checkout root: ``` PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=17 TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # before: FAILED Tensor-likes are not close! 1/4 mismatched, # rel 1.066e-03 > 1e-03 allowed # after: OK ``` All samples, three consecutive runs: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # OK / OK / OK ``` All dtypes, cpu and xpu: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ -k test_comprehensive_combinations -v ``` ``` # Ran 14 tests OK (skipped=2) ``` Fixes pytorch#195071 _Note: authored with AI assistance._ Pull Request resolved: pytorch#195403 Approved by: https://github.com/etaf, https://github.com/jansel
…195403) ## Motivation pytorch#189102 bumped the gradient tolerances for `test_comprehensive_combinations_cuda_float16` after pytorch#186595 / pytorch#189305 reimplemented `torch.combinations` on top of `index_put`, whose fp16 backward Inductor accumulates in fp16. That PR only added the override to `inductor_override_kwargs["cuda"]`; `inductor_override_kwargs["xpu"]` is a separate dict and never got the equivalent entry, leaving XPU on the default fp16 gradient tolerance (`atol=1e-5, rtol=1e-3`), which is too tight for the fp16 accumulation rounding. Result: pytorch#195071 (`test_comprehensive_combinations_xpu_float16`) was disabled on 2026-08-27. ## Root cause on the failing sample Sample 17: `input=(4,) fp16, r=4, with_replacement=True` -> output `(35, 4)`. Each of the 4 inputs is copied into 35 output slots, so its gradient is the sum of 35 fp16 contributions. Forward is bit-identical between eager and Inductor; only the backward differs. Inductor lowers the `index_put(accumulate=True)` backward to a single fp16 atomic scatter (`triton_poi_fused_index_put_new_zeros_1`): ```python tmp6 = tl.load(in_ptr1 + (x0), xmask).to(tl.float32) tl.atomic_add(out_ptr0 + (tl.broadcast_to(tmp4, [XBLOCK])), tmp6, xmask, sem='relaxed') ``` `out_ptr0` is `*fp16`, so the 35 additions per slot round to fp16 on every step, in hardware-scheduling order. The XPU aten `index_put` accumulates in higher precision and rounds once: ``` # accumulate 100 x 0.0002 into an fp16 slot initialised to 1.0 (exact = 1.02) eager index_put_(accumulate=True) -> 1.01953125 inductor same op -> 1.0 (== naive fp16 read-add-write) ``` Against an fp64 reference on the failing sample: ``` grad(input): eager vs ref-fp64: max_rel = 3.65e-04 inductor vs ref-fp64: max_rel = 3.99e-03 inductor vs eager : max_rel = 1.6e-03 .. 4.9e-03 across runs (>> default rtol=1e-3) ``` The run-to-run spread comes from the nondeterministic atomic order: the same input produced 14 distinct fp16 results in 20 Inductor runs, vs 1 for eager. This is intrinsic fp16 accumulation rounding, not a correctness bug on either side, and matches the situation upstream addressed on CUDA in pytorch#189102. ## Fix Add the same `(combinations, f16)` override that pytorch#189102 added for CUDA to `inductor_override_kwargs["xpu"]`. Observed max abs diff is 1.22e-03 against an allowance of `2e-3 + 0.01 * 0.5 ~= 7e-3`, i.e. about 5.7x headroom. ## Test plan Nightly wheel `torch==2.15.0.dev20260830+xpu`, triton-xpu 3.8.0, on Intel Arc B390. Run from the pytorch checkout root: ``` PYTORCH_OPINFO_SAMPLE_INPUT_INDEX=17 TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # before: FAILED Tensor-likes are not close! 1/4 mismatched, # rel 1.066e-03 > 1e-03 allowed # after: OK ``` All samples, three consecutive runs: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ TestInductorOpInfoXPU.test_comprehensive_combinations_xpu_float16 ``` ``` # OK / OK / OK ``` All dtypes, cpu and xpu: ``` TORCHINDUCTOR_FORCE_DISABLE_CACHES=1 \ python test/inductor/test_torchinductor_opinfo.py \ -k test_comprehensive_combinations -v ``` ``` # Ran 14 tests OK (skipped=2) ``` Fixes pytorch#195071 _Note: authored with AI assistance._ Pull Request resolved: pytorch#195403 Approved by: https://github.com/etaf, https://github.com/jansel
combinations uses index_put underneath which appears to do fp16 accum in inductor
authored with codex
example failure
cc @ptrblck @msaroufim @tinglvv @nWEIdia @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo