Repository navigation
[FlyDSL] fix: select FMoE GEMM2 A addressing by stored buffer size - #5519
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags & labels: |
There was a problem hiding this comment.
🟡 Changes recommended
A critical async large-buffer compilation issue and moderate AOT and CI coverage gaps remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR selects FlyDSL MoE GEMM2 activation addressing based on packed buffer size, using 64-bit global pointers for buffers at or above 4 GiB.
Changes:
- Propagates
use_global_athrough runtime, AOT, ordinary MoE, and FHMoE paths. - Adds synchronous and asynchronous global-pointer activation loads.
- Adds large-buffer boundary and regression tests.
File summaries
| File | Reviewed changes |
|---|---|
op_tests/test_flydsl_moe_large_buffer.py |
Adds large-buffer coverage; moderate gaps remain for default variant, offset-view, FHMoE, and FP4 CI execution. |
aiter/ops/flydsl/moe_kernels.py |
Selects addressing mode from activation-buffer size. |
aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage.py |
Forwards the addressing option. |
aiter/ops/flydsl/kernels/mixed_moe_gemm_2stage_common.py |
Implements addressing variants; critical raw global_load_lds pointer handling issue remains. |
aiter/ops/flydsl/kernels/fhmoe.py |
Forwards addressing for FHMoE. |
aiter/ops/flydsl/fhmoe.py |
Propagates runtime configuration. |
aiter/aot/flydsl/moe.py |
Selects the AOT addressing variant; moderate focused AOT coverage is still needed. |
Review details
Suppressed comments (2)
aiter/aot/flydsl/moe.py:809
- The new large-buffer script exercises the runtime wrapper, but it never drives
_precompile_to_cacheor an AOT backend. This newly added AOT-specific size decision can therefore regress independently (for example, compiling a large-buffer entry with_abuffer) while the runtime test remains green; please add a focused AOT test that checks the forwardeduse_global_avalue on both sides of the 4 GiB boundary.
use_global_a=a.numel() * a.element_size() >= (1 << 32),
op_tests/test_flydsl_moe_large_buffer.py:337
- The same no-argument CI invocation leaves the newly exposed
offset_view,reduce, andfhmoebranches disabled: the defaults below are onlyown,atomic, andmoe. In particular,offset_viewis the only test that verifies the intended distinction between a small logical buffer and a base pointer located above 4 GiB, while FHMoE exercises the new shared-expert forwarding. Please run at least focused boundary cases for these variants in CI rather than relying on optional command-line flags.
"--modes", choices=["atomic", "reduce"], nargs="+", default=["atomic"]
)
parser.add_argument(
"--storage", choices=["own", "offset_view"], nargs="+", default=["own"]
)
parser.add_argument(
"--families", choices=["moe", "fhmoe"], nargs="+", default=["moe"]
- Files reviewed: 7/7 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Initialize captured A-load bindings before specialization and share the 4 GiB predicate between runtime and AOT. Stop tracking the local validation report and large-buffer harness while retaining their workspace copies.
b7cbdc9 to
92b7cb1
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Fix compiler defaults and add regression coverage for global-addressing variants.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
|
LGTM |
|
Advisory review (static + hand-run; not a merge gate). Validation/Perf ran no GPU stage — reasons are on their lines below. Findings tagged Selects the FlyDSL MoE stage2 (GEMM2) A-activation addressing mode at compile time from the A tensor's stored size — A at or above 4 GiB builds an Review (advisory):
📝 [verified] GEMM2's weight buffer resource ( 📝 [inferred] No base-vs-head codegen comparison exists for the small-buffer path: the PR's 11-config ISA comparison ran before and after rebasing the PR (both sides carry the change), not head against the merge target, and the |
Motivation
GEMM2 buffer addressing cannot represent an A buffer of 4 GiB or larger, which can produce incorrect results for large-token MoE workloads.
Select the addressing mode from the actual A tensor size so that large inputs use 64-bit global addressing while smaller inputs retain the existing buffer-load path.
Technical Details
requires_flydsl_stage2_global_a()and share it between runtime and AOT. The decision usesnumel() * element_size() >= (1 << 32), correctly accounting for packed FP4 storage, declared padding, and contiguous views.use_global_acompiler parameter through FMoE and FHMoE. Direct compiler callers retain the safe default ofTrue._abufferand_aglobal.persist_madjustment and automatic reduce selection for large outputs.Test Plan
Validation was performed on
gfx950with FlyDSL0.3.2..textbytes, and code-object resources.swiglu_limit=10, and an FP32 reference. This configuration has a 4.5 GiB FP8 A buffer.git diff --checkon the changed files.Test Result
The full-FMoE run selected
_aglobaland reported no NaNs. The final-headlogits_diffwas7.9042e-6, satisfying the agreed<= 0.01criterion. Elementwise mismatch was 13.3% on both revisions; this result does not claim elementwise equality.Standards and Spec reviews found no outstanding issues. The full CSV performance matrix was not rerun after rebase.