Skip to content

[PyTorch] Deprecate grouped linear and MLP environment gates - #3584

Open
zhongbozhu wants to merge 7 commits into
NVIDIA:mainfrom
zhongbozhu:cleanup/grouped-mlp-env-gates
Open

zhongbozhu wants to merge 7 commits into
NVIDIA:mainfrom
zhongbozhu:cleanup/grouped-mlp-env-gates

Conversation

@zhongbozhu

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

@github-actions github-actions Bot added the community-contribution PRs from external contributor outside the core maintainers, representing community-driven work. label Sep 29, 2026
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Removes environment variable gates for grouped linear and MLP features.

The PR is not yet safe to merge because the outstanding CUDA-free grouped-MLP support check can raise instead of returning unsupported.

Findings

  1. P1 CUDA-free support checks raise ▶

Summary

The PR removes environment gates for grouped parameters and grouped-MLP fusion, updates EP alignment defaults and examples, and expands grouped-operation coverage. Changes since the previous review also add compiled attention and operation tests, FP8 recipe parameter restoration, and native kernel synchronization safeguards.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[GroupedLinear → activation → GroupedLinear] --> B{Recipe and pattern eligible?}
  B -->|Yes| C{Device and frontend supported?}
  C -->|Yes| D[Fused grouped MLP]
  B -->|No| E[Separate operations]
  C -->|No| E
Loading

Reviews (10) · Last reviewed commit: "attempt to fix ci issue" · Reviewed by Greptile

Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py
Comment thread docs/examples/te_mixtral/run_finetune_ep.py
Comment thread tests/pytorch/test_grouped_mlp.py Outdated
@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch L1

1 similar comment
@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch L1

@ptrendx ptrendx added the 2.21 label Sep 30, 2026
Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py Outdated
Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py
Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py
Comment thread docs/envvars.rst Outdated
Comment thread docs/examples/te_mixtral/tutorial_accelerate_hf_mixtral_with_te.ipynb Outdated
Comment thread tests/pytorch/test_grouped_mlp.py Outdated
Comment thread tests/pytorch/test_grouped_mlp.py Outdated
Comment thread tests/pytorch/test_grouped_mlp.py Outdated
Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py Outdated
@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch L1

Comment thread transformer_engine/pytorch/ops/fused/grouped_mlp.py Outdated
@zhongbozhu
zhongbozhu force-pushed the cleanup/grouped-mlp-env-gates branch from 1ac8a2c to 91032db Compare October 2, 2026 23:57
@vthumbe1503

Copy link
Copy Markdown
Collaborator

LGTM. Thanks for cleaning these env variables. All @timmoon10's comments seem to be resolved as well. @zhongbozhu I resolved the merge conflicts.

@vthumbe1503

Copy link
Copy Markdown
Collaborator

/te-ci pytorch

vthumbe1503
vthumbe1503 previously approved these changes Oct 5, 2026
@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

"""Whether this fused operation is supported on the current system."""
if int(os.environ.get("NVTE_CUTEDSL_FUSED_GROUPED_MLP", "0")) <= 0:
return False
if get_device_compute_capability()[0] != 10:

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.

P1 CUDA-free support checks raise If CUDA is unavailable, is_supported() now calls get_device_compute_capability() instead of returning False. That helper calls torch.cuda.current_device(), so the support check raises rather than letting the caller use the unfused path. The unary-fusion callback can hit this check while building a plan, before checking whether the recipe or operations are candidates for fusion.

Knowledge Base Used: PyTorch tensor and operator abstractions

vthumbe1503
vthumbe1503 previously approved these changes Oct 6, 2026
timmoon10
timmoon10 previously approved these changes Oct 6, 2026

@timmoon10 timmoon10 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

@pggPL pggPL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need to investigate #3640 before merging that PR

@zhongbozhu
zhongbozhu dismissed stale reviews from timmoon10 and vthumbe1503 via accb0b6 October 6, 2026 22:34
@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

Comment thread transformer_engine/pytorch/ep.py
Comment thread transformer_engine/pytorch/ep.py
@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch L1

@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch L1

Signed-off-by: zhongboz <zhongboz@nvidia.com>
Signed-off-by: zhongboz <zhongboz@nvidia.com>
Signed-off-by: Zhongbo Zhu <zhongboz@nvidia.com>
Signed-off-by: zhongboz <zhongboz@nvidia.com>
Signed-off-by: zhongboz <zhongboz@nvidia.com>
Signed-off-by: zhongboz <zhongboz@nvidia.com>
Signed-off-by: zhongboz <zhongboz@nvidia.com>
@zhongbozhu
zhongbozhu force-pushed the cleanup/grouped-mlp-env-gates branch from 6b78903 to b2ebc26 Compare October 9, 2026 02:19
@zhongbozhu

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch L1

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

2.21 community-contribution PRs from external contributor outside the core maintainers, representing community-driven work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants