Skip to content

[Pytorch] Skip the Single Grouped Param Test if NVTE_GROUPED_LINEAR_SINGLE_PARAM=0#3061

Merged
vthumbe1503 merged 3 commits into
NVIDIA:mainfrom
vthumbe1503:grouped_linear_fix
May 29, 2026
Merged

[Pytorch] Skip the Single Grouped Param Test if NVTE_GROUPED_LINEAR_SINGLE_PARAM=0#3061
vthumbe1503 merged 3 commits into
NVIDIA:mainfrom
vthumbe1503:grouped_linear_fix

Conversation

@vthumbe1503
Copy link
Copy Markdown
Collaborator

@vthumbe1503 vthumbe1503 commented May 29, 2026

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

… weight

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
@vthumbe1503
Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

Adds a pytest.skip guard to test_sanity_grouped_linear so that single_param=True test variants are skipped unless NVTE_GROUPED_LINEAR_SINGLE_PARAM=1 is set in the environment, preventing spurious assertion failures when the feature flag is absent.

  • The guard os.environ.get("NVTE_GROUPED_LINEAR_SINGLE_PARAM", "0") == "0" correctly handles both the unset case (defaults to "0") and the explicitly-disabled case, matching the logic in transformer_engine/pytorch/utils.py and the parallel guard already present in tests/pytorch/test_fusible_ops.py.
  • CI (qa/L0_pytorch_unittest/test.sh) already invokes test_sanity.py with NVTE_GROUPED_LINEAR_SINGLE_PARAM=1, so the single-param variants continue to run in the full test suite.

Confidence Score: 5/5

The change is a narrow, well-scoped skip guard in a test file; it cannot affect production code and matches the established pattern already used in the test suite.

The guard correctly defaults to '0' when the env var is absent, so both the unset case and the explicitly-disabled case are handled the same way as utils.py and test_fusible_ops.py. No production code is touched, and CI already sets the flag so the single-param tests still run in the full suite.

No files require special attention.

Important Files Changed

Filename Overview
tests/pytorch/test_sanity.py Adds a pytest.skip guard for test_sanity_grouped_linear when single_param=True but NVTE_GROUPED_LINEAR_SINGLE_PARAM is unset or '0', preventing assertion failures from running the single-param path without the required feature flag.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["test_sanity_grouped_linear(single_param=True/False)"] --> B{"NVTE_GROUPED_LINEAR_SINGLE_PARAM == '0'\nAND single_param == True?"}
    B -- Yes --> C["pytest.skip()\n'requires NVTE_GROUPED_LINEAR_SINGLE_PARAM=1'"]
    B -- No --> D["Continue test setup"]
    D --> E["GroupedLinear(\n  single_grouped_weight=single_param,\n  single_grouped_bias=single_param\n)"]
    E --> F{"single_param == True?"}
    F -- Yes --> G["check_grouped_weight()\ncheck_grouped_bias()"]
    F -- No --> H["Run inference + backward"]
    G --> H
Loading

Reviews (2): Last reviewed commit: "Apply suggestion from @greptile-apps[bot..." | Re-trigger Greptile

Comment thread tests/pytorch/test_sanity.py Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: vthumbe1503 <vthumbe@nvidia.com>
Copy link
Copy Markdown
Member

@timmoon10 timmoon10 left a comment

Choose a reason for hiding this comment

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

:shipit:

@vthumbe1503
Copy link
Copy Markdown
Collaborator Author

B200 is the only pending test in CI. And they are passing when manually tested. Merging the PR

@vthumbe1503 vthumbe1503 merged commit 79821e2 into NVIDIA:main May 29, 2026
12 of 13 checks passed
KshitijLakhani pushed a commit that referenced this pull request May 29, 2026
…INGLE_PARAM=0 (#3061)

* skip the test if the env variable is not turned on for single grouped weight

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestion from @greptile-apps[bot]

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Signed-off-by: vthumbe1503 <vthumbe@nvidia.com>

---------

Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: vthumbe1503 <vthumbe@nvidia.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
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.

2 participants