Skip to content

Fix: raise RuntimeError when cudagraph partitions are empty - #176619

Closed
mhusnain-tech wants to merge 25 commits into
pytorch:mainfrom
mhusnain-tech:patch-11
Closed

mhusnain-tech wants to merge 25 commits into
pytorch:mainfrom
mhusnain-tech:patch-11

Conversation

@mhusnain-tech

@mhusnain-tech mhusnain-tech commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

This commit ensures that 'log_cudagraph_skip_and_bump_counter' is called when 'cudagraph_partition_post_compile' returns early due to empty partitions.

This prevents silent failures when 'cudagraph_or_error=True' is set, ensuring the expected RuntimeError is raised instead of silently falling back to eager execution. Verified using the reproduction script in issue #176611.

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @jataylo

@pytorch-bot

pytorch-bot Bot commented Mar 5, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/176619

Note: Links to docs will display an error until the docs builds have been completed.

❌ 20 New Failures, 3 Cancelled Jobs, 2 Unrelated Failures, 5 Unclassified Failures

As of commit 3e2b1ec with merge base 88f350b (image):

NEW FAILURES - The following jobs have failed:

UNCLASSIFIED FAILURES - DrCI could not classify the following jobs because the workflow did not run on the merge base. The failures may be pre-existing on trunk or introduced by this PR:

  • pull / linux-jammy-cuda13.2-cudnn9-py3.10-clang18 / build (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)
    Pod mt-l-x86iavx512-8-64-4zvdj-runner-qjq42-workflow: phase=Pending, conditions=[PodReadyToStartContainers=True, Initialized=True, Ready=False, ContainersReady=False, PodScheduled=True], waiting=[job: ErrImagePull] (3439s/7200s)
  • pull / linux-jammy-py3.10-clang21 / build (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)
    Pod mt-l-x86iavx512-8-64-n2wc5-runner-wm9pj-workflow: phase=Pending, conditions=[PodReadyToStartContainers=True, Initialized=True, Ready=False, ContainersReady=False, PodScheduled=True], waiting=[job: ErrImagePull] (2216s/7200s)
  • pull / linux-jammy-py3.10-clang21-asan / build (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)
    Pod mt-l-x86iavx512-8-64-4zvdj-runner-nzzm9-workflow: phase=Pending, conditions=[PodReadyToStartContainers=True, Initialized=True, Ready=False, ContainersReady=False, PodScheduled=True], waiting=[job: ErrImagePull] (2257s/7200s)
  • pull / linux-jammy-py3.14-clang21 / build (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)
    [runner-container-hooks] FATAL: Error: pod failed to come online with error: Error: Pod mt-l-x86iavx512-8-64-4zvdj-runner-mbbhv-workflow is unhealthy with phase status Pending: backoff timeout
  • pull / linux-jammy-py3.14t-clang21 / build (gh) (this job did not run on the merge base, so DrCI cannot tell whether the failure is pre-existing)
    Pod mt-l-x86iavx512-8-64-4zvdj-runner-pg6js-workflow: phase=Pending, conditions=[PodReadyToStartContainers=True, Initialized=True, Ready=False, ContainersReady=False, PodScheduled=True], waiting=[job: ErrImagePull] (2216s/7200s)

CANCELLED JOBS - The following jobs were cancelled. Please retry:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@kshitij12345 kshitij12345 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we should add a test to make sure this isn't regressed.

@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

Hi @kshitij12345, thank you for the review. I agree that adding a regression test is important. I am working on adding a test case to verify that the RuntimeError is correctly raised when partitions are empty. I will update the PR shortly.

@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

Hi @kshitij12345, I have successfully added the regression test to this PR in test/inductor/test_cudagraph_trees.py. It verifies the fix for issue #176611 by ensuring a RuntimeError is raised when no graphable partitions are found with cudagraph_or_error=True. Ready for review!

