Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix (equalize): dtype fix in activation equalization #1217

Merged
merged 4 commits into from
Mar 12, 2025

Conversation

pablomlago
Copy link
Collaborator

Reason for this PR

Activation equalization crashes when using bfloat16.

Changes Made in this PR

Make ScaleBias output match the dtype of the input tensor.

Testing Summary

Expanded tests for activation equalization with float16 and bfloat16.

Risk Highlight

  • This PR includes code from another work (please detail).
  • This PR contains API-breaking changes.
  • This PR depends on work in another PR (please provide links/details).
  • This PR introduces new dependencies (please detail).
  • There are coverage gaps not covered by tests.
  • Documentation updates required in subsequent PR.

Checklist

  • Code comments added to any hard-to-understand areas, if applicable.
  • Changes generate no new warnings.
  • Updated any relevant tests, if applicable.
  • No conflicts with destination dev branch.
  • I reviewed my own code changes.
  • Initial CI/CD passing.
  • 1+ reviews given, and any review issues addressed and approved.
  • Post-review full CI/CD passing.

@pablomlago pablomlago requested a review from Giuseppe5 March 11, 2025 11:22
@@ -31,9 +31,10 @@ def __init__(self, num_features: int, bias: bool, runtime_shape=(1, -1, 1, 1)):
self.runtime_shape = runtime_shape

def forward(self, input):
out = input * self.weight.view(self.runtime_shape)
dtype = input.dtype
out = input * self.weight.view(self.runtime_shape).to(dtype=dtype)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any way we can avoid casting on on the fly?
Also we cannot do this with to.('cuda') because that is definitely costly

@Giuseppe5 Giuseppe5 self-requested a review March 11, 2025 21:26
@Giuseppe5 Giuseppe5 merged commit 7740f16 into Xilinx:dev Mar 12, 2025
372 of 396 checks passed
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.

2 participants