Skip to content
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

[tensor] refactor param op hook #1097

Merged
merged 5 commits into from
Jun 13, 2022
Merged

Conversation

ver217
Copy link
Member

@ver217 ver217 commented Jun 10, 2022

torch.autograd.Function ensures the device of original inputs and grads are the same. Since zero hook may change the device of input in pre fwd, we execute pre fwd out of autograd.Function.

@FrankLeeeee
Copy link
Contributor

FrankLeeeee commented Jun 13, 2022

Can you add some documentation for better readability and maintainability?

@ver217
Copy link
Member Author

ver217 commented Jun 13, 2022

Can you add some documentation for better readability and maintainability?

DONE

Example::
>>> with ParamOpHookManager.use_hooks(*hooks):
>>> do_something()
>>> with ParamOpHookManager.use_hooks():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why nest ParamOpHookManager context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case some users want to nest. In most cases, we don't need to nest.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think users should not know what is OpHook. It is not a common-sense concept. Why do they need to have a manager?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They can extend profiler by this manager. E.g. before op sample sth, after op sample sth. Indeed, it's for advanced developers.

@ver217 ver217 merged commit 895c1c5 into hpcaitech:main Jun 13, 2022
@ver217 ver217 deleted the feature/gemini branch June 13, 2022 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants