Skip to content

update(nemotron-h): add intra-MoE phase profiling (#284)#832

Merged
inureyes merged 1 commit into
mainfrom
update/issue-284-optimize-moe-decode
Jul 21, 2026
Merged

update(nemotron-h): add intra-MoE phase profiling (#284)#832
inureyes merged 1 commit into
mainfrom
update/issue-284-optimize-moe-decode

Conversation

@inureyes

Copy link
Copy Markdown
Member

Summary

  • Add opt-in router, routed-expert, combine, and shared-expert forced-evaluation timing inside fused_moe_forward.
  • Keep production decode unsynchronized and correct the stale explanation for the neutral routed squared-ReLU experiment.
  • Document the diagnostic output, M1 Ultra reproduction command, and evidence gate for any future shared-expert or router/combine kernel.

Scope decision

Issue #284 records a profiling conclusion plus suggested optimization levers. This change implements the missing measurement gate and deliberately does not ship a speculative hardware kernel before that gate shows recoverable time; any follow-up kernel must demonstrate greedy parity and an unsynchronized throughput win.

Validation

  • cargo fmt --all -- --check
  • cargo check -p mlxcel-core
  • cargo build -p mlxcel-core
  • cargo clippy -p mlxcel-core --lib -- -D warnings
  • cargo test -p mlxcel-core --lib ffi_tests::test_compiled_swiglu_activation -- --exact
  • Attempted cargo test -p mlxcel-core --lib; the backend-neutral run is blocked by two existing paged-cache failures and then a CUDA-only kernel abort on this non-CUDA test process.

Closes #284

Add opt-in forced-evaluation boundaries inside fused_moe_forward so router, routed-expert, combine, and shared-expert costs can be attributed independently.

Keep normal decode unsynchronized, clarify why the routed squared-ReLU kernel was neutral, and document the M1 Ultra re-measurement and evidence gate for future fusion work.

Validation: cargo fmt --all -- --check; cargo check -p mlxcel-core; cargo build -p mlxcel-core; cargo clippy -p mlxcel-core --lib -- -D warnings; cargo test -p mlxcel-core --lib ffi_tests::test_compiled_swiglu_activation -- --exact. The full library suite is not a valid backend-neutral gate on this host because existing paged-cache tests fail and a CUDA-only kernel aborts without CUDA.

Refs #284
@inureyes inureyes added status:review Under review type:performance Performance improvements priority:medium Medium priority area:models Model architectures, weights, loading, metadata area:inference Generation, sampling, decoding (incl. speculative, DRY) platform:macos macOS (Apple Silicon) specific status:done Completed and removed status:review Under review labels Jul 21, 2026
@inureyes
inureyes merged commit ac38f97 into main Jul 21, 2026
5 checks passed
@inureyes
inureyes deleted the update/issue-284-optimize-moe-decode branch July 21, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:inference Generation, sampling, decoding (incl. speculative, DRY) area:models Model architectures, weights, loading, metadata platform:macos macOS (Apple Silicon) specific priority:medium Medium priority status:done Completed type:performance Performance improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(nemotron-h): decode gap is MoE-block op-density (routed + shared expert), not SSM/attention

1 participant