Skip to content

Support GroupedTensor autograd views and stream tracking - #3701

Open
vthumbe1503 wants to merge 4 commits into
NVIDIA:mainfrom
vthumbe1503:grouped-tensor-record-stream-view
Open

vthumbe1503 wants to merge 4 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, with a non-blocking request to restore autograd regression coverage.

Findings

  1. P2 Autograd views lose test coverage ▶

Summary

This PR adds shape-preserving autograd views for GroupedTensor and forwards CUDA stream tracking to its backing tensors.

  • Same-shape autograd views keep the GroupedTensor layout.
  • GroupedTensor records streams on its CUDA backing buffers.

Reviews (4) · Last reviewed commit: "remove unecessary test" · Reviewed by Greptile

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Comment thread transformer_engine/pytorch/tensor/grouped_tensor.py Outdated
@phu0ngng
phu0ngng self-requested a review October 20, 2026 22:08
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)

def test_record_stream_tracks_grouped_buffers(self, monkeypatch) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Autograd views lose test coverage

Removing test_autograd_identity_supports_varying_shapes drops the direct regression test for the autograd views added by this PR. The remaining tests in test_grouped_tensor.py do not check grad_fn or backward through these views. Restore this test, or equivalent coverage, so changes that break shared buffers or gradient propagation are caught.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
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.

1 participant