Skip to content

[BE][Test] Trim max_pool OpInfo sample inputs - #203270

Closed
jbschlosser wants to merge 14 commits into
gh/jbschlosser/291/basefrom
gh/jbschlosser/291/head
Closed

jbschlosser wants to merge 14 commits into
gh/jbschlosser/291/basefrom
gh/jbschlosser/291/head

Conversation

@jbschlosser

@jbschlosser jbschlosser commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

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 #1, #2, #5 and #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

CI savings:

  ┌──────────────────────────────────────────────┬────────────┬───────────────┬──────────────────┐
  │                      Op                      │ Hours/week │ PR ÷ baseline │ Saved hours/week │
  ├──────────────────────────────────────────────┼────────────┼───────────────┼──────────────────┤
  │ max_pool2d                                   │ 8,555      │ 0.28          │ 6,158            │
  ├──────────────────────────────────────────────┼────────────┼───────────────┼──────────────────┤
  │ max_pool3d                                   │ 4,280      │ 0.34          │ 2,842            │
  ├──────────────────────────────────────────────┼────────────┼───────────────┼──────────────────┤
  │ max_pool2d_with_indices_backward             │ 2,728      │ 0.16          │ 2,280            │
  ├──────────────────────────────────────────────┼────────────┼───────────────┼──────────────────┤
  │ max_pool1d                                   │ 2,473      │ 0.14          │ 2,138            │
  ├──────────────────────────────────────────────┼────────────┼───────────────┼──────────────────┤
  │ max_unpool1d/2d/3d (and their grad variants) │ 2,922      │ 0.17–0.60     │ 2,201            │
  ├──────────────────────────────────────────────┼────────────┼───────────────┼──────────────────┤
  │ Total                                        │ 20,958     │               │ 15,619 (74.5%)   │
  └──────────────────────────────────────────────┴────────────┴───────────────┴──────────────────┘

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

[ghstack-poisoned]
@pytorch-bot pytorch-bot Bot added the release notes: python_frontend python frontend release notes category label Nov 3, 2026
@pytorch-bot

pytorch-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

PR Status: Approved 🚀

Please fix all CI failures and trigger merge by commenting "@pytorchbot merge".

✅ AUTOMATED REVIEW - 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.

Findings (3):

[minor] torch/testing/_internal/common_methods_invocations.py:3858
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.

[minor] test/inductor/test_torchinductor.py:7473
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.

[minor] test/test_proxy_tensor.py:1043
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.

Reviewed commit: 85367ab

Review run

🐛 Report a bad review

🔗 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 Failures

As of commit 85367ab with merge base 51f0eeb (image):

🟡 GREEN LIGHT - OUTDATED (earlier commit) - PR requires human review:

  • Triviality
    • Edits the shared OpInfo sample generator sample_inputs_max_pool in torch/testing/_internal/common_methods_invocations.py, which Explained test changes excludes
    • Not additive: it removes samples consumed by the max_pool1d/2d/3d, max_pool2d_with_indices_backward and max_unpool*d OpInfos
  • Coverage reduction
    • Drops batch=2 shapes from _TestParamsMaxPoolBase.shapes and the scalar/tuple cross product, e.g. 2d scalar kernel_size=3 now only appears with ceil_mode=False
    • _TestParamsMaxPool2d drops scalar stride=2; a reviewer should judge whether the lost combinations matter
  • Socialization
    • Test weakening with no source change behind it; module owners should sign off on trimmed coverage

reason: not_trivial
Reviewed commit: 625d21e (NOT the current head 85367ab)

Inference job

🐛 Report a wrong verdict