@zou3519 zou3519 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Mar 7, 2026
@zou3519
zou3519 requested a review from BoyuanFeng March 7, 2026 01:42
Comment thread test/inductor/test_cudagraph_trees.py Resolved
Comment thread test/inductor/test_cudagraph_trees.py Resolved
@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

Hi @BoyuanFeng, I have addressed your comments and marked the conversations as resolved. I've also updated the implementation in output_code.py to include the specific error message as discussed. Could you please take another look at the latest commits? Thanks!

@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

Hi @BoyuanFeng, just following up to see if you've had a chance to look at the latest updates. Let me know if any further changes are needed. Thanks!

@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

@pytorchbot label "topic: not user facing"

@pytorch-bot pytorch-bot Bot added the topic: not user facing topic category label Mar 21, 2026
@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

Hi @kshitij12345, @BoyuanFeng — just a gentle follow-up on this. I have addressed all the feedback, added the requested regression tests in test_cudagraph_trees.py, and resolved the conversations.

Could one of the maintainers please approve the CI to run? It’s currently blocked awaiting approval for the latest commits. I've also added the missing label. Thanks for your time!

@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

CC: @jansel

While we’re finalizing the divisibility logic in #177156, I wanted to highlight this Inductor fix as well.

It addresses a RuntimeError that occurs when cudagraph partitions are empty, ensuring the error is raised correctly instead of failing silently. I've already:

  • Resolved all previous reviewer comments.
  • Added a regression test in test_cudagraph_trees.py.
  • Verified the fix locally.

Since this falls under Inductor stability, I'd appreciate your eyes on it when you have a moment to move this toward a merge. Thanks!

@jansel jansel added ciflow/trunk Trigger trunk jobs on your pull request ciflow/inductor labels Mar 24, 2026
@pytorch-bot pytorch-bot Bot removed ciflow/trunk Trigger trunk jobs on your pull request ciflow/inductor labels Mar 25, 2026
@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

CC: @jansel @BoyuanFeng @kshitij12345

Thanks for the reviews and for triggering the CI tests.

I have addressed the linting errors and the undefined reference identified in the recent test runs. Specifically, I have:

  • Fixed Undefined Reference: Properly imported V from torch._inductor.virtualized.
  • Resolved Lint Violations: Refactored long lines in the test file to comply with PEP8/PyTorch linting standards.
  • Verified Locally: Ensured the changes pass the local lint checks.

The latest commits (9f829e3 and 98f4c53) should now resolve the blocking issues. I’d appreciate it if you could take another look when you have a moment.

Thanks!

Comment thread test/inductor/test_cudagraph_trees.py Outdated
mock_post_compile.return_value = []

def fn(x):
return x * 2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of patching, you can use

def f(x):
    return torch.cond(x.sum() > 0, lambda x: x * 2, lambda x: x * 3, (x,))

which leads to cudagraph partition.

Comment thread torch/_inductor/output_code.py Outdated
log_cudagraph_skip_and_bump_counter(
"skipping cudagraphs as len(compiled_graph.partition_maps) == 0"
)
if V.config.inductor.cudagraph_or_error:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we hit either if or elif or else and error before we hit the runtime error here? I think this branch is not required.

@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

Hi @kshitij12345, I've refactored the code to remove the redundant branches and the monkey patching in tests as suggested. I'm now using torch.cond to trigger the partition error naturally. Ready for another look!

Comment thread test/inductor/test_cudagraph_trees.py Outdated
obs.op_outputs[aten.rand.default][2],
)

def test_cudagraph_empty_partition_raises_error(self, mock_post_compile):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

mock_post_compile is unused.

Comment thread torch/_inductor/output_code.py Outdated
maybe_handle_backward_generation(compiled_graph, boxed_forward_device_index)
# Raise an error if no CUDA graphable partitions are found and the user
# has explicitly enabled the 'cudagraph_or_error' configuration.
if config.inductor.cudagraph_or_error and len(compiled_graph.partition_maps) == 0:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should use log_cudagraph_skip_and_bump_counter (as it does some booking keeping about cudagraph related counters) and catch the relevant error in the test (probably a torch._inductor.exc.InductorError is raised).

I think the original messages were helpful in pointing the reason

        # Log reasons and raise error if cudagraph_or_error=True
        if cudagraph_fail_reasons:
            log_cudagraph_skip_and_bump_counter(f"skipping cudagraphs due to {cudagraph_fail_reasons=}")
        elif compiled_graph.partition_maps is None:
            log_cudagraph_skip_and_bump_counter("skipping cudagraphs as compiled_graph.partition_maps is None")
        else:
            log_cudagraph_skip_and_bump_counter("skipping cudagraphs as len(compiled_graph.partition_maps) == 0")

Ref:

def log_cudagraph_skip_and_bump_counter(msg: str) -> None:
cudagraphs_log.warning(msg)
counters["inductor"]["cudagraph_skips"] += 1
if torch._inductor.config.triton.cudagraph_or_error:
raise RuntimeError(msg)
metrics_context = get_metrics_context()
if metrics_context.in_progress():
metrics_context.set("cudagraph_skip_reason", msg, overwrite=True)

@mhusnain-tech

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed feedback and the reference to log_cudagraph_skip_and_bump_counter.

I have refactored the PR with the following changes:

  1. Refactored Logic: Updated torch/_inductor/output_code.py to use the log_cudagraph_skip_and_bump_counter helper. This ensures we follow the standard Inductor mechanism for logging skips and raising RuntimeError when cudagraph_or_error is enabled, removing redundant manual checks.

  2. Test Cleanup: In test/inductor/test_cudagraph_trees.py, I've removed the unused mock_post_compile argument and the manual patching.

  3. Natural Trigger: As suggested, I'm now using a torch.cond example to naturally trigger a graph partition skip, which provides a more robust and realistic test case.

  4. Error Verification: Updated the test to catch the specific RuntimeError message generated by the helper function to ensure everything is wired correctly.

All tests are passing locally. Ready for another look!

Resolves style and formatting violations reported by the linter in
output_code.py to maintain consistency
Add @unittest.skipUnless decorator to test_cudagraph_empty_partition_raises_error to skip the test when CUDA is not available, fixing CI failures on non-GPU machines.
…re empty

When compiled_graph.partition_maps is empty and triton.cudagraph_or_error is enabled, raise RuntimeError instead of silently skipping cudagraphs.
This ensures users get explicit feedback when cudagraph compilation fails due to empty partitions.
Removed RuntimeError for empty partition_maps in cudagraphs.
Replace torch.cond-based reproducer, which triggers the existing
control-flow cudagraph rejection path, with a cudagraph_unsafe custom op that exercises the empty partition_maps branch directly.
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Successfully rebased patch-11 onto refs/remotes/origin/viable/strict, please pull locally before adding more changes (for example, via git checkout patch-11 && git pull --rebase)

gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
…176619)

This commit ensures that 'log_cudagraph_skip_and_bump_counter' is called when  'cudagraph_partition_post_compile' returns early due to empty partitions.

This prevents silent failures when 'cudagraph_or_error=True' is set, ensuring the expected RuntimeError is raised instead of silently falling back to eager execution. Verified using the reproduction script in issue pytorch#176611.

Pull Request resolved: pytorch#176619
Approved by: https://github.com/kshitij12345, https://github.com/BoyuanFeng, https://github.com/jansel
@zou3519
zou3519 removed their request for review July 22, 2026 14:48
@jansel

jansel commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

@claude review these changes, have all the prior comments been fixed?

@claude

claude Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Claude finished @jansel's task in 32m 34s —— View job


Yes — all prior review comments have been substantively addressed, and the current trunk/lint CI failures are unrelated infrastructure noise, but the review found three small test-robustness issues worth fixing (most notably the test silently depends on graph_partition's OSS-only default).

PR Review: #176619 — full details

Prior Comments Status

Comment Status
kshitij12345 (Mar 6): add a regression test ✅ Done — test_cudagraph_empty_partition_raises_error at test/inductor/test_cudagraph_trees.py:6677
BoyuanFeng (Mar 9): why the monkey-patch? / where is the error message added? ✅ Resolved — mocking removed entirely; custom error message replaced by the standard helper
kshitij12345 (Mar 27): use log_cudagraph_skip_and_bump_counter with the 3-branch if/elif/else structure ✅ Done — torch/_inductor/output_code.py:347-358 matches the suggested structure exactly
kshitij12345 (Mar 30): unused import ✅ Removed
Claude analysis (Jun 23): test never enabled cudagraphs; redundant manual raise RuntimeError ✅ Both fixed — test now uses mode="reduce-overhead" (commit 8635228), redundant raise removed (commit e4bedc5)
GodlyDonuts (Jul 14): replace torch.cond repro with a cudagraph_unsafe custom op ✅ Adopted (commit 54e91b9) — this exercises the exact empty-partition_maps branch, and the inductor CI workflow now passes
jansel (Jun 23): fix test failures ✅ The latest inductor workflow run is green; the test no longer fails

Current CI Failures — all unrelated

  • trunk: 4 new failures are macOS-only (test_dispatch, profiler/test_cpp_thread timeout, 2× MPS bfloat16) — all AI-verdicted as unrelated; this PR touches only CUDA-graph partition code.
  • Lint (run 30026754431): CLANGTIDY_EXECUTORCH_COMPATIBILITY linter crashed with FileNotFoundError: .../build (missing build dir on the runner) — an infra bug, and the newer Lint run (30028648936) on the same commit passed.
  • ROCm mi350 failure is flagged flaky by Dr. CI and needs only a rebase.

Testing — remaining issues

  1. Test does not force graph_partition=True — cudagraph_partition_post_compile (the function this PR modifies) is only invoked when config.graph_partition is true (torch/_inductor/output_code.py:913). That default is "1" if not is_fbcode() else "0" (torch/_inductor/config.py:599-602), so in fbcode the test takes the cudagraph_post_compile path instead, where the failure message is "skipping cudagraphs due to ..." — the "skipping cudagraphs as len" regex won't match and the test will fail internally. Other tests in this file explicitly patch it (e.g. line 819). Add "graph_partition": True to the config.patch dict at test_cudagraph_trees.py:6699-6704.

  2. Test placed in TestSAC (test_cudagraph_trees.py:6277) — that class covers Selective Activation Checkpointing / RNG behavior; a cudagraph-partition regression test belongs in CudaGraphTreeTests (this misplacement is also why the earlier revert cited TestSAC::test_cudagraph_empty_partition_raises_error).

  3. @unittest.skipUnless(torch.cuda.is_available(), "CUDA required") at line 6676 is dead code — the whole block is already gated by if HAS_CUDA_AND_TRITON: (line 153). It was added to fix the May revert, but the actual failure was the missing cudagraph enablement, since fixed. Remove it.

  4. make_fallback(...) mutates global lowering state (test_cudagraph_trees.py:6692-6694) and is never undone, leaking into subsequent tests in the same process. The reason it's needed is that this file's base TestCase sets implicit_fallbacks: False (line 134). The cleaner, established pattern in this same file is @config.patch(implicit_fallbacks=True) on the test (see test_graph_partition_custom_op, line 818), which makes the custom op fall back automatically and is scoped to the test.

Fix these →

Recommendation

Request Changes (minor) — the substance of every prior review comment is resolved and the fix itself (output_code.py:347-358) is correct and matches kshitij12345's suggested structure. The blocking concern is #1 above: without "graph_partition": True the new regression test only works by way of an environment-dependent default, which is exactly the kind of latent breakage that got this PR reverted once already. Items 2–4 are quick cleanups to do in the same pass.


  • Gather PR diff and commit history
  • Review changed code against checklist
  • Verify each prior review comment has been addressed
  • Post review

@jansel

jansel commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@claude review these changes again

@claude

claude Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Claude finished @jansel's task in 26m 43s —— View job


Re-reviewed: all four items from my last pass are addressed except three test cleanups (misplaced class, dead decorator, global make_fallback), and I found one new issue — the cudagraph_fail_reasons branch now emits a cudagraph_fail_reasons=[...] -style message that doesn't match the established skip-message format and turns a previously-silent path into a hard error under cudagraph_or_error=True.

PR Review: #176619 — full details

Summary

The PR makes cudagraph_partition_post_compile log (and, under triton.cudagraph_or_error=True, raise) instead of returning silently when there are no cudagraphable partitions. The core fix at torch/_inductor/output_code.py:347-358 is structured exactly as @kshitij12345 requested, the redundant manual raise is gone, and the regression test now exercises the real branch via a cudagraph_unsafe custom op. Remaining issues are all in the surrounding details, listed below.

Status of prior review comments

Comment Status
kshitij12345 (Mar 6): add a regression test Done — test_cudagraph_empty_partition_raises_error, test/inductor/test_cudagraph_trees.py:6677
BoyuanFeng (Mar 9): why the monkey-patch / where's the message Resolved — mocking gone, custom message replaced by the standard helper
kshitij12345 (Mar 27): use log_cudagraph_skip_and_bump_counter with the 3-branch structure Done — output_code.py:347-358
kshitij12345 (Mar 30): unused import Done
Claude (Jun 23): test never enabled cudagraphs; redundant manual raise Both done — mode="reduce-overhead" (8635228), redundant raise removed (e4bedc5)
GodlyDonuts (Jul 14): use a cudagraph_unsafe custom op instead of torch.cond Adopted (54e91b9); the inductor workflow is green on 8c54adaa
Claude (Jul 24) item 1: don't rely on the OSS-only graph_partition default Done — "graph_partition": True added to the patch dict (8c54ada)
Claude (Jul 24) items 2-4: test class placement, dead skip decorator, make_fallback Not addressed — see Testing below

Code Quality

output_code.py:347-350 uses the = self-documenting f-string form:

log_cudagraph_skip_and_bump_counter(
    f"skipping cudagraphs due to {cudagraph_fail_reasons=}"
)

This renders the literal variable name into a user-visible warning — skipping cudagraphs due to cudagraph_fail_reasons=['mutated inputs (1 instances)...']. The sibling call in cudagraph_post_compile at output_code.py:308-310 formats the same variable without =, and every other skip message in this area goes through format_default_skip_message (cudagraph_utils.py:281-282). @kshitij12345's suggested snippet did contain the =, but it reads as a debugging artifact in the message users actually see. Drop the = to match line 309.

This branch is also not just a formatting concern. It is reachable when disabled_cudagraphs_reason is falsy but one of the cudagraph_tests entries at output_code.py:683-705 failed — specifically force_disable_cudagraph_TESTING_ONLY and "non-Tensor inputs", which populate cudagraph_fail_reasons without setting disabled_cudagraphs_reason (contrast lines 672 and 681, which do set it). Pre-PR, that early return logged nothing at all in the partition path, so with graph_partition=True these graphs now newly bump counters["inductor"]["cudagraph_skips"] and newly raise under cudagraph_or_error=True. That's broader than "empty partitions" as described in the PR body. It's plausibly the right behavior — it matches the non-partition path — but it should be stated in the commit message so a future bisect doesn't have to rediscover it, since exact-value cudagraph_skips assertions exist in test/inductor/test_compiled_autograd.py, test/functorch/test_control_flow.py, and test/dynamo/test_compiler_bisector.py.

Testing

  1. Test lives in the wrong class. test_cudagraph_empty_partition_raises_error is inside TestSAC (test_cudagraph_trees.py:6277), which covers Selective Activation Checkpointing and RNG behavior. It belongs in CudaGraphTreeTests (line 173), alongside the other graph_partition/cudagraph_unsafe tests. This is also why the earlier revert cited TestSAC::test_cudagraph_empty_partition_raises_error, which reads as an unrelated subsystem breaking.

  2. @unittest.skipUnless(torch.cuda.is_available(), "CUDA required") at line 6676 is dead code — the entire class is already inside if HAS_CUDA_AND_TRITON: (line 153). It was added to chase the May revert, but the real cause there was the missing cudagraph enablement, since fixed. Remove it.

  3. make_fallback(...) at lines 6692-6694 mutates process-global lowering state and never restores it. It writes into the lowerings dict via register_lowering and calls add_needs_realized_inputs (torch/_inductor/lowering.py:2870-2876), leaking into every subsequent test in the same process. It is only needed because this file's base TestCase pins implicit_fallbacks: False (line 134). The scoped equivalent already used in this file is a @config.patch(implicit_fallbacks=True) decorator, which overrides the class-level setting and lets graph.py:1403 auto-create the fallback — see test_graph_partition_custom_op_mutation_with_cudagraph_unsafe at line 818, which registers a cudagraph_unsafe custom op with no make_fallback at all.

  4. The test only asserts the raise, not the skip bookkeeping. The stated motivation for routing through log_cudagraph_skip_and_bump_counter was the counter bookkeeping, but nothing checks it. Add a counters["inductor"]["cudagraph_skips"] assertion under cudagraph_or_error=False (or a FileCheck on the cudagraphs log, as at lines 3330-3333) so the non-erroring default path is covered too — right now a regression that dropped the counter bump would still pass.

  5. "triton.cudagraph_trees": True in the patch dict at line 6701 is already the default; harmless, but it reads as load-bearing when it isn't.

CI

Nothing on the latest commit 8c54adaa looks related. inductor (run 30210645073) — including the job that runs this test — is green, as are Lint (30210643842), TSan, BC Lint, docs-build, and torchtitan-test. The trunk failures are macOS-only (test_dispatch, and two MPS bfloat16 tests), which cannot touch CUDA-graph partitioning; the pull failure is linux-jammy-cuda13.2-cudnn9-py3.10-clang18 / build failing in the Initialize containers step (Executing the custom container implementation failed), a runner infra error; and the earlier Lint run 30201765361 was superseded by a passing run on the same commit. Dr. CI's per-job verdicts agree.

Fix these →

Recommendation

Request Changes (minor). The core fix is correct and every substantive prior comment is resolved. Blocking items are the three unaddressed test cleanups (wrong class, dead decorator, un-scoped make_fallback) and the {cudagraph_fail_reasons=} message format; the widened cudagraph_fail_reasons behavior should also be called out in the commit message.

  • Gather current diff and commits
  • Verify the items from my previous review are fixed
  • Check current CI status
  • Fact-check findings and post review
    | Branch: patch-11

…s=None branches; only raise on empty partitions
…raising behavior for unrelated skip branches
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
…176619)

This commit ensures that 'log_cudagraph_skip_and_bump_counter' is called when  'cudagraph_partition_post_compile' returns early due to empty partitions.

This prevents silent failures when 'cudagraph_or_error=True' is set, ensuring the expected RuntimeError is raised instead of silently falling back to eager execution. Verified using the reproduction script in issue pytorch#176611.

Pull Request resolved: pytorch#176619
Approved by: https://github.com/kshitij12345, https://github.com/BoyuanFeng, https://github.com/jansel
@github-actions

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

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

Labels

ci-no-td Do not run TD on this PR ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request Merged module: inductor open source Reverted Stale topic: not user facing topic category triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants