Skip to content

[None][refactor] Separate MegaMoE CuteDSL runtime and workspace ownership - #20578

Draft
Barry-Delaney wants to merge 3 commits into
NVIDIA:mainfrom
Barry-Delaney:codex/megamoe-cutedsl-public-refactor
Draft

Barry-Delaney wants to merge 3 commits into
NVIDIA:mainfrom
Barry-Delaney:codex/megamoe-cutedsl-public-refactor

Conversation

@Barry-Delaney

@Barry-Delaney Barry-Delaney commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

mega_moe_cute_dsl.py combines backend execution with runtime probing, distributed initialization, buffer management, and profiling-scratch ownership. Separate these responsibilities into focused components:

  • cute_dsl_runtime.py: runtime capability checks and build-time EP process-group resolution.
  • cute_dsl_workspace.py: cached buffers, input staging, and padded-tail cleanup.
  • cute_dsl_profiling.py: lazy scratch acquisition, weak ownership, and per-call cleanup.

The backend retains weight handling, quantization, and launch orchestration. Shared kernel-property queries replace the duplicated allocation queries. Workspace registration and capability lookup go through its methods, and launch orchestration preserves lazy AutoTuner initialization. Existing backend exports are preserved. MPI bootstrap limits its fallback to expected MPI/runtime/value errors instead of swallowing arbitrary exceptions.

Test Coverage

  • 21 CPU component and launch-orchestration cases passed using dependency doubles and --noconftest. They cover buffer reuse, input staging, padded tails, MPI device preservation and query failures, process-group selection, runtime-probe caching, lazy scratch lifetime/cleanup, and avoiding tuner queries outside multi-rank autotuning. The existing CPU test list includes the MoE test directory.
  • A supplementary local differential harness compared 96 scenario combinations, with six sequential forwards per combination. Recorded allocation arguments, tensor operations, custom-op arguments, bucket priming, and output selection matched the base implementation. This harness is not included in the PR and does not validate GPU numerics.
  • All applicable pre-commit and commit-message hooks passed, including Ruff, formatting, vendored-source consistency, test-list validation, and DCO.
  • GPU numerical parity, multi-rank execution, CUDA graph capture, and performance validation remain pending.

PR Checklist

  • Reviewed the repository checklist for this internal refactor; no public configuration, dependency, or ownership changes.
  • Complete GPU validation before marking ready for review.

Update docstrings and comments that pointed at methods moved into
MegaMoeWorkspace, clarify the multi-rank empty-chunk note and the
missing-provider error, and add the full Apache license text to the new
modules.

Signed-off-by: Barry Kang <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant