Skip to content

[PyTorch] Fix Test's Reference Implementation of Clamped Swiglu - #3424

Open
vthumbe1503 wants to merge 1 commit into
NVIDIA:mainfrom
vthumbe1503:clamped_swiglu_fix_v2
Open

[PyTorch] Fix Test's Reference Implementation of Clamped Swiglu#3424
vthumbe1503 wants to merge 1 commit into
NVIDIA:mainfrom
vthumbe1503:clamped_swiglu_fix_v2

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

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

Copy link
Copy Markdown
Collaborator Author

/te-ci pytorch

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Updates two PyTorch test reference implementations for clamped SwiGLU to express upper and lower clamping with explicit torch.where operations.

  • Replaces the GLU branch’s upper clamp in both references.
  • Replaces the linear branch’s two-sided clamp in both references.

Confidence Score: 5/5

The PR appears safe to merge because the updated test references preserve the production clamped SwiGLU semantics.

The explicit conditional clamps preserve forward values and pass gradients through at the exact limits, matching the production kernel behavior in both changed test paths.

Important Files Changed

Filename Overview
tests/pytorch/test_fusible_ops.py The two reference implementations now match the production kernel’s inclusive clamp-boundary gradient semantics without introducing an actionable issue.

Reviews (1): Last reviewed commit: "fix clamped swiglu test" | Re-trigger Greptile

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