Repository navigation
TanH Sq-relu and SiTU GLU - #7003
Conversation
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
/claude review |
| @@ -996,26 +998,41 @@ | |||
| bias_parallel is None | |||
| ), "Bias is not supported with fused weighted squared relu." | |||
| intermediate_parallel = weighted_squared_relu_impl( | |||
There was a problem hiding this comment.
what's the plan for fused kernel support when enabling use_transformer_engine_op_fuser?
There was a problem hiding this comment.
I think we may be silently dropping the tanh part here when going through this path?
There was a problem hiding this comment.
I think with use_transformer_engine_op_fuser are constructing ScaledSwiGLU or ScaledSReLU without reading either tanh scale.
There was a problem hiding this comment.
edited to disable use_transformer_engine_op_fuser if tanh_clamp is set. we can update once we have the cudnn fe kernel ready
|
|
||
| def _get_activation_func(activation_type: ActivationType, fused_quant: bool = False) -> Callable: | ||
| def _get_activation_func( | ||
| activation_type: ActivationType, fused_quant: bool = False, clamp_scale: Optional[float] = None |
There was a problem hiding this comment.
can we have **activation_kwargs as a generic interface to pass activation function specific args like clamp_scale?
|
Light review. Two findings. 1.
|
| .to(intermediate_parallel.dtype) | ||
| ) | ||
|
|
||
| def _is_fused_impl_supported(self) -> bool: |
There was a problem hiding this comment.
Please change this function accordingly if needed
wdykas
left a comment
There was a problem hiding this comment.
I left a few comments but dont want my review to block anything so will put the accept here assuming everything is addressed
| out_dtype = x.dtype | ||
| t = _tanh_relu_over_scale(x, clamp_scale) | ||
|
|
||
| c = (clamp_scale * t).to(out_dtype) |
There was a problem hiding this comment.
This is odd down casting I am assuming like other things is for training and inference parity? we might want to note it
There was a problem hiding this comment.
its to ensure the fused/unfused paths are identical, since the unfused path does a cast to out_dtype after the tanh activation which is a separate activation function
There was a problem hiding this comment.
removed the intermediate downcasts
| @@ -996,26 +998,41 @@ | |||
| bias_parallel is None | |||
| ), "Bias is not supported with fused weighted squared relu." | |||
| intermediate_parallel = weighted_squared_relu_impl( | |||
There was a problem hiding this comment.
I think we may be silently dropping the tanh part here when going through this path?
| @@ -996,26 +998,41 @@ | |||
| bias_parallel is None | |||
| ), "Bias is not supported with fused weighted squared relu." | |||
| intermediate_parallel = weighted_squared_relu_impl( | |||
There was a problem hiding this comment.
I think with use_transformer_engine_op_fuser are constructing ScaledSwiGLU or ScaledSReLU without reading either tanh scale.
|
/ok to test 49cd794 |
49cd794 to
0ffd278
Compare
0ffd278 to
8e5af92
Compare
Signed-off-by: Abhinav Khattar <akhattar@nvidia.com>
Signed-off-by: Keshav Santhanam <ksanthanam@nvidia.com>
Signed-off-by: Keshav Santhanam <ksanthanam@nvidia.com>
Signed-off-by: Abhinav Khattar <akhattar@nvidia.com>
Signed-off-by: Keshav Santhanam <ksanthanam@nvidia.com>
Signed-off-by: Abhinav Khattar <akhattar@nvidia.com>
|
/ok to test fa69213 |
Signed-off-by: Abhinav Khattar <akhattar@nvidia.com>
|
/ok to test d40cecb |
Signed-off-by: Keshav Santhanam <ksanthanam@nvidia.com>
|
/ok to test 68e6005 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/33740494110 |
What does this PR do?
TanH Sq-relu and SiTU GLU activations
Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.