Skip to content

CI: CUDA build/test hygiene + fix Puzzletron Nemotron test failures#1901

Merged
kevalmorabia97 merged 8 commits into
mainfrom
kmorabia/fix-tests
Jul 6, 2026
Merged

CI: CUDA build/test hygiene + fix Puzzletron Nemotron test failures#1901
kevalmorabia97 merged 8 commits into
mainfrom
kmorabia/fix-tests

Conversation

@kevalmorabia97

@kevalmorabia97 kevalmorabia97 commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Type of change: Bug fix (CI / tests)

  • Fix Nemotron nightly failures: install mamba_ssm/causal-conv1d from PyPI releases instead of git main (avoids the broken apache-tvm-ffi 0.1.12 that crashes on import).
  • Speed up CUDA builds: set TORCH_CUDA_ARCH_LIST=12.0 (runner's sm_120) in the GPU/example/regression workflow container env instead of the image's ~6 archs.
  • Make unit tests CPU-only: force CUDA off in the nox unit env and skip JIT-compiling CUDA extensions when no GPU is usable; move the two GPU-/mamba_ssm-requiring unit tests to tests/gpu.
  • Harden example tests against HF flakes: capture subprocess output and retry transient HuggingFace access errors (5xx / rate-limit / connection).
  • Skip Blackwell-flaky sharded-state-dict tests: test_homogeneous_sharded_state_dict and test_regular_state_dict[320] intermittently hit a CUDA illegal-memory-access on the sm_120 runner that poisons the CUDA context and cascades timeouts; gate them behind a reusable skip_flaky_on_blackwell marker (still run on non-Blackwell GPUs).
  • Bump slow test timeout: test_prune_minitron_vlm → 360s for the 2-GPU nightly.

Testing

Additional Information

  • Backward compatible: N/A (CI/tests only)
  • New dependency: N/A
  • Changelog: N/A (CI/test infra)

🤖 Generated with Claude Code

Install mamba_ssm/causal-conv1d from their latest PyPI releases instead of
git main. mamba main (ed6ce09, #984) bumped its cap to apache-tvm-ffi<=0.1.12,
which crashes at import ("attribute '__dict__' of 'type' objects is not
writable", tvm_ffi/registry.py:403) and broke importing mamba_ssm, failing all
nightly Nemotron puzzletron tests. The latest release still caps at the
known-good apache-tvm-ffi<=0.1.9, and pinning to releases stops CI from
tracking unreleased upstream dependency changes.

Also set TORCH_CUDA_ARCH_LIST=12.0 in the GPU/example/regression workflow
container env so CUDA kernels compile only for the runner's RTX PRO 6000
(sm_120) instead of the container image's ~6 archs, cutting JIT/source
compile time across all containerized tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
@kevalmorabia97 kevalmorabia97 requested a review from a team as a code owner July 5, 2026 13:44
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Updates CUDA architecture targeting across CI workflows, adjusts nox test environments and CUDA extension loading checks, moves an AWQ-Lite calibration regression into CUDA-only coverage, and adds/removes descriptor caching tests between GPU and unit suites.

Changes

CUDA runtime and calibration coverage

Layer / File(s) Summary
Pin CUDA architecture in workflows and gpu() dependencies
.github/workflows/_example_tests_runner.yml, .github/workflows/gpu_tests.yml, .github/workflows/regression_tests.yml, noxfile.py
Sets TORCH_CUDA_ARCH_LIST to "12.0" in workflow container environments and switches mamba_ssm/causal-conv1d installs from git URLs to released packages/sdists.
Force CPU-only unit test execution
noxfile.py
Adds a _CPU_ONLY_ENV dict clearing CUDA_VISIBLE_DEVICES and passes it into pytest invocations in unit() and partial_unit() sessions.
Update CUDA extension loading eligibility
modelopt/torch/utils/cpp_extension.py
Adds a runtime torch.cuda.is_available() check alongside the compiled-CUDA check, and moves TORCH_CUDA_ARCH_LIST auto-detection to only run when CUDA is eligible.
Move AWQ-Lite calibration regression to CUDA tests
tests/gpu/torch/quantization/test_calib_cuda.py, tests/unit/torch/quantization/test_calib.py
Adds a _TwoBranchModel-based CUDA test verifying input_quantizer stays enabled on the uncalibrated branch after AWQ-Lite quantization, and removes the corresponding skipped unit test.

Descriptor caching coverage

Layer / File(s) Summary
Add GPU descriptor caching test
tests/gpu/torch/puzzletron/test_resolve_descriptor_caching.py
Adds an end-to-end GPU test that resolves a pretrained Nemotron descriptor with trust_remote_code=True and asserts non-empty decoder layer classes.
Remove unit descriptor caching test
tests/unit/torch/puzzletron/test_resolve_descriptor_caching.py
Removes the MODEL_ID constant and the end-to-end test_resolve_descriptor_caches_dynamic_modules test from the unit suite.

Estimated code review effort: 2 (Simple) | ~12 minutes

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns ✅ Passed No banned patterns were added in the changed modelopt/examples code; the only trust_remote_code=True usages are in tests, outside the stated scope.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the CI/test hygiene changes and Puzzletron Nemotron failure fix.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kmorabia/fix-tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
noxfile.py (1)

111-120: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider pinning mamba_ssm/causal-conv1d versions.

Switching from git-tracking-main to PyPI releases fixes the immediate breakage, but installing unpinned "latest" packages reintroduces the same risk class (an unvetted upstream release breaking CI) that this PR is trying to fix. Pinning to a known-good version would make the CI build reproducible and prevent a future release from silently reintroducing the apache-tvm-ffi incompatibility or similar issues.

♻️ Example pin
-        # Install the latest *released* sdists (built against the container torch)
-        "mamba_ssm",
-        "causal-conv1d",
+        # Install known-good released sdists (built against the container torch)
+        "mamba_ssm==2.2.4",
+        "causal-conv1d==1.5.0.post8",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@noxfile.py` around lines 111 - 120, The package install in the nox session is
still using unpinned PyPI releases, which can make CI non-reproducible and
reintroduce upstream breakages. Update the install logic in the session that
calls session.run for pip install so mamba_ssm and causal-conv1d are pinned to
known-good versions instead of “latest” releases. Use the existing nox session
block as the place to apply the version pins and keep the build behavior stable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@noxfile.py`:
- Around line 111-120: The package install in the nox session is still using
unpinned PyPI releases, which can make CI non-reproducible and reintroduce
upstream breakages. Update the install logic in the session that calls
session.run for pip install so mamba_ssm and causal-conv1d are pinned to
known-good versions instead of “latest” releases. Use the existing nox session
block as the place to apply the version pins and keep the build behavior stable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 97beb32c-02a8-48d6-97d0-304d7976cbaf

📥 Commits

Reviewing files that changed from the base of the PR and between d1c8ea9 and f2965c9.

📒 Files selected for processing (4)
  • .github/workflows/_example_tests_runner.yml
  • .github/workflows/gpu_tests.yml
  • .github/workflows/regression_tests.yml
  • noxfile.py

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.69%. Comparing base (75b5803) to head (bd0d970).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
modelopt/torch/utils/cpp_extension.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1901       +/-   ##
===========================================
+ Coverage   61.21%   77.69%   +16.48%     
===========================================
  Files         515      515               
  Lines       57245    57977      +732     
===========================================
+ Hits        35043    45047    +10004     
+ Misses      22202    12930     -9272     
Flag Coverage Δ
examples 43.14% <50.00%> (+10.27%) ⬆️
gpu 58.56% <50.00%> (+38.04%) ⬆️
regression 14.83% <0.00%> (+0.06%) ⬆️
unit 54.93% <25.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Set CUDA_VISIBLE_DEVICES="" in tests/unit/conftest.py so unit tests always run
on CPU even on a GPU machine: device-agnostic tests take their CPU path, and a
test that explicitly needs CUDA now fails loudly (belongs in tests/gpu) instead
of being silently skipped in CI's CPU-only container.

Move test_awq_lite_uncalibrated_linear_keeps_input_quantizer_enabled (the only
such unit test, NVFP4 CUDA-only) to tests/gpu so it actually runs in CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
@kevalmorabia97 kevalmorabia97 changed the title ci: fix Nemotron puzzletron failures and speed up CUDA builds ci: fix Nemotron nightly failures + CUDA build/test hygiene Jul 5, 2026
@kevalmorabia97 kevalmorabia97 requested a review from a team as a code owner July 5, 2026 14:12
test_resolve_descriptor_caches_dynamic_modules needs mamba_ssm (only installed
in the GPU lane) and a real Nemotron-H checkpoint, so it can only ever be
skipped in the CPU-only unit lane. Move it to tests/gpu where mamba_ssm is
available; the two mocked tests in the class stay in unit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/gpu/torch/puzzletron/test_resolve_descriptor_caching.py`:
- Around line 36-42: `decoder_layer_cls()` can return either a single class or a
list, but the diagnostic print in `test_resolve_descriptor_caching` assumes it
is always iterable. Update the test to normalize the result from
`descriptor.decoder_layer_cls()` before printing, so the debug output handles
both `Type[nn.Module]` and `List[Type[nn.Module]]` safely. Keep the `assert
layer_classes` check as-is, and adjust the print logic near
`descriptor`/`layer_classes` to avoid iterating over a single class.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dbfd3458-a5ad-4750-bb43-7234c3c37cab

📥 Commits

Reviewing files that changed from the base of the PR and between f21680c and 5377209.

📒 Files selected for processing (2)
  • tests/gpu/torch/puzzletron/test_resolve_descriptor_caching.py
  • tests/unit/torch/puzzletron/test_resolve_descriptor_caching.py
💤 Files with no reviewable changes (1)
  • tests/unit/torch/puzzletron/test_resolve_descriptor_caching.py

Comment thread tests/gpu/torch/puzzletron/test_resolve_descriptor_caching.py
@kevalmorabia97 kevalmorabia97 requested a review from a team as a code owner July 5, 2026 18:06
@kevalmorabia97 kevalmorabia97 requested a review from ChenhanYu July 5, 2026 18:06
Set CUDA_VISIBLE_DEVICES="" in the nox unit/partial_unit session env (before the
pytest process imports torch, unlike tests/unit/conftest.py which runs after the
root conftest already initialized CUDA), so torch.cuda.is_available() is False on
GPU dev boxes too. Gate load_cpp_extension on torch.cuda.is_available() so no CUDA
extension is JIT-compiled when no GPU is usable, and drop the ineffective
CUDA_VISIBLE_DEVICES line from tests/unit/conftest.py.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-06 08:18 UTC

@kevalmorabia97 kevalmorabia97 changed the title ci: fix Nemotron nightly failures + CUDA build/test hygiene ci: fix Puzzletron Nemotron test failures + CUDA build/test hygiene Jul 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
noxfile.py (1)

115-124: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add explicit version caps for mamba_ssm and causal-conv1d.

Floating released PyPI versions can bring this nightly GPU job back into the same failure mode; cap these to a known-good pair, or document why tracking upstream releases is intentional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@noxfile.py` around lines 115 - 124, The pip install step in the session setup
is still pulling floating released sdists for mamba_ssm and causal-conv1d, which
can reintroduce the GPU failure; update the install list in the session.run
block to pin both packages to a known-good compatible version pair, or add a
clear inline note explaining why unpinned upstream tracking is intentional. Use
the session.run call in noxfile.py as the target location.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@noxfile.py`:
- Around line 115-124: The pip install step in the session setup is still
pulling floating released sdists for mamba_ssm and causal-conv1d, which can
reintroduce the GPU failure; update the install list in the session.run block to
pin both packages to a known-good compatible version pair, or add a clear inline
note explaining why unpinned upstream tracking is intentional. Use the
session.run call in noxfile.py as the target location.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3ca8ab0a-6ec6-4878-870a-f25c415ac8c6

📥 Commits

Reviewing files that changed from the base of the PR and between 5377209 and 290196a.

📒 Files selected for processing (2)
  • modelopt/torch/utils/cpp_extension.py
  • noxfile.py

kevalmorabia97 and others added 2 commits July 5, 2026 21:29
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
run_example_command now captures the subprocess output and, on a non-zero exit
matching a transient HF/network signature (5xx, rate limit, dropped connection,
interrupted download), retries before failing. Non-transient failures still raise
CalledProcessError immediately, so real example bugs are not masked. Reduces
flaky example/GPU test failures caused by HF Hub server issues.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
@kevalmorabia97 kevalmorabia97 changed the title ci: fix Puzzletron Nemotron test failures + CUDA build/test hygiene ci: fix Nemotron nightly and harden GPU/example test reliability Jul 6, 2026
@kevalmorabia97 kevalmorabia97 changed the title ci: fix Nemotron nightly and harden GPU/example test reliability CI: CUDA build/test hygiene + fix Puzzletron Nemotron test failures Jul 6, 2026
kevalmorabia97 and others added 2 commits July 6, 2026 00:14
Add a skip_flaky_on_blackwell pytest marker (sm_120) and apply it to
test_homogeneous_sharded_state_dict and the test_regular_state_dict[hidden_size=320]
case. Both intermittently hit a CUDA illegal memory access on the nemo:26.06 /
TE 2.16 / CUDA 13 stack that poisons the CUDA context and cascades 120s timeouts
across gpu_megatron. Consolidates the ad-hoc per-site skips into one marker/TODO;
still runs on non-Blackwell GPUs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
The VLM Minitron prune test is slow on the 2-GPU nightly runners and
intermittently exceeds the default per-test cap; bump it to 360s.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
@kevalmorabia97 kevalmorabia97 merged commit 795c589 into main Jul 6, 2026
90 of 91 checks passed
@kevalmorabia97 kevalmorabia97 deleted the kmorabia/fix-tests branch July 6, 2026 08:18
talorabr pushed a commit that referenced this pull request Jul 7, 2026
…1901)

### What does this PR do?

Type of change: Bug fix (CI / tests)

- **Fix Nemotron nightly failures:** install `mamba_ssm`/`causal-conv1d`
from PyPI releases instead of git `main` (avoids the broken
`apache-tvm-ffi 0.1.12` that crashes on import).
- **Speed up CUDA builds:** set `TORCH_CUDA_ARCH_LIST=12.0` (runner's
sm_120) in the GPU/example/regression workflow container env instead of
the image's ~6 archs.
- **Make unit tests CPU-only:** force CUDA off in the nox `unit` env and
skip JIT-compiling CUDA extensions when no GPU is usable; move the two
GPU-/`mamba_ssm`-requiring unit tests to `tests/gpu`.
- **Harden example tests against HF flakes:** capture subprocess output
and retry transient HuggingFace access errors (5xx / rate-limit /
connection).
- **Skip Blackwell-flaky sharded-state-dict tests:**
`test_homogeneous_sharded_state_dict` and `test_regular_state_dict[320]`
intermittently hit a CUDA illegal-memory-access on the sm_120 runner
that poisons the CUDA context and cascades timeouts; gate them behind a
reusable `skip_flaky_on_blackwell` marker (still run on non-Blackwell
GPUs).
- **Bump slow test timeout:** `test_prune_minitron_vlm` → 360s for the
2-GPU nightly.

### Testing

- CI tests on this PR pass (1-gpu)
- Manually triggerred 2-gpu test:
- GPU:
https://github.com/NVIDIA/Model-Optimizer/actions/runs/28774553356
- Examples:
https://github.com/NVIDIA/Model-Optimizer/actions/runs/28774556693
- Regression:
https://github.com/NVIDIA/Model-Optimizer/actions/runs/28771197586

### Additional Information

- Backward compatible: N/A (CI/tests only)
- New dependency: N/A
- Changelog: N/A (CI/test infra)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: talora <talora@nvidia.com>
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