[PR #2205] sycl: with --expert-parallel-device, card N computes its own experts of each prompt chunk #3922

Open
opened 2026-11-07 15:31:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2205
Author: @recutita
Created: 10/13/2026
Status: 🔄 Open

Base: main ← Head: sycl-ep-prefill-main


📝 Commits (4)

  • a568dfb sycl: --expert-parallel-device N, two Arc cards compute each layer's experts together
  • 67aa411 serve: a config with --expert-parallel-device and several GPUs gets no --layer-split
  • 68c5ad5 sycl: expert parallel: system-scope barriers before the exchange flags
  • 4805fa9 sycl: with --expert-parallel-device, card N computes its own experts of each prompt chunk

📊 Changes

14 files changed (+1055 additions, -36 deletions)

View changed files

📝 docs/INTEL.md (+36 -0)
📝 include/strata/prefill/prefill.hpp (+3 -0)
📝 serve/server.py (+6 -2)
📝 serve/test_server.py (+5 -0)
📝 sycl/CMakeLists.txt (+2 -1)
➕ sycl/include/strata/core/ep_mem.hpp (+62 -0)
📝 sycl/include/strata/core/verify.hpp (+52 -0)
➕ sycl/include/strata/kernels/ep_kernels.hpp (+45 -0)
📝 sycl/src/core/verify.cpp (+216 -5)
➕ sycl/src/kernels/cuda/ep_kernels.dp.cpp (+108 -0)
📝 sycl/src/kernels/cuda/verify_kernels.dp.cpp (+42 -10)
➕ sycl/src/kernels/resident_plan_ep_parity.cpp (+143 -0)
📝 sycl/src/prefill/prefill.cpp (+134 -15)
📝 sycl/src/program/generate.cpp (+201 -3)

📄 Description

Title

Issue: none.

Summary

With --expert-parallel-device N (#1798), card N now computes its own experts of each prompt chunk. Until now the prompt path ran every expert on card 0 and read card N's experts from the GGUF for every chunk, so a prompt's speed hung on the file cache holding them (a 7200 rpm disk read an 807-token prompt at 12.3 tok/s, reported in #1798). It is on whenever --expert-parallel-device is set; STRATA_EP_PREFILL=0 turns it off and keeps the GGUF reads. Without --expert-parallel-device nothing changes.

Built on #1798: this branch holds its two commits and this one (c7bb8dd5); only the last is this PR.

Measured

2x Arc Pro B70 (32 GB each, xe, Linux), Flash-Next IQ3_XXS, Ryzen 9 9950X3D, 60 GB RAM, NVMe, through the server (sycl/serve/server_intel.py, 131,072 context, INT8 KV with --kv-resident 32768, --vram-reserve-mib 2048, --prefill 4096), greedy, thinking off. Each value is the median of three fresh documents (256 tokens generated each), two runs per arm, the arms alternated. Hot: one document read first, so the GGUF pages are in the page cache (28-32 GiB of the two files before each document of the old path). Cold: the files' page cache dropped (posix_fadvise DONTNEED, 0 GiB left) before each document.

prompt page cache STRATA_EP_PREFILL=0 this PR change
627 tokens hot 509, 507 tok/s 761, 761 tok/s +50%
2,441 tokens hot 1,091, 1,091 tok/s 1,218, 1,219 tok/s +12%
627 tokens cold 226, 223 tok/s 757, 762 tok/s 3.4x
2,441 tokens cold 590, 584 tok/s 1,221, 1,225 tok/s 2.1x

Decode after the prompts (99-107 tok/s) and short chats (75.7-76.2 tok/s) are the same in both arms.

Where the time goes (STRATA_PREFILL_TIMING=1, one chunk, hot), 2,427 tokens: card 0's expert phases (dequantize, gate/up, down) take 517 ms instead of 1,252 and card N computes its share in 430 ms meanwhile; the combine, which now waits for card N and copies its rows, grows from 56 to 413 ms; the GPU timeline goes from 2,547 to 2,147 ms and the host's GGUF staging from 2,190 ms to none. 612 tokens: card 0's expert phases 924 -> 367 ms, card N 244 ms, combine 15 -> 105 ms, timeline 1,452 -> 955 ms. With the page cache dropped the old path's timeline is 4,311 ms (2,427 tokens) and 2,888 ms (612); this PR's does not change.

What changed

  • sycl/src/prefill/prefill.cpp, include/strata/prefill/prefill.hpp: Prefill::set_ep_peer. It reuses the --peer-device prompt share (PeerPrefill) with card N's ExpertCache as the source of its experts. Per MoE layer, card 0 writes the chunk's FP16 activations into a region on card N; card N gathers its rows and runs card 0's FP16 expert path on them (dequantize, oneMKL gate/up, SwiGLU, oneMKL down; this build has no MMQ, which the --peer-device share uses), writing the rows into a second region; card 0 waits for card N on the host and copies the rows into its combine input past its caches. Both regions are card N's memory opened on card 0 through Level Zero IPC (ep_mem.hpp, as the decode windows' inbox), since dpct gives each card its own context.
  • sycl/src/program/generate.cpp: the call in --serve, unless STRATA_EP_PREFILL=0. If card N's buffers do not fit (420 MiB of regions at --prefill 4096, plus the FP16 path's buffers) the log says so and the GGUF reads stay.
  • docs/INTEL.md: the prompt path line of the expert-parallel section.

How it was checked

  • Output: the same four prompts (documents of about 1,000 and 4,000 tokens, two short chats, 256 tokens greedy each) through the server with this PR and with STRATA_EP_PREFILL=0, two starts of each: all four outputs byte-identical across the four starts.
  • The arm with STRATA_EP_PREFILL=0 logged no expert-parallel prompt line; the other logged card 1 computes its experts' rows of each prompt chunk (420 MiB of exchange regions).
  • SYCL build (AOT bmg-g31), strata.

Extra Notes

  • sycl/serve/strata-sycl.sh passes no variable whose value is 0 to the engine, so "STRATA_EP_PREFILL": "0" in a config's "env" does not reach it through that launcher (the measurements above used "00", which the engine reads as 0). This is the launcher's rule for every switch and is left alone here.
  • Card N stays idle for most of a chunk (1,682 of 2,147 ms above) and card 0 waits for it in the combine; overlapping them further is not part of this PR.
  • Tested only on 2x B70 under xe on Linux with NVMe storage; not on a slower disk, on Arc A-series cards (i915), on Windows, or with cards of two different kinds.

Assisted-by: Claude Code with Opus 5.5 medium


🔄 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/Niko1221/Strata/pull/2205 **Author:** [@recutita](https://github.com/recutita) **Created:** 10/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `sycl-ep-prefill-main` --- ### 📝 Commits (4) - [`a568dfb`](https://github.com/Niko1221/Strata/commit/a568dfbe7d00e453a7f950a1492dde18e4f8692d) sycl: --expert-parallel-device N, two Arc cards compute each layer's experts together - [`67aa411`](https://github.com/Niko1221/Strata/commit/67aa4119874f90eafbb30b37c1a230d234c27d01) serve: a config with --expert-parallel-device and several GPUs gets no --layer-split - [`68c5ad5`](https://github.com/Niko1221/Strata/commit/68c5ad51a9b62a072a646db397682bb629abbf39) sycl: expert parallel: system-scope barriers before the exchange flags - [`4805fa9`](https://github.com/Niko1221/Strata/commit/4805fa9a15dded5b9aee0a343e7470787c3e4325) sycl: with --expert-parallel-device, card N computes its own experts of each prompt chunk ### 📊 Changes **14 files changed** (+1055 additions, -36 deletions) <details> <summary>View changed files</summary> 📝 `docs/INTEL.md` (+36 -0) 📝 `include/strata/prefill/prefill.hpp` (+3 -0) 📝 `serve/server.py` (+6 -2) 📝 `serve/test_server.py` (+5 -0) 📝 `sycl/CMakeLists.txt` (+2 -1) ➕ `sycl/include/strata/core/ep_mem.hpp` (+62 -0) 📝 `sycl/include/strata/core/verify.hpp` (+52 -0) ➕ `sycl/include/strata/kernels/ep_kernels.hpp` (+45 -0) 📝 `sycl/src/core/verify.cpp` (+216 -5) ➕ `sycl/src/kernels/cuda/ep_kernels.dp.cpp` (+108 -0) 📝 `sycl/src/kernels/cuda/verify_kernels.dp.cpp` (+42 -10) ➕ `sycl/src/kernels/resident_plan_ep_parity.cpp` (+143 -0) 📝 `sycl/src/prefill/prefill.cpp` (+134 -15) 📝 `sycl/src/program/generate.cpp` (+201 -3) </details> ### 📄 Description ## Title Issue: none. ## Summary With `--expert-parallel-device N` (#1798), card N now computes its own experts of each prompt chunk. Until now the prompt path ran every expert on card 0 and read card N's experts from the GGUF for every chunk, so a prompt's speed hung on the file cache holding them (a 7200 rpm disk read an 807-token prompt at 12.3 tok/s, reported in #1798). It is on whenever `--expert-parallel-device` is set; `STRATA_EP_PREFILL=0` turns it off and keeps the GGUF reads. Without `--expert-parallel-device` nothing changes. Built on #1798: this branch holds its two commits and this one (c7bb8dd5); only the last is this PR. ### Measured 2x Arc Pro B70 (32 GB each, xe, Linux), Flash-Next IQ3_XXS, Ryzen 9 9950X3D, 60 GB RAM, NVMe, through the server (`sycl/serve/server_intel.py`, 131,072 context, INT8 KV with `--kv-resident 32768`, `--vram-reserve-mib 2048`, `--prefill 4096`), greedy, thinking off. Each value is the median of three fresh documents (256 tokens generated each), two runs per arm, the arms alternated. Hot: one document read first, so the GGUF pages are in the page cache (28-32 GiB of the two files before each document of the old path). Cold: the files' page cache dropped (`posix_fadvise` `DONTNEED`, 0 GiB left) before each document. | prompt | page cache | `STRATA_EP_PREFILL=0` | this PR | change | |---|---|---|---|---| | 627 tokens | hot | 509, 507 tok/s | 761, 761 tok/s | +50% | | 2,441 tokens | hot | 1,091, 1,091 tok/s | 1,218, 1,219 tok/s | +12% | | 627 tokens | cold | 226, 223 tok/s | 757, 762 tok/s | 3.4x | | 2,441 tokens | cold | 590, 584 tok/s | 1,221, 1,225 tok/s | 2.1x | Decode after the prompts (99-107 tok/s) and short chats (75.7-76.2 tok/s) are the same in both arms. Where the time goes (`STRATA_PREFILL_TIMING=1`, one chunk, hot), 2,427 tokens: card 0's expert phases (dequantize, gate/up, down) take 517 ms instead of 1,252 and card N computes its share in 430 ms meanwhile; the combine, which now waits for card N and copies its rows, grows from 56 to 413 ms; the GPU timeline goes from 2,547 to 2,147 ms and the host's GGUF staging from 2,190 ms to none. 612 tokens: card 0's expert phases 924 -> 367 ms, card N 244 ms, combine 15 -> 105 ms, timeline 1,452 -> 955 ms. With the page cache dropped the old path's timeline is 4,311 ms (2,427 tokens) and 2,888 ms (612); this PR's does not change. ## What changed - `sycl/src/prefill/prefill.cpp`, `include/strata/prefill/prefill.hpp`: `Prefill::set_ep_peer`. It reuses the `--peer-device` prompt share (`PeerPrefill`) with card N's `ExpertCache` as the source of its experts. Per MoE layer, card 0 writes the chunk's FP16 activations into a region on card N; card N gathers its rows and runs card 0's FP16 expert path on them (dequantize, oneMKL gate/up, SwiGLU, oneMKL down; this build has no MMQ, which the `--peer-device` share uses), writing the rows into a second region; card 0 waits for card N on the host and copies the rows into its combine input past its caches. Both regions are card N's memory opened on card 0 through Level Zero IPC (`ep_mem.hpp`, as the decode windows' inbox), since dpct gives each card its own context. - `sycl/src/program/generate.cpp`: the call in `--serve`, unless `STRATA_EP_PREFILL=0`. If card N's buffers do not fit (420 MiB of regions at `--prefill 4096`, plus the FP16 path's buffers) the log says so and the GGUF reads stay. - `docs/INTEL.md`: the prompt path line of the expert-parallel section. ## How it was checked - Output: the same four prompts (documents of about 1,000 and 4,000 tokens, two short chats, 256 tokens greedy each) through the server with this PR and with `STRATA_EP_PREFILL=0`, two starts of each: all four outputs byte-identical across the four starts. - The arm with `STRATA_EP_PREFILL=0` logged no expert-parallel prompt line; the other logged `card 1 computes its experts' rows of each prompt chunk (420 MiB of exchange regions)`. - SYCL build (AOT `bmg-g31`), `strata`. ## Extra Notes - `sycl/serve/strata-sycl.sh` passes no variable whose value is `0` to the engine, so `"STRATA_EP_PREFILL": "0"` in a config's `"env"` does not reach it through that launcher (the measurements above used `"00"`, which the engine reads as 0). This is the launcher's rule for every switch and is left alone here. - Card N stays idle for most of a chunk (1,682 of 2,147 ms above) and card 0 waits for it in the combine; overlapping them further is not part of this PR. - Tested only on 2x B70 under xe on Linux with NVMe storage; not on a slower disk, on Arc A-series cards (i915), on Windows, or with cards of two different kinds. Assisted-by: Claude Code with Opus 5.5 medium --- <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 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
Niko1221/Strata#3922
No description provided.