Skip to content

Fix Cuda Graph based MOE Tests Hang in CI - #3210

Merged
vthumbe1503 merged 3 commits into
NVIDIA:mainfrom
vthumbe1503:grouped_linear_cuda_graph_test_hang
Jul 15, 2026
Merged

Fix Cuda Graph based MOE Tests Hang in CI#3210
vthumbe1503 merged 3 commits into
NVIDIA:mainfrom
vthumbe1503:grouped_linear_cuda_graph_test_hang

Conversation

@vthumbe1503

@vthumbe1503 vthumbe1503 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Description

make_graphed_callables function returns the module replaced with the graphed module. Recent pytorch upgrade caused the graph replay to hang due to insufficient cleanup.

Irresspective, we were comparing the forward and backward results of the same graphed module being run twice, instead of actually running the non graphed and graphed module and comparing their results numerically.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates grouped linear CUDA graph tests to avoid CI hangs and unstable padded-row checks. The main changes are:

  • Separate eager reference modules for grouped linear and grouped MLP comparisons.
  • State copied from graphed modules into the reference modules before expected-value checks.
  • Active-token-only assertions for padded grouped GEMM inputs.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
tests/pytorch/test_grouped_linear.py Creates an independent grouped linear reference module for eager CUDA graph safety comparisons.
tests/pytorch/test_grouped_mlp.py Uses independent reference grouped linear and MLP modules, and compares only active token rows for padded inputs.

Reviews (3): Last reviewed commit: "Merge branch 'main' into grouped_linear_..." | Re-trigger Greptile

@vthumbe1503

Copy link
Copy Markdown
Collaborator Author

Pipeline: 58029914

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@vthumbe1503 vthumbe1503 changed the title Fix GroupedLinear Test Hang in CI Fix Cuda Graph based MOE Tests Hang in CI Jul 15, 2026
@vthumbe1503
vthumbe1503 requested a review from timmoon10 July 15, 2026 18:22

@timmoon10 timmoon10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. Can you elaborate more on how "insufficient cleanup" was causing the hang?

Good catch that we weren't running the non-graphed implementation. It is awkward that make_graphed_callables changes the module forward so it always replays the graph, but this is also the behavior in torch.cuda.make_graphed_callables.

@vthumbe1503
vthumbe1503 merged commit 9d92fa0 into NVIDIA:main Jul 15, 2026
21 of 26 checks passed
@vthumbe1503

vthumbe1503 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

@timmoon10 I dug a bit deeper and actually it turns out the hang was due to CUDA graph replay compatibilty with CUBLAS GGEMM which exists currently. And it specifically happens on the second graph replay which was happening unintentionally in the test

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