Skip to content

fix(kernels): rename misnamed gate_silu_mul* to gate_geglu* - #181

Open
hebangwen wants to merge 1 commit into
flashrt-project:mainfrom
hebangwen:main
Open

fix(kernels): rename misnamed gate_silu_mul* to gate_geglu*#181
hebangwen wants to merge 1 commit into
flashrt-project:mainfrom
hebangwen:main

Conversation

@hebangwen

Copy link
Copy Markdown

Summary

This PR fixes a naming error in csrc/kernels/activation.cu where a family of kernels was misleadingly named gate_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 existing gate_silu_mul binding is misnamed -- it is the tanh-approx GELU, not SiLU"
  • csrc/kernels/silu_mul_qwen36.cuh — *"the existing gate_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_geglu naming already exposed to Python via the bindings.

Changes

  • Rename-only, no numerical/behavioral changes — activation math is untouched.
Symbol (before → after)
gate_silu_mulgate_geglu
gate_silu_mul_fp16gate_geglu_fp16
gate_silu_mul_mergedgate_geglu_merged
gate_silu_mul_merged_fp16gate_geglu_merged_fp16
gate_silu_mul_merged_fp8gate_geglu_merged_fp8
gate_silu_mul_merged_fp8_fp16gate_geglu_merged_fp8_fp16

Files touched:

  • csrc/kernels/activation.cu — kernel + wrapper renames
  • csrc/kernels/activation.cuh — declaration renames
  • csrc/bindings.cpp — internal call-site renames (Python-facing names already gate_geglu*)
  • cpp/models/pi05/src/targets/sm110/operation_driver.cu — 2 call sites
  • cpp/models/pi05/src/targets/sm120/target.cpp — 3 call sites

Not 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.

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.
@hebangwen
hebangwen requested a review from LiangSu8899 as a code owner August 20, 2026 05:31
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