NEW FAILURES - The following jobs have failed:

  • xpu / linux-noble-xpu-n-py3.11 / test (default, 6, 12, linux.idc.xpu) (gh)
    test/inductor/test_compiled_optimizers.py::CompiledOptimizerParityTestsXPU::test_correctness_RMSprop_use_closure_True_xpu_float32

    AI verdict: AI verdict: probably not related

    The failure is an XPU GPU page fault ("Segmentation fault from GPU ... NotPresent") followed by complete numeric mismatches in CompiledOptimizerParityTestsXPU::test_correctness_RMSprop. The suspect commit only changes max_pool test samples, a proxy-tensor test and a comment, none of which touch compiled optimizers. The same group of test_correctness_* tests in this shard was already failing at the merge base before the suspect existed.

    Full reasoning on HUD →

  • xpu / win-vs2022-xpu-n-1-py3 / build (gh)
    code=1

    AI verdict: AI verdict: probably not related

    The PR changes only Python test files. The Windows XPU build failed in a post-link step: a cmake -E copy_if_different of xpupti_compute.dll into bin/kineto. Two kineto test targets copy that same DLL there at the same time, so this is a parallel-build race that the PR can't affect. Trunk runs of this job before and after the merge base passed.

    Full reasoning on HUD →

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.

@pytorchgreenlight pytorchgreenlight Bot added the GL/human GreenLight marked as needing human review label Nov 3, 2026
@pytorchbot pytorchbot added the in progress PR is being worked on by the author, until the automated review accepts it label Nov 3, 2026
github-actions[bot]

This comment was marked as outdated.

[ghstack-poisoned]
@pytorchgreenlight pytorchgreenlight Bot added GL/superseded GreenLight review is superseded by changes and removed GL/human GreenLight marked as needing human review labels Nov 4, 2026
github-actions[bot]

This comment was marked as outdated.

[ghstack-poisoned]
github-actions[bot]

This comment was marked as outdated.

@jbschlosser jbschlosser added topic: not user facing topic category and removed release notes: python_frontend python frontend release notes category labels Nov 5, 2026
[ghstack-poisoned]
github-actions[bot]

This comment was marked as outdated.

@github-actions
github-actions Bot dismissed stale reviews from themself November 5, 2026 16:56

Withdrawn: the automated review of 04a5487 found nothing blocking.

@jbschlosser jbschlosser added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 5, 2026
[ghstack-poisoned]
github-actions[bot]

This comment was marked as outdated.

[ghstack-poisoned]
github-actions[bot]

This comment was marked as outdated.

@albanD albanD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

[ghstack-poisoned]
github-actions[bot]

This comment was marked as outdated.

[ghstack-poisoned]
[ghstack-poisoned]
github-actions[bot]

This comment was marked as outdated.

@jbschlosser

Copy link
Copy Markdown
Contributor Author

Re the non-blocking hw_classification finding: this predates the PR and is out of scope here.

AI-drafted: CommonTemplate, CpuTests and GPUTests in test/inductor/test_torchinductor.py declare no hw_classification, which predates this PR. Migrating that template is out of scope for an OpInfo-trimming change, so test_max_pool3d_large_kernel follows the neighbouring max_pool tests in the same template.

[ghstack-poisoned]
@jbschlosser

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot

pytorch-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

This PR has pending changes requested. Please address the comments and update the PR before merging.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

https://github.com/pytorch/pytorch/blob/85367ab5c5f229a3d5d71937763736126d008aff/torch/testing/_internal/common_methods_invocations.py#L3858

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.


def test_max_pool3d_large_kernel(self, padding, ceil_mode: bool):

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.


# The arg parser expands a scalar SymInt for an int[N] arg, but calling an OpOverload directly doesn't

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

@github-actions
github-actions Bot dismissed stale reviews from themself November 5, 2026 22:14

Withdrawn: the automated review of 85367ab found nothing blocking.

@jbschlosser

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge failed

Reason: 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 team

Raised by workflow job

@jbschlosser

Copy link
Copy Markdown
Contributor Author

@pytorchbot merge -i

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Nov 6, 2026
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
pytorchmergebot pushed a commit that referenced this pull request Nov 6, 2026
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
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
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
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
…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
dominikjastrzebskix pushed a commit to dominikjastrzebskix/pytorch that referenced this pull request Nov 9, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request ciflow/xpu Run XPU CI tasks GL/superseded GreenLight review is superseded by changes in progress PR is being worked on by the author, until the automated review accepts it Merged module: inductor topic: not user facing topic category

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants