Skip to content

Reset dynamo state in test_memory_compile_regions#3443

Open
amd-maradosa wants to merge 1 commit into
release/2.12from
maradosa/reset-dynamo-test-memory-compile-regions
Open

Reset dynamo state in test_memory_compile_regions#3443
amd-maradosa wants to merge 1 commit into
release/2.12from
maradosa/reset-dynamo-test-memory-compile-regions

Conversation

@amd-maradosa

Copy link
Copy Markdown

ROCm/TheRock#6173

Motivation

test_memory_compile_regions in test/test_cuda.py asserts on Dynamo compile-region counts. When the test runs in the same process as other compile tests (e.g. a full test_cuda.py run), compiled artifacts cached by earlier tests leak into this test, making the asserted counts non-deterministic and the test flaky. This PR isolates the test from prior Dynamo state.

CI fail

Technical Details

Added torch._dynamo.reset() at the start of test_memory_compile_regions, before torch.cuda.memory.empty_cache(), so the test starts from a clean Dynamo cache regardless of what ran before it.

Test Plan

Reproduced locally with a small prelude test that runs torch.compile(...) on CUDA before the affected test, in the same process:

python -m pytest .py test_cuda.py -k "<prelude_test> or test_memory_compile_regions" -v

Test Result

Before fix:
- standalone: PASSED
- with a compiling test first: FAILED

After fix:
- standalone: PASSED
- with a compiling test first: PASSED

Submission Checklist

@rocm-repo-management-api

rocm-repo-management-api Bot commented Jul 15, 2026

Copy link
Copy Markdown

Jenkins build for ad54c5992eda08520997db8ec488eb78d7542809 commit finished as FAILURE
Links: Pipeline Overview / Build artifacts / Test Results

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.

1 participant