[PR #2889] [CLOSED] [Engine] q36: parallelise the expert copy at load #4317

Closed
opened 2026-11-07 15:34:50 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/2889
Author: @ggeorgovassilis
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: parallel-expert-copy


📝 Commits (1)

  • 0619eb4 q36: parallelise the expert copy at load (STRATA_Q36_PARALLEL_PLACE)

📊 Changes

1 file changed (+32 additions, -1 deletions)

View changed files

📝 src/qwen35/q36_engine.cu (+32 -1)

📄 Description

Problem and result

Loading a routed-expert model copies each expert into the host arena one at a time on a single thread. On main (5c8dd322), placing the 18.75 GiB of routed experts for Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf took 18.7 s (median, serial). Splitting the copy across threads cuts it to 13.5 s (median), ~1.3x, with byte-identical output.

none

Approach

place_experts() chunks the expert copy across STRATA_Q36_PARALLEL_PLACE threads: 0 is the serial path, N uses N threads, and unset uses one thread per logical core (capped at 128). Each thread copies a disjoint expert range, so the bytes written are identical to the serial path by construction. Only the load-time host-side copy changes; no kernels or memory layout change.

Validation

Passed:

  • Rebased on main (5c8dd322) and built strata + strata-q36 with CUDA 13.0 / nvcc, sm_89 (RTX 4060 Laptop 8 GB, 62 GB RAM, Linux): clean build, no errors.
  • Byte-identity: strata-q36 --model Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf --max-context 2048 --tokens 1,2,3 --n 24 with STRATA_Q36_PARALLEL_PLACE=0 vs unset: 24 greedy tokens identical.
  • Load time (the engine's "hybrid experts ... pinned host memory" placement step): 18.7 s serial vs 13.5 s parallel, median of 3 runs each, warm cache, alternating order.
  • tools/test_setup_*.py: 46/48 pass.

Failed:

  • tools/test_setup_download.py (parallel-download race) and tools/test_setup_golden.py (stale golden snapshots): both pre-existing and unrelated to this change.

Not run:

  • CUDA archs beyond sm_89 (sm_75/86/120), HIP, SYCL and Metal builds.
  • serve/test_*.py and tests/terminal.

Limits

The added code is pure C++ (std::thread) and only parallelises the host-side expert copy at load; generation is unaffected. The speedup is smaller than the original measurement on the old baseline because upstream has since optimised the load path.


🔄 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/2889 **Author:** [@ggeorgovassilis](https://github.com/ggeorgovassilis) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `parallel-expert-copy` --- ### 📝 Commits (1) - [`0619eb4`](https://github.com/Niko1221/Strata/commit/0619eb4ffb87f112d2326ccb0bede640c3bd2305) q36: parallelise the expert copy at load (STRATA_Q36_PARALLEL_PLACE) ### 📊 Changes **1 file changed** (+32 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/qwen35/q36_engine.cu` (+32 -1) </details> ### 📄 Description ## Problem and result Loading a routed-expert model copies each expert into the host arena one at a time on a single thread. On `main` (5c8dd322), placing the 18.75 GiB of routed experts for `Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf` took 18.7 s (median, serial). Splitting the copy across threads cuts it to 13.5 s (median), ~1.3x, with byte-identical output. ## Related discussion none ## Approach `place_experts()` chunks the expert copy across `STRATA_Q36_PARALLEL_PLACE` threads: `0` is the serial path, `N` uses N threads, and unset uses one thread per logical core (capped at 128). Each thread copies a disjoint expert range, so the bytes written are identical to the serial path by construction. Only the load-time host-side copy changes; no kernels or memory layout change. ## Validation **Passed:** - Rebased on `main` (5c8dd322) and built `strata` + `strata-q36` with CUDA 13.0 / nvcc, sm_89 (RTX 4060 Laptop 8 GB, 62 GB RAM, Linux): clean build, no errors. - Byte-identity: `strata-q36 --model Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf --max-context 2048 --tokens 1,2,3 --n 24` with `STRATA_Q36_PARALLEL_PLACE=0` vs unset: 24 greedy tokens identical. - Load time (the engine's "hybrid experts ... pinned host memory" placement step): 18.7 s serial vs 13.5 s parallel, median of 3 runs each, warm cache, alternating order. - `tools/test_setup_*.py`: 46/48 pass. **Failed:** - `tools/test_setup_download.py` (parallel-download race) and `tools/test_setup_golden.py` (stale golden snapshots): both pre-existing and unrelated to this change. **Not run:** - CUDA archs beyond sm_89 (sm_75/86/120), HIP, SYCL and Metal builds. - `serve/test_*.py` and `tests/terminal`. ## Limits The added code is pure C++ (`std::thread`) and only parallelises the host-side expert copy at load; generation is unaffected. The speedup is smaller than the original measurement on the old baseline because upstream has since optimised the load path. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:34:50 +07:00
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#4317
No description provided.