Repository navigation
[BE][Test] Trim max_pool OpInfo sample inputs - #203270
jbschlosser wants to merge 14 commits into
Conversation
PR Status: Approved 🚀Please fix all CI failures and trigger merge by commenting "@pytorchbot merge". ✅ AUTOMATED REVIEW - Ready for human review:
Findings (3): Reviewed commit: 🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/203270
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 3 Unrelated FailuresAs of commit 85367ab with merge base 51f0eeb ( 🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:
reason: NEW FAILURES - The following jobs have failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
BROKEN TRUNK - The following jobs failed but was present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Withdrawn: the automated review of 04a5487 found nothing blocking.
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
|
Re the non-blocking
|
[ghstack-poisoned]
|
@pytorchbot merge |
|
This PR has pending changes requested. Please address the comments and update the PR before merging. |
There was a problem hiding this comment.
Automated review of 85367ab: nothing blocking; ready for human review.
The PR trims the OpInfo sample cross product for max_pool{1,2,3}d, max_pool2d_with_indices_backward and max_unpool{1,2,3}d, adds test_max_pool3d_large_kernel for Inductor's >25-element window path, and replaces the symbolic make_fx xfail with a dedicated test that pins the error message. Recommendation: Approve. The earlier blocking finding about dropped return_indices=False grad coverage is fixed at HEAD, and every remaining point is non-blocking.
⚪ 3 non-blocking findings
Non-blocking, still open from the last review: the PR has no ciflow/slow label. About 28 affected tests are listed in test/slow_tests.json, and check_if_enable skips them unless PYTORCH_TEST_WITH_SLOW is set, which only the slow/periodic configs do. Skipped tests include TestInductorOpInfoCUDA.test_comprehensive_nn_functional_max_pool2d_cuda_{float16,float32,float64} and max_pool3d_cuda_{float32,float64}, TestDecompCPU.test_comprehensive_max_pool2d_with_indices_backward_cpu_float64, test_quick_core_backward_nn_functional_max_unpool3d_grad_, test_variant_consistency_jit_nn_functional_max_pool2d_, and the vmapjvpvjp and AOT EagerFusion max_pool entries. As a result, CUDA Inductor OpInfo coverage for max_pool2d/3d never runs on the new (1, 2) / (1, 2, 3) strides and W=5 partial windows before merge. Adding ciflow/slow would close that gap.
pytorch/test/inductor/test_torchinductor.py
Line 7473 in 85367ab
Non-blocking (test/REVIEW.md Rule 6): the description's ">25-window Inductor path" bullet leaves out one lost case, 3d with dilation > 1. The old scalar kernel_size=3 3d samples were crossed with dilation=(1, 2, 1), but test_max_pool3d_large_kernel only uses dilation [1, 1, 1]. The risk is small: the lowering's dilation handling (any(d > 1 for d in dilation) enabling the boundary mask) is the same for every n_dim, and test_max_pool2d6[dilation=2] still reaches the >25 path in 2d. Fix: add the 3d dilation loss to "Dropped coverage", or add a dilation=[1, 2, 1] subtest to test_max_pool3d_large_kernel.
pytorch/test/test_proxy_tensor.py
Line 1043 in 85367ab
Non-blocking: the comment for test_op_overload_scalar_symint_for_int_list still has no tracking-issue link, which both earlier reviews asked for. Without one, the known bug this test documents can't be found from the test. Optionally, add for argument 'kernel_size' to the regex. Because the call passes only x and k, the current pattern already effectively means kernel_size, so this part is a nit.
This review is AI-generated and advisory. Each new automated review replaces the previous one. Report a bad review
Withdrawn: the automated review of 85367ab found nothing blocking.
|
@pytorchbot 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: 2 jobs have failed, first few of them are: xpu / win-vs2022-xpu-n-1-py3 / build, xpu / linux-noble-xpu-n-py3.11 / test (default, 6, 12, linux.idc.xpu) Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 5 checks: xpu / win-vs2022-xpu-n-1-py3 / build, xpu / linux-noble-xpu-n-py3.11 / test (default, 6, 12, linux.idc.xpu), xpu / linux-noble-xpu-n-py3.11 / test (default, 11, 12, linux.idc.xpu), xpu / linux-noble-xpu-n-py3.11 / test (default, 7, 12, linux.idc.xpu), xpu / linux-noble-xpu-n-py3.11 / test (default, 10, 12, linux.idc.xpu) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Trims down the cross product of OpInfo sample inputs for the `nn.functional.linear_cross_entropy` entry. > Authored with an AI assistant (Metamate). > > `nn.functional.linear_cross_entropy` is the #4 most expensive OpInfo entry in CI over the last week (~8.8M test-sec; its `chunked` and `chunked_none` variants add ~3.7M more). > > The generator crossed every kwargs / target-type combination with 7 (input, linear_weight) shapes borrowed from `sample_inputs_linear`. It now builds 3 itself: unbatched, a 1-D batch, and a K-dim `(4, 3)` x `(2, 1, 5, 6, 3)` (no dim aliases the batch size). Every kwargs / reduction / target-type combination is still crossed with every shape. > > Removed redundancy: > - a second unbatched and a second 1-D batch shape differing only in feature sizes (square 8x8 `linear_weight`), which matter to the matmul that `nn.functional.linear`'s OpInfo covers > - two of the three K-dim shapes: all gave 3-D or 5-D logits, which take the same `nll_loss_nd` branch (reshape to 4-D, then `nll_loss2d`) > - K-dim samples in the `chunked` / `chunked_none` variants: the chunked path rejects them, so they ran the same reference path as the default variant > > Dropped coverage: with no K-dim sample in the chunked variants, `test_sample_filter_matches_the_gate` no longer sees the chunked path's `not out_features` rejection. The fallback and its warning stay covered by `test_linear_cross_entropy_linear_bias_chunked_kdim_fallback_warns`. > > Test-config cleanup that follows from dropping the chunked K-dim samples: > - the chunked fp16 `test_redispatch` tolerance override, justified by that fallback, is removed > - the `TestDecomp` skips blamed `nll_loss2d`, which only the fallback reached: removed for `chunked`, narrowed to bfloat16 for `chunked_none` (the `dot.default` decomposition still misses tolerance); `cutedsl` / `cutedsl_none`, which run the same accumulator on chunk-eligible samples only, get the same treatment > > No caller passes `sample_inputs_linear`'s `include_empty` anymore, so it is removed; `nn.functional.linear`'s samples are unchanged (25 per dtype). > > Samples per dtype (CPU, float32 / float16): > > | variant | before | after | > |---|---|---| > | default | 121 | 53 | > | chunked | 135 / 163 | 40 / 48 | > | chunked_none | 79 / 93 | 24 / 28 | Pull Request resolved: #203278 Approved by: https://github.com/slayton58, https://github.com/albanD ghstack dependencies: #203270
Removes a duplicate sample and shrinks the large-slice sample for the `mode` OpInfo entry. > Authored with an AI assistant (Metamate). > > Removed duplication: > - the no-arg 0-d sample: on a 0-d tensor the default `dim=-1` wraps to 0, so it is identical to the `dim=0` sample (the `dim=0, keepdim=True` one stays, since forward AD and the vmap batch rule branch on keepdim) > > Dropped coverage: none. `(3000,)`, which exists to hit the non-fused CUDA kernel (slice size > `2 * MAX_BLOCK_SIZE`: 2048 on CUDA, 512 on ROCm), shrinks to `(2052,)`, the smallest size above 2048 that the 4-rank DTensor op-db tests can still `Shard(0)`. > > Test-config cleanup: the stale numbers in the `test_compare_cpu` skip comment are replaced with the cause (the test only runs on ROCm): CPU returns the index at the end of a run of the repeated mode value and the non-fused CUDA path the index at the start. > > Samples per dtype, unique in parentheses: > > | OpInfo | before | after | > |---|---|---| > | mode | 7 (6) | 6 | Pull Request resolved: #203277 Approved by: https://github.com/albanD ghstack dependencies: #203270, #203278
Trims down the cross product of OpInfo sample inputs for the various max pooling related entries. > Authored with an AI assistant (Metamate). > > `nn.functional.max_pool2d`, `nn.functional.max_pool3d`, `max_pool2d_with_indices_backward` and `nn.functional.max_pool1d` are the pytorch#1, pytorch#2, pytorch#5 and pytorch#6 most expensive OpInfo entries in CI over the last week (~60M test-sec combined); `max_unpool{1,2,3}d` reuse the same sample generator. > > Removed duplication: > - 1d: every tuple arg duplicated its scalar (`(3,)` vs `3`, etc.), identical once the Python arg parser expands scalars > - 2d: `padding=1` duplicated `padding=(1, 1)`, likewise > - `max_pool2d_with_indices_backward`: `return_indices=False`, which its wrapper ignores > > Dropped coverage (all remaining values are still fully crossed): > - batch=1 (batch=2 and unbatched are kept) > - square 2d/3d kernels (scalar `kernel_size=3`); only the asymmetric tuple remains > - explicit 2d/3d strides with equal per-dim values (scalar `stride=2`). `(2, 1)` / `(2, 1, 2)` become `(1, 2)` / `(1, 2, 3)`, whose per-dim values all differ (so swapping any two changes the output) and whose windows overlap along some dims while tiling along others. 2d still overlaps along all dims with `dilation` > 1; 3d no longer can, since three distinct strides can't all be below its effective kernels (at most 3). 2d's fixed W becomes 5 instead of 6 > - `max_unpool*d` grad variants no longer keep any sample whose random indices happen to be unique, only `stride=None` (non-overlapping, so always unique) on the smallest max_pool input > - the >25-window Inductor path (below) is now covered for float, batched, forward-only input; the dropped scalar `kernel_size=3` samples also sent integer dtypes, unbatched input and backward down it. CUDA/XPU f16 max_pool3d runs only its first sample (`inductor_one_sample`), which was a 27-element window and is now 18, so that config no longer reaches it > > Dropping scalar `kernel_size=3` removed the only 3d window above Inductor's 25-element threshold, so the new `test_max_pool3d_large_kernel` covers that non-unrolled reduction lowering directly, with and without padding plus a `ceil_mode` partial window (the padded case is skipped on Halide, which can't schedule that reduction). > > `test_proxy_tensor.py`'s symbolic `make_fx` xfail for `max_pool2d_with_indices_backward` is removed because its trigger left the samples, not because it was fixed: a direct OpOverload call can't bind a scalar SymInt to `int[N]`. `test_op_overload_scalar_symint_for_int_list` keeps that tracked. > > The first sample has an overlapping explicit stride and a partial `ceil_mode` window (1d puts the larger signal size first; 2d/3d get it from the odd W), since `inductor_one_sample` configs only run the first sample. > > Samples per dtype, unique in parentheses where it differs; grad and no-grad counts match. Old max_unpool grad-variant counts varied by dtype, as their filter depended on random values: > > | OpInfo | before | after | > |---|---|---| > | nn.functional.max_pool1d | 864 (96) | 64 | > | nn.functional.max_pool2d | 1440 (960) | 192 | > | max_pool2d_with_indices_backward | 1440 (480) | 96 | > | nn.functional.max_pool3d | 576 | 128 | > | nn.functional.max_unpool1d | 144 (24) | 16 (12) | > | nn.functional.max_unpool1d (grad) | 13-18 | 4 (3) | > | nn.functional.max_unpool2d | 288 (152) | 32 (28) | > | nn.functional.max_unpool2d (grad) | 28-35 | 8 | > | nn.functional.max_unpool3d | 96 (84) | 16 (14) | > | nn.functional.max_unpool3d (grad) | 9-12 | 4 | > > Test Plan (CPU + CUDA, local build): > ``` > python test/test_ops.py -k "max_pool or max_unpool" > python test/test_ops_gradients.py -k "max_pool or max_unpool" > python test/test_meta.py -k "max_pool or max_unpool" > python test/test_decomp.py -k "max_pool or max_unpool" > python test/test_proxy_tensor.py -k "max_pool or scalar_symint" > python test/inductor/test_torchinductor_opinfo.py -k "max_pool or max_unpool" > python test/inductor/test_torchinductor.py -k test_max_pool3d_large_kernel > ``` Pull Request resolved: pytorch#203270 Approved by: https://github.com/Skylion007, https://github.com/albanD
…3278) Trims down the cross product of OpInfo sample inputs for the `nn.functional.linear_cross_entropy` entry. > Authored with an AI assistant (Metamate). > > `nn.functional.linear_cross_entropy` is the pytorch#4 most expensive OpInfo entry in CI over the last week (~8.8M test-sec; its `chunked` and `chunked_none` variants add ~3.7M more). > > The generator crossed every kwargs / target-type combination with 7 (input, linear_weight) shapes borrowed from `sample_inputs_linear`. It now builds 3 itself: unbatched, a 1-D batch, and a K-dim `(4, 3)` x `(2, 1, 5, 6, 3)` (no dim aliases the batch size). Every kwargs / reduction / target-type combination is still crossed with every shape. > > Removed redundancy: > - a second unbatched and a second 1-D batch shape differing only in feature sizes (square 8x8 `linear_weight`), which matter to the matmul that `nn.functional.linear`'s OpInfo covers > - two of the three K-dim shapes: all gave 3-D or 5-D logits, which take the same `nll_loss_nd` branch (reshape to 4-D, then `nll_loss2d`) > - K-dim samples in the `chunked` / `chunked_none` variants: the chunked path rejects them, so they ran the same reference path as the default variant > > Dropped coverage: with no K-dim sample in the chunked variants, `test_sample_filter_matches_the_gate` no longer sees the chunked path's `not out_features` rejection. The fallback and its warning stay covered by `test_linear_cross_entropy_linear_bias_chunked_kdim_fallback_warns`. > > Test-config cleanup that follows from dropping the chunked K-dim samples: > - the chunked fp16 `test_redispatch` tolerance override, justified by that fallback, is removed > - the `TestDecomp` skips blamed `nll_loss2d`, which only the fallback reached: removed for `chunked`, narrowed to bfloat16 for `chunked_none` (the `dot.default` decomposition still misses tolerance); `cutedsl` / `cutedsl_none`, which run the same accumulator on chunk-eligible samples only, get the same treatment > > No caller passes `sample_inputs_linear`'s `include_empty` anymore, so it is removed; `nn.functional.linear`'s samples are unchanged (25 per dtype). > > Samples per dtype (CPU, float32 / float16): > > | variant | before | after | > |---|---|---| > | default | 121 | 53 | > | chunked | 135 / 163 | 40 / 48 | > | chunked_none | 79 / 93 | 24 / 28 | Pull Request resolved: pytorch#203278 Approved by: https://github.com/slayton58, https://github.com/albanD ghstack dependencies: pytorch#203270
Removes a duplicate sample and shrinks the large-slice sample for the `mode` OpInfo entry. > Authored with an AI assistant (Metamate). > > Removed duplication: > - the no-arg 0-d sample: on a 0-d tensor the default `dim=-1` wraps to 0, so it is identical to the `dim=0` sample (the `dim=0, keepdim=True` one stays, since forward AD and the vmap batch rule branch on keepdim) > > Dropped coverage: none. `(3000,)`, which exists to hit the non-fused CUDA kernel (slice size > `2 * MAX_BLOCK_SIZE`: 2048 on CUDA, 512 on ROCm), shrinks to `(2052,)`, the smallest size above 2048 that the 4-rank DTensor op-db tests can still `Shard(0)`. > > Test-config cleanup: the stale numbers in the `test_compare_cpu` skip comment are replaced with the cause (the test only runs on ROCm): CPU returns the index at the end of a run of the repeated mode value and the non-fused CUDA path the index at the start. > > Samples per dtype, unique in parentheses: > > | OpInfo | before | after | > |---|---|---| > | mode | 7 (6) | 6 | Pull Request resolved: pytorch#203277 Approved by: https://github.com/albanD ghstack dependencies: pytorch#203270, pytorch#203278
Stack from ghstack (oldest at bottom):
Trims down the cross product of OpInfo sample inputs for the various max
pooling related entries.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo