[JAX] Estimate post-RHT amax using regular amax#2479
Draft
jberchtold-nvidia wants to merge 1 commit intoNVIDIA:mainfrom
Draft
[JAX] Estimate post-RHT amax using regular amax#2479jberchtold-nvidia wants to merge 1 commit intoNVIDIA:mainfrom
jberchtold-nvidia wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Signed-off-by: Jeremy Berchtold <jberchtold@nvidia.com>
Contributor
Greptile OverviewGreptile SummaryThis PR modifies the post-RHT (Random Hadamard Transform) amax calculation in JAX quantization to use an approximation instead of the exact computation. The change replaces the call to
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Q as _quantize_dbias_impl
participant A as calculate_amax
participant K as TE Kernel
Note over Q: When use_rht=True
alt use_approx_amax=True (New Path)
Q->>A: calculate_amax(x.data)
A-->>Q: amax
Q->>Q: post_rht_amax = amax * 2.0
else use_approx_amax=False (Dead Code)
Q->>K: calculate_post_rht_amax(x.data)
K-->>Q: new_amax, post_rht_amax
end
Q->>K: PrimitiveClass.outer_primitive.bind(..., post_rht_amax)
|
Contributor
There was a problem hiding this comment.
Additional Comments (1)
-
transformer_engine/jax/cpp_extensions/quantization.py, line 810 (link)style: Hardcoded
use_approx_amax = Truemakes theelsebranch (lines 820-831) unreachable dead code. Consider either removing the dead code or making this configurable (e.g., via quantizer attribute or function parameter).
1 file reviewed, 1 comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please include a brief summary of the changes, relevant motivation and context.
Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: