-
Notifications
You must be signed in to change notification settings - Fork 24.2k
[Dynamo] Introduce hook receiving set of traced files #153622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh/jbschlosser/246/base
Are you sure you want to change the base?
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/153622
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 3 Unrelated FailuresAs of commit dc5a663 with merge base 9c11493 ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR: * Expands `Hooks` with a new, optional `frame_traced_fn` field. It should be a callable receiving the set of traced filenames * Maintains a set of `traced_files` in the `TracingContext` of an `OutputGraph` * Whenever an `inline_call()` is encountered, the corresponding filename is added to this set * `OutputGraph`'s `co_fields["co_filename"]` is added to the set before the hook is called I believe use of this hook should enable the source code hashing that vLLM does in a better way than monkey-patching `inline_call()`. cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames [ghstack-poisoned]
@@ -865,6 +865,8 @@ def __init__(self, fake_mode): | |||
# see note: [Returning Fake Tensors on First AOT Autograd Call] | |||
self.fakify_first_call = False | |||
self.hop_dispatch_set_cache = HopDispatchSetCache() | |||
# set of filenames for inlined functions | |||
self.traced_files: set[str] = set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OrderedSet or list
# they are benign and do not generate any new graphs. | ||
hooks.guard_export_fn(output.guards) | ||
if hooks.frame_traced_fn is not None: | ||
output.tracing_context.traced_files.add(output.co_fields["co_filename"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the filename enough? One file can have many things in it. Maybe a function or code object would enable more use cases.
Stack from ghstack (oldest at bottom):
This PR:
Hooks
with a new, optionalframe_traced_fn
field. It should be a callable receiving the set of traced filenamestraced_files
in theTracingContext
of anOutputGraph
inline_call()
is encountered, the corresponding filename is added to this setOutputGraph
'sco_fields["co_filename"]
is added to the set before the hook is calledI believe use of this hook should enable the source code hashing that vLLM does in a better way than monkey-patching
inline_call()
.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames