Skip to content

[precompile] Compose a custom guard_filter_fn with the default instead of replacing it - #194284

Closed
bobrenjc93 wants to merge 3 commits into
gh/bobrenjc93/1006/basefrom
gh/bobrenjc93/1006/head
Closed

bobrenjc93 wants to merge 3 commits into
gh/bobrenjc93/1006/basefrom
gh/bobrenjc93/1006/head

Conversation

@bobrenjc93

@bobrenjc93 bobrenjc93 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

default_guard_filter_fn is not a default in the "sensible starting point"
sense -- it is what drops the identity guards that CANNOT be serialized at all.
Passing guard_filter_fn replaced it outright, so a caller who wanted to drop
three of their own guards silently re-admitted every unserializable one, and the
failure landed as "ID_MATCH guard cannot be serialized" in frames that had
nothing to do with their filter. That misattribution cost a user a full debug
cycle on a capture that takes minutes.

A custom filter can only ever want to drop MORE, never to re-admit a guard type
that cannot be written down, so the two compose with AND. A filter that returns
the wrong number of decisions now says so instead of silently zipping short.

Also makes PrecompileSummary.complete require backend_graphs > 0.
guarded_codes alone cannot tell a real capture from an empty one:
allow_empty_graphs -- which precompile pins on, and needs, so that a frame
compiling nothing does not raise SkipFrame -- lets such a frame still count as
one guarded code. A model whose every graph sits behind a recursive
torch._dynamo.disable therefore reported complete while carrying no compiled
compute at all, and the default require_complete=True waved it through.

Test Plan:

python test/test_precompile.py
python test/dynamo/test_package.py

The two tests that pinned the replacing behaviour are replaced by their
inverses: a keep-everything filter no longer re-admits unserializable guards,
and a drop-everything filter still only narrows what the default kept.

Authored with an AI assistant.

Differential Revision: D116840939

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 23 New Failures, 1 Unrelated Failure

As of commit 03d3b95 with merge base 1b4e490 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@pytorch-bot pytorch-bot Bot added ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests module: dynamo labels Aug 20, 2026
@bobrenjc93 bobrenjc93 added ciflow/trunk Trigger trunk jobs on your pull request topic: not user facing topic category labels Aug 20, 2026
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

This was referenced Aug 22, 2026
[ghstack-poisoned]
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

[ghstack-poisoned]
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@bobrenjc93

Copy link
Copy Markdown
Contributor Author

@bobrenjc93 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@bobrenjc93

Copy link
Copy Markdown
Contributor Author

Superseded by the canonical precompile stack #195353-#195362; this change lives in #195360. Closing to consolidate review there. The branch is kept on GitHub.

@bobrenjc93 bobrenjc93 closed this Sep 3, 2026
@github-actions
github-actions Bot deleted the gh/bobrenjc93/1006/head branch November 11, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/inductor ciflow/torchtitan Run TorchTitan integration tests ciflow/trunk Trigger trunk jobs on your pull request module: dynamo topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant