perf(moe): run the shared expert beside the routed-expert miss copy in offloaded decode
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 22/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
Start from the offloaded decode path behind --moe-strategy offload, where the routed-expert miss copy and the shared expert run on the compute stream. The issue links fork commits e0c4109 and 4679672 as a reference, but names no file in this repo. Creating the side stream with cudaStreamCreateWithFlags and wrapping it in torch.cuda.ExternalStream is the key constraint, and CUDA-graph capture must stay safe. Done means greedy outputs stay token-identical and decode throughput is measured against the LRU baseline.
索引モデルが issue の本文から書いたものです。
説明
In offloaded decode (--moe-strategy offload, GPU decode), a layer's routed-expert miss copy and its shared expert run back to back on the compute stream. The shared expert does not depend on the routed experts. It can run while the miss copy is in flight.
Proposal: keep the miss copy on the compute stream right after its ensure, and run the shared expert on a dedicated side stream that joins before the routed outputs are combined.
The stream must be created with cudaStreamCreateWithFlags and wrapped in torch.cuda.ExternalStream. A torch.cuda.Stream() comes from a small pool and can alias the stream CUDA-graph capture runs on.
Measured on an RTX 5080 (16 GB) with Qwen3.8-Flash-Next-NVFP4, together with a scored eviction policy (cf. #174), at 32K/128K context:
| decode | |
|---|---|
| LRU | ~40.2 / ~39.6 tok/s |
| scored eviction | +5.5% |
| scored eviction + shared-expert overlap | 43.4 / 42.7 tok/s (+7.8%) |
Greedy outputs are token-identical. Peak VRAM is +24 MiB.
Implementation (on my fork, against an older main):
- e0c4109: run the shared expert on the side stream and keep the miss copy on the main one.
- 4679672: give the side stream its own CUDA stream instead of a pooled one.
- The full series, with a synthetic bench: https://github.com/gdevenyi/FreeToken/pull/72
- 主要言語
- Python
- スター
- 14.2k
- フォーク
- 1.4k
- 平均マージ
- 18時間 46分
- マージ済み PR(30日)
- 98
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
FlashML-org/FreeToken のほかの issue
-
Desktop feature
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
FlashML-org/FreeToken#800 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
FlashML-org/FreeToken#767 ·
メンテナーはふだん 1 日以内に返信
-
test_gemv_path_matches_the_transcription fails on sm_120 (bf16 rounding tie exceeds the tolerance)対応中かも @void-mckenzie が 18 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
FlashML-org/FreeToken#649 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FlashML-org/FreeToken#648 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
FlashML-org/FreeToken#646 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
FlashML-org/FreeToken の issue をすべて見る
似ている issue
-
Bug: POWERTOOLS_IDEMPOTENCY_DISABLED set to an empty or non-boolean value crashes every invocation対応中かも @lechakrawarthy が今日担当しました。 オープンbug good first issue help wanted idempotency
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
aws-powertools/powertools-lambda-python#8728 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
emeraldleaf/okl#320 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
mnemosyne-oss/mnemosyne#1309 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
huggingface/diffusers#15163 ·
メンテナーはふだん 1 日以内に返信
-
integration: ring
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
home-assistant/core#189787 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信