Skip to content

Register silu / SiLU alias in ActivationOperationsConverter (#484)#486

Merged
michalharakal merged 1 commit intodevelopfrom
feature/484-silu-alias
Apr 13, 2026
Merged

Register silu / SiLU alias in ActivationOperationsConverter (#484)#486
michalharakal merged 1 commit intodevelopfrom
feature/484-silu-alias

Conversation

@michalharakal
Copy link
Copy Markdown
Contributor

Closes #484.

Summary

Every Llama / Mistral / Qwen / Gemma family model names the same `x * sigmoid(x)` activation `silu` (Sigmoid Linear Unit), not `swish`. PyTorch's `F.silu` and HuggingFace's `ACT2FN["silu"]` both emit the `silu` name. Without this alias, a traced Llama forward pass falls through the StableHLO converter registry's "no converter found" path.

Change

  • Adds `silu` and `SiLU` to `ActivationOperationsConverter.supportedOperations`.
  • Routes `silu` to the existing `convertSwish` lowering in the dispatch `when`. Same op bodies, byte-identical MLIR output.
  • Extends `ActivationOperationsConverterTest` with registration checks for `silu` / `SiLU` and a new `testSiluAliasLowersLikeSwish` test asserting the emitted module contains the same ops the existing swish test asserts (negate, exp, const 1.0, add, divide, multiply).

Test plan

  • `./gradlew :skainet-compile:skainet-compile-hlo:allTests -x kotlinWasmStoreYarnLock` — green across jvmTest, wasmJsTest, wasmJsBrowserTest, wasmWasiTest, wasmWasiNodeTest, macosArm64Test, iosSimulatorArm64Test (`linuxX64Test` skipped on macOS host)
  • CI: full multiplatform build across all targets

🤖 Generated with Claude Code

…484)

Every Llama / Mistral / Qwen / Gemma family model names the same
x * sigmoid(x) activation `silu` rather than `swish`. PyTorch's
F.silu and HuggingFace's ACT2FN["silu"] both emit the `silu`
name, so a traced LLM forward pass was falling through the
StableHLO converter registry's "no converter found" path.

Fix is scoped:
- Adds `silu` and `SiLU` to supportedOperations.
- Routes `silu` to the existing convertSwish lowering in the
  dispatch `when`. Same op bodies, identical MLIR output.
- Extends ActivationOperationsConverterTest's registration
  check with `silu` / `SiLU` and adds testSiluAliasLowersLikeSwish
  which asserts the emitted module carries the same ops
  (negate, exp, const 1.0, add, divide, multiply) that the swish
  test already asserts.

Verified locally with
`./gradlew :skainet-compile:skainet-compile-hlo:allTests
 -x kotlinWasmStoreYarnLock` — green across jvmTest, wasmJsTest,
wasmJsBrowserTest, wasmWasiTest, wasmWasiNodeTest, macosArm64Test,
and iosSimulatorArm64Test. Running allTests (not just jvmTest)
is now standing discipline for this repo after #485 caught a
JVM-only stdlib call that broke KMP compile.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@michalharakal michalharakal merged commit 596dd32 into develop Apr 13, 2026
4 checks passed
@michalharakal michalharakal deleted the feature/484-silu-alias branch April 13, 2026 11:36
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.

Register silu alias in ActivationOperationsConverter (P1)

1 participant