[PyTorch] Remove internal PyTorch testing helper#2969
[PyTorch] Remove internal PyTorch testing helper#2969timmoon10 wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Greptile SummaryThis PR replaces the unstable
Confidence Score: 5/5Safe to merge — the change removes a flaky internal dependency and replaces it with a straightforward, self-contained memory guard that correctly flushes the CUDA allocator cache before querying free memory. The change is narrow and low-risk: one import removed, one decorator replaced with three equivalent lines. The reimplementation includes gc.collect() and torch.cuda.empty_cache() before the memory check, which is the correct approach and matches the upstream PyTorch reference. No test logic is altered. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[test_large_tensor called] --> B[gc.collect]
B --> C[torch.cuda.empty_cache]
C --> D{mem_get_info free >= 60 GB?}
D -- No --> E[pytest.skip Insufficient available memory]
D -- Yes --> F[Allocate large tensors 2x 2359332864 fp16]
F --> G[Run FusedAdam optimizer step]
G --> H[Assert close vs torch.optim.Adam]
H --> I[torch.cuda.synchronize]
Reviews (2): Last reviewed commit: "[pre-commit.ci] auto fixes from pre-comm..." | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Tim Moon <4406448+timmoon10@users.noreply.github.com>
|
/te-ci pytorch |
for more information, see https://pre-commit.ci
Description
We have been experiencing test failures in
test_fused_optimizer.py. There is some import error when importingtorch.testing._internal.common_device_type. Fortunately,largeTensorTestis simple to reimplement, so I figure that's better than dealing with unstable internal tools.Type of change
Changes
Checklist: