Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/162016
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 83839cf with merge base 322091d ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
|
||
| base_schedule.register_custom_function(FORWARD, forward_callback) | ||
| base_schedule.register_custom_function(OVERLAP_F_B, overlap_callback) | ||
|
|
There was a problem hiding this comment.
I'm confused by this test. We didn't update callback_calls in overlap_callback. Do we expect overlap_callback to be called or not? And if yes, what's the test for overlap_callback?
There was a problem hiding this comment.
It is because overlap_callback calls forward_callback in its implementation. To make this less confusing I will use two counters and test that both are being called.
|
|
||
| # Check if computation_type is already registered | ||
| if computation_type in self._comp_type_to_function_map: | ||
| logger.warning( |
There was a problem hiding this comment.
Should we error out or warning? This seems to be an unexpected mistake from users.
There was a problem hiding this comment.
I'm thinking about whether users would want to change their custom function between steps, doesn't seem like this would be the case so maybe error-ing out is better. Let me think about it more
|
@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 |
Merge failedReason: Command Details for Dev Infra teamRaised by workflow job |
|
@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 |
BE cleaning up dead code since we migrated the Multi-stage schedules to use schedule execution runtime Pull Request resolved: #164962 Approved by: https://github.com/Skylion007 ghstack dependencies: #162016
Better engineering to move the `record_function` call to also encompass the custom callback, this line is the only change: https://github.com/pytorch/pytorch/pull/164976/files#diff-1d3d91f53db88fb886901fb178d69e47776e71b8103f85688fa9ca64cc55d068R2147, the rest is just formatting. Pull Request resolved: #164976 Approved by: https://github.com/fegin ghstack dependencies: #162016, #164962
This is going to be used in pytorch/torchtitan#1682 Add a `register_custom_function` to the `_PipelineScheduleRuntime` which allows users to implement any custom function to replace the runtime operation dynamically. The signature of the callback should look like: ```python class _CustomFunctionProtocol(Protocol): def __call__(self, action: _Action, ctx: _PipelineContext) -> None: ... ``` `_PipelineContext` contains a reference to the schedule which is executing the operations. ### Testing Added a test which adds custom methods for `FORWARD` and `OVERLAP_F_B` which are just the same implementations as those used in the default schedule runtime. Check that the schedule can still run, numerics are correct, and the callbacks are executed the correct number of times. Pull Request resolved: pytorch#162016 Approved by: https://github.com/fegin
BE cleaning up dead code since we migrated the Multi-stage schedules to use schedule execution runtime Pull Request resolved: pytorch#164962 Approved by: https://github.com/Skylion007 ghstack dependencies: pytorch#162016
Better engineering to move the `record_function` call to also encompass the custom callback, this line is the only change: https://github.com/pytorch/pytorch/pull/164976/files#diff-1d3d91f53db88fb886901fb178d69e47776e71b8103f85688fa9ca64cc55d068R2147, the rest is just formatting. Pull Request resolved: pytorch#164976 Approved by: https://github.com/fegin ghstack dependencies: pytorch#162016, pytorch#164962
Stack from ghstack (oldest at bottom):
This is going to be used in pytorch/torchtitan#1682
Add a
register_custom_functionto the_PipelineScheduleRuntimewhich allows users to implement any custom function to replace the runtime operation dynamically.The signature of the callback should look like:
_PipelineContextcontains a reference to the schedule which is executing the operations.Testing
Added a test which adds custom methods for
FORWARDandOVERLAP_F_Bwhich are just the same implementations as those used in the default schedule runtime. Check that the schedule can still run, numerics are correct, and the callbacks are executed the correct number of times.cc @awgu @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @pragupta @msaroufim @dcci @ezyang