-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Fixes #12673. record_stream in group offloading is not working properly
#12721
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: main
Are you sure you want to change the base?
Conversation
0de99c0 to
cef1ed6
Compare
|
Also relevant to Tencent-Hunyuan/HunyuanVideo-1.5#10 |
sayakpaul
left a comment
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 your PR!
Could we also run the test_group_offloading tests?
pytest tests/models -k "test_group_offloading"?
Running pytest: |
record_stream is not working properlyrecord_stream in group offloading is not working properly
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
DN6
left a comment
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 @KimbingNg I think we might also need to make a similar change to _offload_to_disk.
Wrong default_stream is used. leading to wrong execution order when record_steram is enabled.
60444c5 to
9159ed7
Compare
|
@DN6 , I found the root cause!!!! The As for the I force push a new commit, please help reviewing that again, thanks! |
|
@KimbingNg Ah great catch! 👍🏽 |
sayakpaul
left a comment
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.
We can also remove the following lines:
if self.__class__.__name__ == "AutoencoderKLCosmosTests" and offload_type == "leaf_level":
pytest.skip("With `leaf_type` as the offloading type, it fails. Needs investigation.")
in the test_group_offloading_with_disk() test implementation.
I ran Should I push a commit that removes these two lines? |
|
Yes |
|
The two lines are removed |
What does this PR do?
Fixes # (12673) and Tencent-Hunyuan/HunyuanVideo-1.5#10 I identified the root cause:
record_streamisn’t functioning as expected. This causes theoffload_to_memoryfunction to updateparam.datawithout waiting for the default stream (current_stream) to complete (the forward pass).Updates [Nov 27]: The root cause!!
The
current_stream()call inside_transfer_tensor_to_deviceis underwith torch.cuda.stream(self.stream). So it is not returning the correct default stream to callrecord_streamon !Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
cc @asomoza @sayakpaul @a-r-r-o-w @DN6