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

[PyTorch] Remove fast param getter from modules #1291

Merged
merged 3 commits into from
Oct 28, 2024

Conversation

timmoon10
Copy link
Collaborator

@timmoon10 timmoon10 commented Oct 26, 2024

Description

#1191 added a fast accessor for params to work around CPU overheads from how PyTorch modules store params. This saves ~1 us per forward pass (out of a total ~100 us) in small benchmarks with the linear layer. However, we have experienced some problems with FSDP since it internally replaces the params with a flattened param and turns the original params into a plain tensor. The fast accessor was very hacky, and this edge case makes me think it's not worth the performance benefit.

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refractor

Changes

  • Remove fast param accessor in TE modules

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@timmoon10 timmoon10 added the bug Something isn't working label Oct 26, 2024
@timmoon10
Copy link
Collaborator Author

/te-ci pytorch

Signed-off-by: Tim Moon <[email protected]>
@timmoon10
Copy link
Collaborator Author

/te-ci pytorch

Copy link
Member

@ksivaman ksivaman left a comment

Choose a reason for hiding this comment

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

LGTM

@timmoon10 timmoon10 merged commit 35bbe74 into NVIDIA:main Oct 28, 2024
26 checks passed
@timmoon10 timmoon10 deleted the debug-fast-get-param branch October 28, 2024 23:47
timmoon10 added a commit that referenced this pull request Oct 28, 2024
* Add fallback for fast param getter

Signed-off-by: Tim Moon <[email protected]>

* Remove fast param getter

Signed-off-by: Tim Moon <[email protected]>

* Fix linter warning

Signed-off-by: Tim Moon <[email protected]>

---------

Signed-off-by: Tim Moon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.12.0 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants