Skip to content

Commit

Permalink
Refactor Maxpool2d tests (#17782)
Browse files Browse the repository at this point in the history
### Ticket
[Link to Github
Issue](#14912)

### Problem description
Currently, we have approximately `14,000` tests in `max_pool2d`. This
large number is due to test parameters being generated using the
Cartesian product of all possible values for each parameter, resulting
in an excessive test count. As a consequence, these tests take a
significant amount of time to run in the CI/CD pipeline, leading to
inefficiencies.

### What's changed
This MR refactors the test by adopting an approach from

`tt-metal/tests/sweep_framework/sweeps/max_pool2d/short/max_pool2d_short_sweep.py`.
The key idea is to reduce the number of test parameters by focusing only
on those actually used in practice. Instead of generating a Cartesian
product of all possible values, we collect parameters directly from
models that use `max_pool2d`. This set of models includes YOLOv4, VGG,
`ttnn_resnet`, SegFormer, and `functional_unet`.

### Checklist
- [x] [All post
commit](https://github.com/tenstorrent/tt-metal/actions/workflows/all-post-commit-workflows.yaml)
CI passes
- [ ] [Blackhole Post
commit](https://github.com/tenstorrent/tt-metal/actions/workflows/blackhole-post-commit.yaml)
CI passes (if applicable)
- [ ] [Model
regression](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-models.yaml)
CI passes (if applicable)
- [ ] [Device performance
regression](https://github.com/tenstorrent/tt-metal/actions/workflows/perf-device-models.yaml)
CI passes (if applicable)
- [ ] **(For models and ops writers)** Full [new models
tests](https://github.com/tenstorrent/tt-metal/actions/workflows/full-new-models-suite.yaml)
CI passes (if applicable)
- [ ] New/Existing tests provide coverage for changes
  • Loading branch information
zfang-TT authored Mar 6, 2025
1 parent 2fee418 commit f3eebc5
Show file tree
Hide file tree
Showing 3 changed files with 1,327 additions and 889 deletions.
3 changes: 2 additions & 1 deletion tests/sweep_framework/sweep_utils/max_pool2d_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def run_max_pool2d(
device,
sharding=ttnn.TensorMemoryLayout.HEIGHT_SHARDED,
ceil_mode=False,
memory_config=None,
):
kernel_size = [kernel_h, kernel_w]
stride = [stride_h, stride_h]
Expand Down Expand Up @@ -98,7 +99,7 @@ def run_max_pool2d(
stride=[stride_h, stride_w],
padding=[pad_h, pad_w],
dilation=[dilation_h, dilation_w],
memory_config=None,
memory_config=memory_config,
applied_shard_scheme=sharding,
)

Expand Down
Loading

0 comments on commit f3eebc5

Please sign in to comment.