Skip to content

Support GroupedTensor autograd views and stream tracking - #3701

Merged
vthumbe1503 merged 2 commits into
NVIDIA:mainfrom
vthumbe1503:grouped-tensor-record-stream-view
Oct 23, 2026
Merged

vthumbe1503 merged 2 commits into
NVIDIA:mainfrom
vthumbe1503:grouped-tensor-record-stream-view

Conversation

@vthumbe1503

Copy link
Copy Markdown
Collaborator

Description

Please include a brief summary of the changes, relevant motivation and context.

Fixes # (issue)

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 refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

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

@vthumbe1503
vthumbe1503 requested a review from ksivaman as a code owner October 16, 2026 23:26
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds grouped-storage views for autograd identity outputs and forwards CUDA stream tracking to backing buffers.

  • Autograd identity functions keep GroupedTensor views linked to their source.
  • GroupedTensor records CUDA streams on the tensors that back it.
  • GroupedTensor leaves Python tensor calls to PyTorch’s disabled handler.

Reviews (6) · Last reviewed commit: "Merge branch 'main' into grouped-tensor-..." · Reviewed by Greptile

Comment thread transformer_engine/pytorch/tensor/grouped_tensor.py Outdated
@phu0ngng
phu0ngng self-requested a review October 20, 2026 22:08
Comment thread tests/pytorch/test_grouped_tensor.py
@ptrendx

ptrendx commented Oct 23, 2026

Copy link
Copy Markdown
Member

Preserve autograd view metadata for GroupedTensor wrappers and record streams on their backing tensors. Add focused coverage for gradient propagation through an identity view and for stream tracking.

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503
vthumbe1503 force-pushed the grouped-tensor-record-stream-view branch from 53e37e8 to f057413 Compare October 23, 2026 16:28
@vthumbe1503

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@ksivaman ksivaman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment on lines 263 to 264
# DDP and mcore use expand_as(self) to build a dummy autograd node and
# access gradient accumulators during parameter hook registration.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment is not accurate anymore because we have an expand_as in GroupedTensor's expand_as.

@vthumbe1503
vthumbe1503 merged commit 2199b71 into NVIDIA:main Oct 23, 2026
15 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants