Cortex-M backend: lower quantized GELU via the activation LUT#21025
Cortex-M backend: lower quantized GELU via the activation LUT#21025rascani wants to merge 1 commit into
Conversation
Extend the existing sigmoid/tanh/silu activation-LUT path to GELU: add an exact (erf) _gelu to _ACTIVATION_FNS, register aten.gelu in the quantizer's ACTIVATION_OP_PATTERNS (the generic CortexMActivationCheck needs no change), and add aten.gelu to the quantized_activation dialect substitution. Unlike silu, aten.gelu is a core-aten op that survives to_edge unchanged, so no to_edge preservation is required. build_activation_lut only sees the op target, so the table is always the exact/erf GELU regardless of the approximate kwarg -- fine for an int8 LUT. Verified test-first (RED->GREEN) with five nn.GELU() dialect cases (ramp / saturating / asymmetric-zp / zero) whose numerics are validated against the reference (qtol=1); the full cortex_m op dialect suite still passes (177 passed). This removes the last non-normalization fp32 activation from a SAM mask decoder's two-way transformer. Authored with Claude Code. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21025
Note: Links to docs will display an error until the docs builds have been completed. ❗ 2 Merge Blocking SEVsThere is 2 active merge blocking SEVs. Please view them below:
If you must merge, use ❌ You can merge normally! (1 Unrelated Failure), 1 Unclassified FailureAs of commit f9d4f41 with merge base 7013c8d ( UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
Summary
Extend the existing sigmoid/tanh/silu activation-LUT path to GELU: add an exact (erf) _gelu to _ACTIVATION_FNS, register aten.gelu in the quantizer's ACTIVATION_OP_PATTERNS (the generic CortexMActivationCheck needs no change), and add aten.gelu to the quantized_activation dialect substitution. Unlike silu, aten.gelu is a core-aten op that survives to_edge unchanged, so no to_edge preservation is required. build_activation_lut only sees the op target, so the table is always the exact/erf GELU regardless of the approximate kwarg.
Test plan
Verified test-first (RED->GREEN) with five nn.GELU() dialect cases (ramp / saturating / asymmetric-zp / zero) whose numerics are validated against the reference (qtol=1); the full cortex_m op dialect suite still passes (177 passed).
Authored with Claude Code.