Skip to content

[release/2.12] Cleanup persistent cuBLASLt workspaces before test_mempool_ctx_multithread#3372

Merged
pragupta merged 1 commit into
ROCm:release/2.12from
dnikolaev-amd:dnikolaev/fix_test_memory_snapshot_script_2.12
Jun 24, 2026
Merged

[release/2.12] Cleanup persistent cuBLASLt workspaces before test_mempool_ctx_multithread#3372
pragupta merged 1 commit into
ROCm:release/2.12from
dnikolaev-amd:dnikolaev/fix_test_memory_snapshot_script_2.12

Conversation

@dnikolaev-amd

@dnikolaev-amd dnikolaev-amd commented Jun 24, 2026

Copy link
Copy Markdown

test_cuda.py::TestMemPool::test_mempool_ctx_multithread assumes the device allocator snapshot is empty after empty_cache(), but earlier tests in the same process can leave inactive segments behind.

Call torch._C._cuda_clearCublasWorkspaces() at the start of the test (before empty_cache()) so prior tests do not pollute the initial segment count. This matches the pattern already used in other tests

Reproducer (fails without the fix):

python test_cuda.py TestCuda.test_matmul_device_mismatch TestMemPool.test_mempool_ctx_multithread

test_matmul_device_mismatch leaves reserved segments. test_mempool_ctx_multithread then fails with Expected 0 but got N on the opening assertion. The test passes in isolation.

Fixes pytorch#153460 Pull Request resolved: pytorch#187991 Approved by: https://github.com/jeffdaily

(cherry picked from commit 77fa1dc)

Cherry-picked to release/2.11 branch via #3373

Cherry-picked to release/2.10 branch via #3374

…hread

`test_cuda.py::TestMemPool::test_mempool_ctx_multithread` assumes the device allocator snapshot is empty after empty_cache(), but earlier tests in the same process can leave inactive segments behind.

Call `torch._C._cuda_clearCublasWorkspaces()` at the start of the test (before empty_cache()) so prior tests do not pollute the initial segment count. This matches the pattern already used in other tests

Reproducer (fails without the fix):
```bash
python test_cuda.py TestCuda.test_matmul_device_mismatch TestMemPool.test_mempool_ctx_multithread
```
test_matmul_device_mismatch leaves reserved segments. test_mempool_ctx_multithread then fails with `Expected 0 but got N` on the opening assertion. The test passes in isolation.

Fixes pytorch#153460
Pull Request resolved: pytorch#187991
Approved by: https://github.com/jeffdaily

(cherry picked from commit 77fa1dc)
@dnikolaev-amd dnikolaev-amd requested a review from pragupta June 24, 2026 21:35
@rocm-repo-management-api

Copy link
Copy Markdown

Jenkins build for 3ab4141b2653b55e4c341037a279ce087e31f7b3 commit is in progress
Links: Pipeline Overview / Build artifacts

@pragupta pragupta merged commit 220d3bf into ROCm:release/2.12 Jun 24, 2026
0 of 2 checks passed
@dnikolaev-amd

Copy link
Copy Markdown
Author

!cherry-pick --onto release/2.11 release/2.10

rocm-repo-management-api-6 Bot added a commit that referenced this pull request Jun 24, 2026
…hread

Cherry-pick of #3372

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
rocm-repo-management-api-6 Bot added a commit that referenced this pull request Jun 24, 2026
…hread

Cherry-pick of #3372

Co-authored-by: Dmitry Nikolaev <139769634+dnikolaev-amd@users.noreply.github.com>
@rocm-repo-management-api-6

Copy link
Copy Markdown

Created branch autogenerated/release/2.11_cherry-pick_pr-3372 and #3373

Created branch autogenerated/release/2.10_cherry-pick_pr-3372 and #3374

Comment processed by Build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants