Skip to content

Fix #4150: [Bug] TestWeightStrippedEngine OOM on RTX 3070 (8GB) with ...#4155

Open
JiwaniZakir wants to merge 1 commit intopytorch:mainfrom
JiwaniZakir:fix/4150-bug-testweightstrippedengine-oom-on-rtx
Open

Fix #4150: [Bug] TestWeightStrippedEngine OOM on RTX 3070 (8GB) with ...#4155
JiwaniZakir wants to merge 1 commit intopytorch:mainfrom
JiwaniZakir:fix/4150-bug-testweightstrippedengine-oom-on-rtx

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Closes #4150

Description

Reduces batch sizes in three TestWeightStrippedEngine tests in tests/py/dynamo/models/test_weight_stripped_engine.py to prevent CUDA out-of-memory failures on GPUs with 8GB VRAM (e.g., RTX 3070).

The three affected tests were using batch size 100 or 128 for ResNet-18 inputs at shape (N, 3, 224, 224), which exhausts available VRAM on 8GB cards under CUDA 12.x. The fix reduces all example and inference inputs to batch size 2:

  • test_weight_stripped_engine_sizes: example_inputs reduced from (100, 3, 224, 224) to (2, 3, 224, 224)
  • test_weight_stripped_engine_results: example_inputs reduced from (100, 3, 224, 224) to (2, 3, 224, 224); inference inputs reduced from (128, 3, 224, 224) to (2, 3, 224, 224)
  • test_two_TRTRuntime_in_refitting: same reductions as test_weight_stripped_engine_results

The dynamic shape bounds (min=1, max=200) are unchanged, so these tests continue to exercise dynamic batching. The correctness assertions in test_weight_stripped_engine_results and the engine size comparisons in test_weight_stripped_engine_sizes remain intact.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Mar 31, 2026

Hi @JiwaniZakir!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@github-actions github-actions bot added the component: tests Issues re: Tests label Mar 31, 2026
@lanluo-nvidia lanluo-nvidia added the Force All Tests[L0+L1+L2] For run all the L0, L1, L2 tests label Apr 1, 2026
@github-actions github-actions bot requested a review from lanluo-nvidia April 1, 2026 18:18
@meta-cla meta-cla bot added the cla signed label Apr 2, 2026
@meta-cla
Copy link
Copy Markdown

meta-cla bot commented Apr 2, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@JiwaniZakir
Copy link
Copy Markdown
Author

Reducing to batch size 2 fixes the OOM but it's worth verifying the tests still meaningfully exercise the weight-stripping logic — specifically that the refitting path in test_two_TRTRuntime_in_refitting is validated across a non-trivial input range, not just a minimal case. Also note that @navnitan-7's comment above appears to be unrelated to this PR and should probably be flagged as spam.

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

Labels

cla signed component: tests Issues re: Tests Force All Tests[L0+L1+L2] For run all the L0, L1, L2 tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] TestWeightStrippedEngine OOM on RTX 3070 (8GB) with CUDA 12.x

2 participants