[MPS] Add regression test for memory leak in nn.MaxPool2d
#132408
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a regression test for the issue described in
The test is designed to identify a GPU memory leak in the
nn.MaxPool2d
module in MPS. About 1.63 GiB is leaked in this test when the issue is present.Summary of Changes:
Added
test_maxpool2d_no_leak
to verify that no GPU memory is leaked when performing a sequence of operations withnn.MaxPool2d
.Used the
@xfailIf(product_version > 0)
decorator to mark the test as expected to fail for product versions greater than0
.This will help identify when the issue is resolved in macOS version 15 or later (estimate by upstream), as the test will start failing consistently, indicating that the memory leak has been fixed. Once the issue is resolved in macOS, the predicate needs to be updated. For example, use
@xfailIf(product_version < 15.1)
if the issue is fixed in macOS version15.1
.