Repository navigation
[OPUS] [Bugfix] Give the a8w4 MoE opus fakes the full op signatures - #6310
zhiding512 wants to merge 1 commit into
Conversation
_gen_opus_moe_stage1_a8w4_fake_tensors and _gen_opus_moe_stage2_a8w4_decode_fake_tensors lacked the scalar parameters of the ops they are registered for, so any call under FakeTensorMode raised TypeError (10 of 18 and 9 of 14 positional arguments accepted). Signed-off-by: zhimding <zhimding@amd.com>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🟢 Approval recommended
Both fake signatures now exactly match their corresponding registered raw operations without altering runtime computation.
0 open findings
What changed in this PR
Aligns Opus A8W4 MoE fake implementations with their registered raw-op signatures, fixing FakeTensor and torch.compile tracing.
Changes:
- Adds missing scalar parameters to stage 1 and stage 2 fake functions.
- Preserves existing fake outputs and eager behavior.
| File | Description |
|---|---|
aiter/ops/opus/moe_stage1_a8w4.py |
Completes the stage 1 fake signature. |
aiter/ops/opus/moe_stage2_a8w4.py |
Completes the stage 2 decode fake signature. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Folded into #6362 at the author's request: that PR now targets main and carries this commit unchanged. |
Summary
_gen_opus_moe_stage1_a8w4_fake_tensorsand_gen_opus_moe_stage2_a8w4_decode_fake_tensorswere missing the scalar parameters of the ops they are registered for (gen_fake=of_opus_moe_stage1_a8w4_fwd_rawand_opus_moe_stage2_a8w4_decode_fwd_raw).torch_compile_guardcalls the fake with every argument the op takes, so any call under FakeTensorMode raisedTypeError. This adds the missing parameters; the fakes still returnout.Motivation
Found while replaying
fused_moeon FakeTensors for the FlyDSL MoE AOT build (#6362, stacked on this PR): every tuned row whose stage 1 or stage 2 resolves to these opus kernels failed there (43 jobs).Changes
aiter/ops/opus/moe_stage1_a8w4.py: addtopk, block_m, kernelName, inter_dim_pad, activation, swiglu_limit, situ_beta, situ_linear_beta.aiter/ops/opus/moe_stage2_a8w4.py: addtoken_num, topk, block_m, kernel_id, inter_dim_pad.Eager execution is unaffected; only FakeTensor /
torch.compiletracing reaches these functions.Testing
Both ops called under
FakeTensorModewith every argument they take (no GPU work):mainTypeError: ... takes 10 positional arguments but 18 were givenTypeError: ... takes 9 positional arguments but 14 were givenoutoutCheck script
The FlyDSL MoE AOT replay in #6362 runs every tuned row through these ops: 0 failures with this fix, 43 without.
Dependencies
Breaking Changes
None.