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] Userbuffers support in operation-based API #1142

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

timmoon10
Copy link
Collaborator

Description

This PR adds basic support in the linear operation for using Userbuffers to overlap tensor-parallel communication with GEMMs. This is implemented as fused operations:

model = te.ops.Sequential(
    te.ops.BasicLinear(...),
    te.ops.Bias(...),
    te.ops.ReduceScatter(...),
)  # Fused into UserbuffersForwardLinear

I've tried to avoid touching the core UB infrastructure in transformer_engine/pytorch/module/base.py, so I've kept the messy API and hackily worked around some bugs. This feature should be considered experimental and unstable.

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

  • Add fused operation for linear forward with Userbuffers
  • Add fused operation for linear backward with Userbuffers

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

Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Assumes FP8 RS, which is not a good assumption.

Signed-off-by: Tim Moon <tmoon@nvidia.com>
Bias pointers are not properly offset for different data chunks. Also removed logic for FP8 RS.

Signed-off-by: Tim Moon <tmoon@nvidia.com>
Test passes with row TP, fails with col TP.

Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
Signed-off-by: Tim Moon <tmoon@nvidia.com>
pre-commit-ci bot and others added 2 commits August 27, 2024 22:23
Signed-off-by: Tim Moon <tmoon@nvidia.com>
@timmoon10
Copy link
Collaborator Author

/te-ci pytorch

@timmoon10
Copy link
Collaborator Author

/te-ci pytorch

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.

1 participant