-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Scheduler Flops refactor #152708
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
Scheduler Flops refactor #152708
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/152708
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit ff251ba with merge base 61dd2a0 ( 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. |
9f24018
to
da087e3
Compare
should fix #147137 |
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.
nice, looks good ! just one comment about testing
gm = make_fx(op)(*example_inputs, **kwargs) | ||
reference_flops = get_total_flops(mode) | ||
|
||
graph = GraphLowering(gm) | ||
|
||
with V.set_graph_handler(graph), V.set_debug_handler(DebugContext()): | ||
graph.run(*example_inputs, **kwargs) | ||
graph.init_wrapper_code() | ||
graph._update_scheduler() | ||
scheduler_flops = 0 | ||
for node in graph.scheduler.nodes: | ||
flops = node.estimate_flops() | ||
scheduler_flops += flops if flops is not None else 0 |
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.
nit: can we just make this a metric we store on counters ? I would rather we just run torch.compile
here.
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.
Thanks for the extension!
41d36ba
to
76ffe99
Compare
76ffe99
to
ff251ba
Compare
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.
nice !!
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Note this PR add the following 10% regression: ![]() |
Can we avoid invoking estimate_runtime() when it's not needed ? also can we cache the flops estimation for a particular op and input shapes ? |
@eellison yeah I think get_estimate_runtime is called for what amounts to some logging code in most cases, which probably shouldn't be happening: |
This refactors
estimate_flops
andget_estimated_runtime
on scheduler nodes:estimate_flops
. Works with all types of ir nodes now, not justExternalKernels
.get_estimated_runtime
to work with non-ExternalKernels
.Prelude to: #149697
Testing:
New unit tests cover functionality.
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov