[PR #786] perf: skip unused source-order sorts for expanded deterministic dispatch #784

Open
opened 2026-10-27 21:06:18 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/deepseek-ai/DeepEP/pull/786
Author: @yuweih205
Created: 10/16/2026
Status: 🔄 Open

Base: main ← Head: perf/skip-unused-expanded-sort


📝 Commits (2)

  • 3751ceb Skip unused source-order sorts for expanded deterministic dispatch
  • 686949f Compare only valid receive prefixes in repeated deterministic dispatch checks

📊 Changes

2 files changed (+15 additions, -9 deletions)

View changed files

📝 deep_ep/buffers/ep.py (+11 -7)
📝 tests/ep/test_ep.py (+4 -2)

📄 Description

Fresh expanded deterministic dispatch runs its own stable expert/source sort, and cached expanded dispatch writes into the saved sorted slots, so the compact source-order sort computed before them is never consumed. deterministic_sort now returns early for cached expanded dispatch and only builds the compact sort inside the compact branch.

Deterministic layout Sorts before after
Fresh expanded 2 1
Cached expanded 1 0
Compact 1 1

Two repeated-dispatch checks in tests/ep/test_ep.py now compare only the valid receive prefix: unused sync-free capacity is undefined even without expert-alignment padding.

8×H200 (PyTorch 2.13.0+cu132): the EP8 functional suite passes (72 direct + 36 deferred configurations, 12,288 rank-dispatch checks across both record-stream policies, BF16/FP8, CPU/GPU counts, fresh/cached); fresh expanded dispatch at 1024 tokens/rank, hidden 3072, top-8 is 4.7–5.8% faster (12/12 process repeats on each of two nodes, A/A spread 0.81%). Per-process data: gist.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/deepseek-ai/DeepEP/pull/786 **Author:** [@yuweih205](https://github.com/yuweih205) **Created:** 10/16/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `perf/skip-unused-expanded-sort` --- ### 📝 Commits (2) - [`3751ceb`](https://github.com/deepseek-ai/DeepEP/commit/3751ceb59ef92289fa539889697c05eab4c748e9) Skip unused source-order sorts for expanded deterministic dispatch - [`686949f`](https://github.com/deepseek-ai/DeepEP/commit/686949f288b8b5d5d7aefebf933aed77725abb45) Compare only valid receive prefixes in repeated deterministic dispatch checks ### 📊 Changes **2 files changed** (+15 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `deep_ep/buffers/ep.py` (+11 -7) 📝 `tests/ep/test_ep.py` (+4 -2) </details> ### 📄 Description Fresh expanded deterministic dispatch runs its own stable expert/source sort, and cached expanded dispatch writes into the saved sorted slots, so the compact source-order sort computed before them is never consumed. `deterministic_sort` now returns early for cached expanded dispatch and only builds the compact sort inside the compact branch. | Deterministic layout | Sorts before | after | | --- | ---: | ---: | | Fresh expanded | 2 | 1 | | Cached expanded | 1 | 0 | | Compact | 1 | 1 | Two repeated-dispatch checks in `tests/ep/test_ep.py` now compare only the valid receive prefix: unused sync-free capacity is undefined even without expert-alignment padding. 8×H200 (PyTorch 2.13.0+cu132): the EP8 functional suite passes (72 direct + 36 deferred configurations, 12,288 rank-dispatch checks across both record-stream policies, BF16/FP8, CPU/GPU counts, fresh/cached); fresh expanded dispatch at 1024 tokens/rank, hidden 3072, top-8 is 4.7–5.8% faster (12/12 process repeats on each of two nodes, A/A spread 0.81%). Per-process data: [gist](https://gist.github.com/yuweih205/1696535356c2654b255f28617f9fa96f). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepEP#784
No description provided.