Skip to content

feat: add the MoE FFN graph primitive (router + top-k expert dispatch) #500

Closed

Description

@inureyes

Part of #493

Context

Mixture-of-Experts models replace the dense MLP with a gating router that selects the top-k of N experts. This needs a new shared graph block (gather/scatter or masked expert compute), and its IREE-CUDA lowering must be validated, before any MoE family can be added.

Scope

  • Implement the shared MoE FFN graph block: router/gating, top-k selection, expert dispatch (gather/scatter or masked compute), and weighted combine.
  • Add Config::from_json fields and weight_names ordering for expert weights (router plus per-expert up/gate/down).
  • Validate the IREE-CUDA lowering on GB10.
  • Files: emitter/model.rs, emitter/config.rs, iree.rs.

Acceptance criteria

  • A small MoE model (for example qwen2_moe or OLMoE) loads and generates via the CLI MLXCEL_BACKEND=xla path and serves via mlxcel-server.
  • Single-sequence path is token-exact vs an HF fp32 oracle on a real checkpoint.
  • Serve path is reference-exact via xla_batch_bench.
  • IREE-CUDA lowering of the MoE block verified on GB10.

Dependencies

#494 (shared attention core).

Activity

  1. added
    type:enhancement
    area:architecture
    priority:high
    status:blocked
    on Jun 30, 2026
  2. added
    status:in-progress
    status:done
    and removed
    status:blocked
    status:in-progress
    on Jul 1, 2026
  3. self-assigned this
    on Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:architecturepriority:highstatus:donetype:enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions