fix(kernels): rename misnamed gate_silu_mul* to gate_geglu* - #181
Open
hebangwen wants to merge 1 commit into
Open
fix(kernels): rename misnamed gate_silu_mul* to gate_geglu*#181hebangwen wants to merge 1 commit into
hebangwen wants to merge 1 commit into
Conversation
The gate_silu_mul* kernels actually compute the tanh/sigmoid-approx GELU (GeGLU), not SiLU. Rename to reflect the actual activation so the naming matches the gate_geglu bindings already exposed to Python.
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.
Summary
This PR fixes a naming error in
csrc/kernels/activation.cuwhere a family of kernels was misleadingly namedgate_silu_mul*, even though they compute the tanh/sigmoid-approximated GELU (GeGLU, i.e.GELU(gate) * up), not SiLU.The incorrect naming has been noted in two places already:
csrc/kernels/act_fuse_sm120.cuh— "the existinggate_silu_mulbinding is misnamed -- it is the tanh-approx GELU, not SiLU"csrc/kernels/silu_mul_qwen36.cuh— *"the existinggate_silu_mul... actually computes GELU(gate)up ... This kernel is the proper SiLU variant"This PR renames the misnamed symbols to reflect their true semantics, so the C++ symbol names finally match the
gate_geglunaming already exposed to Python via the bindings.Changes
gate_silu_mul→gate_geglugate_silu_mul_fp16→gate_geglu_fp16gate_silu_mul_merged→gate_geglu_mergedgate_silu_mul_merged_fp16→gate_geglu_merged_fp16gate_silu_mul_merged_fp8→gate_geglu_merged_fp8gate_silu_mul_merged_fp8_fp16→gate_geglu_merged_fp8_fp16Files touched:
csrc/kernels/activation.cu— kernel + wrapper renamescsrc/kernels/activation.cuh— declaration renamescsrc/bindings.cpp— internal call-site renames (Python-facing names alreadygate_geglu*)cpp/models/pi05/src/targets/sm110/operation_driver.cu— 2 call sitescpp/models/pi05/src/targets/sm120/target.cpp— 3 call sitesNot touched
The genuinely-SiLU kernels (
silu_mul_split_fp8_kernel,silu_inplace_kernel,fused_add_silu_kernel) are correct and left unchanged.Why rename instead of changing the math
Changing the GELU formula to SiLU would silently break every caller that relies on GeGLU semantics (FFN intermediate layers, Pi0/VLA encoder paths). Renaming preserves behavior while fixing the semantic mismatch.