Repository navigation
[fused_moe] Raise when an active swiglu_limit would be silently dropped - #6335
jatseng-ai wants to merge 2 commits into
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
8422d8a to
2cb0d2d
Compare
Test result (gfx942)Ran
Both token counts raised |
|
Swiglu limit should be a feature added into CK |
2cb0d2d to
8b1f3ef
Compare
|
Rebased onto current |
8b1f3ef to
b9bad33
Compare
|
Rebased onto current
|
|
Agreed: FlyDSL is what unblocks the workload in the meantime. ROCm/aiter#6552 routes gfx942 bf16 This PR is the guardrail for the kernels that still cannot apply a limit, including CK. An active limit raises The guardrail is what lets vLLM open the gate. vllm-project/vllm#61508 is what starts sending a real |
CK, CK-Tile, asm, and the 1-stage path discard a caller-supplied clamp and run an unclamped activation. Fail that configuration instead. Signed-off-by: jatseng-ai <[email protected]> Co-authored-by: Cursor <[email protected]>
b9bad33 to
db71a81
Compare
|
Rebased onto current
vLLM has said they will review vllm#61508 after this PR and #6552 are merged and in an aiter release. The reply to the CK-feature comment is in the thread above: this PR is the guardrail, and the CK parameter is separate work. |
fsx950223
left a comment
There was a problem hiding this comment.
Reviewed exact head 957e09c, the complete diff, dispatch callers, backend limit handling, tests, existing feedback, and CI results. No blocking defect found. All 46 focused tests passed on gfx942, including both GPU reproductions. Review remains pending targeted gfx950 validation because the configured container is unavailable.
Validation:
- PASS on
hjbog-srdc-39.amd.com / sixifang_dev:docker exec sixifang_dev python3 -c "import torch; print([(i,torch.cuda.get_device_properties(i).gcnArchName) for i in range(torch.cuda.device_count())])"; docker exec sixifang_dev rocm-smi --showuse --showmemuse
Verified gfx942 inside the container; all devices reported 0% activity and 0% allocated VRAM before testing. Selected device 0. Log: gfx942-probe.log. - PASS on
hjbog-srdc-39.amd.com / sixifang_dev:In isolated exact-head checkout: env HIP_VISIBLE_DEVICES=0 PYTHONPATH=$PWD AITER_JIT_DIR=/tmp/codex-pr-review-6335-20261106/cache/aiter FLYDSL_RUNTIME_CACHE_DIR=/tmp/codex-pr-review-6335-20261106/cache/flydsl TORCH_EXTENSIONS_DIR=/tmp/codex-pr-review-6335-20261106/cache/torch TRITON_CACHE_DIR=/tmp/codex-pr-review-6335-20261106/cache/triton flock /tmp/codex-pr-review-6335-20261106/gpu.lock timeout 240 python3 -m pytest op_tests/test_fused_moe_swiglu_limit.py -v
Exit 0: 46 passed in 37.61s, including token=4 and token=256 GPU reproductions. Remote git rev-parse HEAD matched the supplied SHA. Import provenance resolved aiter.fused_moe to the isolated checkout; FlyDSL version 0.4.0. Logs: gfx942-tests.log and gfx942-import.log. - SKIP on
dzm-mi355-gpu34-dev / mi355-gpu-34:SSH with RemoteCommand=none: squeue -h -u zhiming_ding_qle -o '%i|%N|%t'; srun --overlap --jobid=9275 --ntasks=1 --cpus-per-task=1 podman exec -i sixifang_atom_dev sh -c 'python3 -c "import torch; print(torch.__version__)"; rocm-smi --showuse --showmemuse'
Discovered RUNNING allocation 9275 on mi355-gpu-34. Container probe failed with exit 125: no container named sixifang_atom_dev. Architecture verification and targeted tests could not run. Logs: gfx950-probe.log and gfx950-device.log.
Remaining validation:
- Targeted gfx950 validation remains outstanding; retry when the configured container is available.
- CI for the exact head reports successful standard tests on MI300X and MI35X, but retrieving detailed run logs returned HTTP 410, so case-level CI coverage could not be verified.
- No base comparison was run because no suspected regression was identified.
Automated Codex review of commit 957e09cd9a08.
fsx950223
left a comment
There was a problem hiding this comment.
No blocking findings in the swiglu_limit predicate and dispatch guards. Reviewed exact head 957e09c and verified that non-consuming paths reject active limits while the supported paths and inactive sentinels retain their expected behavior. Independently ran all 46 focused tests on each of gfx942 and gfx950, including the bf16 no-quant SiLU reproductions at token counts 4 and 256.
Validation:
- PASS on
hjbog-srdc-39.amd.com / sixifang_dev:docker exec sixifang_dev python3 -c "import torch; print([(i,torch.cuda.get_device_properties(i).gcnArchName) for i in range(torch.cuda.device_count())])"; docker exec sixifang_dev rocm-smi --showuse --showmemuse
Verified gfx942 inside the container; all devices reported 0% activity and 0% allocated VRAM before testing. Selected device 0. Log: gfx942-probe.log. - PASS on
hjbog-srdc-39.amd.com / sixifang_dev:In isolated exact-head checkout: env HIP_VISIBLE_DEVICES=0 PYTHONPATH=$PWD AITER_JIT_DIR=/tmp/codex-pr-review-6335-20261106/cache/aiter FLYDSL_RUNTIME_CACHE_DIR=/tmp/codex-pr-review-6335-20261106/cache/flydsl TORCH_EXTENSIONS_DIR=/tmp/codex-pr-review-6335-20261106/cache/torch TRITON_CACHE_DIR=/tmp/codex-pr-review-6335-20261106/cache/triton flock /tmp/codex-pr-review-6335-20261106/gpu.lock timeout 240 python3 -m pytest op_tests/test_fused_moe_swiglu_limit.py -v
Exit 0: 46 passed in 37.61s, including token=4 and token=256 GPU reproductions. Remote git rev-parse HEAD matched the supplied SHA. Import provenance resolved aiter.fused_moe to the isolated checkout; FlyDSL version 0.4.0. Logs: gfx942-tests.log and gfx942-import.log. - PASS on
dzm-mi355-gpu34-dev / sodev (gfx950):In the isolated exact-head source snapshot: env HIP_VISIBLE_DEVICES=0 PYTHONPATH=$PWD AITER_JIT_DIR=/tmp/codex-pr-review-6335-20261106-gfx950/cache/aiter FLYDSL_RUNTIME_CACHE_DIR=/tmp/codex-pr-review-6335-20261106-gfx950/cache/flydsl TORCH_EXTENSIONS_DIR=/tmp/codex-pr-review-6335-20261106-gfx950/cache/torch TRITON_CACHE_DIR=/tmp/codex-pr-review-6335-20261106-gfx950/cache/triton flock /tmp/codex-pr-review-6335-20261106-gfx950/gpu.lock timeout 300 python3 -m pytest op_tests/test_fused_moe_swiglu_limit.py -v
Exit 0: 46 passed in 18.11s, including token=4 and token=256 GPU reproductions. Source was streamed with git archive from the verified head SHA. Import provenance resolved aiter.fused_moe to that isolated source; gfx950, torch 2.10.0+rocm7.2.4 and FlyDSL 0.4.1 were verified. Selected idle device 0. Log: gfx950-tests.log.
Automated Codex review of commit 957e09cd9a08.
|
No activity for 15 days, so this is now labelled |
|
Closing this as superseded. The guard it adds now exists on Verified on CK 2-stage, for any quant type outside if quant_type not in RUNTIME_SILU_LIMIT_QUANT_TYPES or (w1_dtype != dtypes.fp8):
raise NotImplementedError(
f"CK MoE stage1 cannot apply swiglu_limit={swiglu_limit!r} for ..."
)That is the exact case this PR was filed against: bf16 1-stage raises at Rebasing is not worthwhile either: One gap this PR covered that Separately, the bf16 |
Summary
When a caller passed a real
swiglu_limitintoaiter.fused_moe()and stage-1 resolved to a kernel that cannot consume it, the bound was discarded and the kernel ran an unclamped activation. On gfx942 that showed up as identical output forswiglu_limit=1.0andswiglu_limit=Noneon the bf16QuantType.No/ActivationType.Silupath.This change is the guard. Teaching the gfx942 SiLU epilogue to honor the bound is separate follow-up work and is not implemented here.
Predicate
_swiglu_limit_is_activeis true only for a finite positive value. It is the only thing that may raise.Checked against
runtime_swiglu_limit(aiter/ops/flydsl/moe_kernels.py) and_opus_runtime_swiglu_limit(aiter/ops/opus/moe_stage1_a8w4.py):None+inf(unset)0.0+inf(falsy, unset)0.0whenmoe_config.swiglu_limit is None, so this arrives on every unconfigured call+inf+inf+infas the SiLU no-clamp value, and a truthy+infis passed through as that same value> 0Negative finite, NaN, and
-infare not active. Those three are truthy in the two helpers (they would be forwarded as a bound), but they are not a caller sentinel, and the requested predicate is finite-and-positive so the existing<= 0"unset" convention keeps working. Please say if any of those should raise instead.SwiGLU's internal default of
7.0when the limit is unset is unchanged. Raising onNoneor0.0would break every existing caller.Dispatch sites
fused_moe_2stages. FlyDSL stage-1 and Opus still receive the caller limit. MXFP4 stage-1 still receives it for SiLU and SwiGLU (runtime_swiglu_limit). CK, CK-Tile, and asm stage-1 have no parameter: an active limit now raisesNotImplementedError. MXFP4 + any other activation (SiTUv2) nulls the limit, so that also raises. FHMoE's FlyDSL wrapper already carries the limit in_stage1_extra_argsand is not an error.fused_moe_1stage. The asmfmoe/fmoe_g1u1launch has no limit argument. An active limit raises before the launch. On gfx942, bf16QuantType.No+ SiLU withtoken < 256takes this path.flydsl_gfx942whole-graph backend. The limit is forwarded. SwiGLU applies it. The SiLU epilogue ignores it, so an active SiLU limit now raises. Making that epilogue honor the bound is separate follow-up work, not this PR.Before / after
Before:
ck_moe_stage1/fused_moe_1stagewithswiglu_limit=10.0returned the unclamped tensor.After, that call raises, for example:
None,0.0, and+infstill run, including on CK.Raise vs warn
This raises. There is no warning mode and no environment escape hatch.
That turns a deployment that today starts and returns a numerically wrong activation into a startup failure. That is the behaviour this change is meant to produce, and it is a behaviour change in a patch release. If a warning (or a default-raise escape hatch) is preferable for the rollout, say so. A silently wrong default is what this change exists to remove, so the default stays raise.
Tests
op_tests/test_fused_moe_swiglu_limit.pyNone,0.0,0,+infinactive; finite positive active.fused_moe_1stageraise on a finite limit and do not raise onNone/0.0/+inf.QuantType.No,ActivationType.Silu, bf16,AITER_BYPASS_TUNE_CONFIG=1) expects the raise. Skipped without a GPU, and skipped on archs other than gfx942/gfx950.black 26.3.0andruff checkare clean on the two files.Run on gfx942 (Instinct MI300X),
pytest op_tests/test_fused_moe_swiglu_limit.py:test_bf16_noquant_silu_repro_raises(token=4 and token=256): 2 passed, 16.04s. Both sizes raisedNotImplementedError(cannot apply swiglu_limit) instead of returning an unclamped tensor. On gfx942, token=4 isfused_moe_1stageand token=256 isck_moe_stage1.Reviewer
Please add Tang, James. I could not find his GitHub account from commits or reviews on this repo (the Tang accounts in history are
amd-ruitang3andjtang10/ Jingning Tang), so I did not guess.