[PR #3805] [Engine] Fix SYCL host expert job overflow #4788

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3805
Author: @pankleks
Created: 10/23/2026
Status: 🔄 Open

Base: main ← Head: fix/sycl-host-expert-job-capacity


📝 Commits (1)

  • 9044023 fix(sycl): bound host expert jobs to their token capacity

📊 Changes

5 files changed (+190 additions, -6 deletions)

View changed files

📝 sycl/CMakeLists.txt (+10 -0)
➕ sycl/include/strata/host_expert_jobs.hpp (+27 -0)
📝 sycl/src/core/expert_source.cpp (+5 -6)
➕ sycl/tests/host_expert_jobs_native_test.cpp (+76 -0)
➕ sycl/tests/host_expert_jobs_test.cpp (+72 -0)

📄 Description

Problem and result

On Strata 0.2.2 (011c9e600a93), a Linux SYCL JIT build loaded IQ3_XXS successfully but crashed on the first streamed arithmetic request. The machine runs Ubuntu 26.04 with a Ryzen 9 5950X and two Arc Pro B50 16 GB cards, with --layer-split 25, --prefill 1024, --spec 4, a 262144 context, INT8 KV and --kv-resident 32768. Host-served experts were enabled (STRATA_VERIFY_NO_HOST=0). The request was “What is 6 times 7? Reply with only the number.”, streamed, temperature 0, thinking disabled.

The core showed ExpertJobMulti::nt == 9 although its token arrays hold MAXT == 8. Repeated routed IDs had overfilled a job and overwritten its fmt pointer. The resulting stack reached native_gu_rows from ExpertPool::drain and run_split_multi_native.

The fix bounds each job to MAXT entries and starts another job when necessary, without dropping any routed output. The same fix has passed live inference on the affected 0.2.2 installation. The PR is rebased onto current main (5c8dd322528c); the SYCL dispatch implementation is identical there.

No matching overflow fix was found in open or closed issues/PRs. #3626 reports a similar CPU-row-reader stack on CUDA with IQ1_M, but the cause has not been verified as the same. This SYCL-only PR does not claim to resolve that report.

Approach

  • Split a full host expert job before appending another entry. Keep all activation/output pointers, including repeated IDs.
  • Clear reused job metadata, including the optional per-job format pointer.
  • Reject an exhausted job-vector capacity instead of writing outside it.
  • Add a CPU-only grouping regression and a native Q4_0 arithmetic regression, registered in the SYCL CMake tests. No model, routing, memory-reserve or power-policy defaults change. Unrelated local telemetry patches are not included.

Validation

Passed:

  • On the affected 0.2.2 installation with this fix: both quantize_act_parity and iq_multi_parity on each B50; streamed arithmetic; tool-call/result round-trip; Polish output; CPU vision; a 4093-token three-anchor prompt and cached follow-up; unload/reload and resumed two-card telemetry. That installation also has separate local telemetry patches, not included here.
  • The grouping regression covers 32 cases across window widths 1–8, unique IDs, repeated IDs and reused job storage. It also passed ASan/UBSan.
  • The native regression covers 32 grouped evaluations (synthetic 64×64 Q4_0, 1/3 workers, host participation off/on), bit-identical to independently evaluated single-token rows.

Exact submitted revision 904402345ea8be3b0571be25b91ddd845111bfa5, based on 5c8dd322528c: Linux SYCL JIT Release, oneAPI 2026.1, Ubuntu 26.04, Ryzen 9 5950X, two B50s. A separate checkout was used; production was not switched. GGML_SRC below denotes the clean checkout of the pinned llama.cpp revision 3cf03257f219afbe7334045ff7c6a06ac68c627d.

cmake -S sycl -B build-sycl -G Ninja -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
  -DSTRATA_SYCL_AOT= -DSTRATA_SYCL_JIT_STATELESS=ON \
  -DSTRATA_GGML_DIR="$GGML_SRC"
cmake --build build-sycl --target strata host_expert_jobs_test \
  host_expert_jobs_native_test quantize_act_parity iq_multi_parity --parallel 4
ctest --test-dir build-sycl -R '^host_expert_jobs(_native)?_test$' --output-on-failure

Build succeeded; both host tests passed (32 grouping cases and 32 native evaluations). Both GPU parity tests also passed on each B50:

for gpu in 0 1; do
  SYCL_CACHE_PERSISTENT=0 ONEAPI_DEVICE_SELECTOR="level_zero:$gpu" \
    ctest --test-dir build-sycl -R '^(quantize_act_parity|iq_multi_parity)$' \
    --output-on-failure --timeout 180
done

The exact submitted grouping code also passed this standalone sanitizer run on the B50 host and a second Linux workstation:

g++ -std=c++17 -O1 -g -fno-omit-frame-pointer -fsanitize=address,undefined \
  -I sycl/include -I include sycl/tests/host_expert_jobs_test.cpp -o host-jobs-asan
ASAN_OPTIONS=detect_leaks=1 ./host-jobs-asan
# PASS: 32 grouping cases, including duplicate IDs, full windows and reused jobs

Failed:

  • Before the fix, the observed 0.2.2 live request terminated the engine with exit -11 / SIGSEGV. The private core was inspected locally and is not uploaded.
  • A CPU-only reproducer of the previous grouping rule fails before the out-of-bounds write with FAIL: job token count 8, capacity 8 (nt=1 pattern=1). The corrected grouping passes.

Not run:

  • Full-model inference on the rebased current-main revision: live model validation above was on 0.2.2 plus the identical fix, not 0.2.3/main.
  • Near-full 256K inference, sustained-load or performance comparisons; no speedup claim.
  • Windows SYCL or AOT builds. CUDA, HIP and Metal are not changed or validated by this PR.

Limits

This fixes the confirmed host-job overflow. It does not establish why repeated IDs arose, change the router, or deduplicate routing contributions. Arithmetic equivalence is established only for the synthetic Q4_0 regression, not all quantizations or configurations. AI-assisted investigation and implementation; the evidence above comes from the actual local runs.


🔄 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/3805 **Author:** [@pankleks](https://github.com/pankleks) **Created:** 10/23/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/sycl-host-expert-job-capacity` --- ### 📝 Commits (1) - [`9044023`](https://github.com/Niko1221/Strata/commit/904402345ea8be3b0571be25b91ddd845111bfa5) fix(sycl): bound host expert jobs to their token capacity ### 📊 Changes **5 files changed** (+190 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `sycl/CMakeLists.txt` (+10 -0) ➕ `sycl/include/strata/host_expert_jobs.hpp` (+27 -0) 📝 `sycl/src/core/expert_source.cpp` (+5 -6) ➕ `sycl/tests/host_expert_jobs_native_test.cpp` (+76 -0) ➕ `sycl/tests/host_expert_jobs_test.cpp` (+72 -0) </details> ### 📄 Description ## Problem and result On Strata 0.2.2 (`011c9e600a93`), a Linux SYCL JIT build loaded IQ3_XXS successfully but crashed on the first streamed arithmetic request. The machine runs Ubuntu 26.04 with a Ryzen 9 5950X and two Arc Pro B50 16 GB cards, with `--layer-split 25`, `--prefill 1024`, `--spec 4`, a 262144 context, INT8 KV and `--kv-resident 32768`. Host-served experts were enabled (`STRATA_VERIFY_NO_HOST=0`). The request was “What is 6 times 7? Reply with only the number.”, streamed, temperature 0, thinking disabled. The core showed `ExpertJobMulti::nt == 9` although its token arrays hold `MAXT == 8`. Repeated routed IDs had overfilled a job and overwritten its `fmt` pointer. The resulting stack reached `native_gu_rows` from `ExpertPool::drain` and `run_split_multi_native`. The fix bounds each job to `MAXT` entries and starts another job when necessary, without dropping any routed output. The same fix has passed live inference on the affected 0.2.2 installation. The PR is rebased onto current `main` (`5c8dd322528c`); the SYCL dispatch implementation is identical there. ## Related discussion No matching overflow fix was found in open or closed issues/PRs. #3626 reports a similar CPU-row-reader stack on CUDA with IQ1_M, but the cause has not been verified as the same. This SYCL-only PR does **not** claim to resolve that report. ## Approach - Split a full host expert job before appending another entry. Keep all activation/output pointers, including repeated IDs. - Clear reused job metadata, including the optional per-job format pointer. - Reject an exhausted job-vector capacity instead of writing outside it. - Add a CPU-only grouping regression and a native Q4_0 arithmetic regression, registered in the SYCL CMake tests. No model, routing, memory-reserve or power-policy defaults change. Unrelated local telemetry patches are not included. ## Validation **Passed:** - On the affected 0.2.2 installation with this fix: both `quantize_act_parity` and `iq_multi_parity` on each B50; streamed arithmetic; tool-call/result round-trip; Polish output; CPU vision; a 4093-token three-anchor prompt and cached follow-up; unload/reload and resumed two-card telemetry. That installation also has separate local telemetry patches, not included here. - The grouping regression covers 32 cases across window widths 1–8, unique IDs, repeated IDs and reused job storage. It also passed ASan/UBSan. - The native regression covers 32 grouped evaluations (synthetic 64×64 Q4_0, 1/3 workers, host participation off/on), bit-identical to independently evaluated single-token rows. Exact submitted revision **`904402345ea8be3b0571be25b91ddd845111bfa5`**, based on `5c8dd322528c`: Linux SYCL JIT Release, oneAPI 2026.1, Ubuntu 26.04, Ryzen 9 5950X, two B50s. A separate checkout was used; production was not switched. `GGML_SRC` below denotes the clean checkout of the pinned llama.cpp revision `3cf03257f219afbe7334045ff7c6a06ac68c627d`. ```sh cmake -S sycl -B build-sycl -G Ninja -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \ -DSTRATA_SYCL_AOT= -DSTRATA_SYCL_JIT_STATELESS=ON \ -DSTRATA_GGML_DIR="$GGML_SRC" cmake --build build-sycl --target strata host_expert_jobs_test \ host_expert_jobs_native_test quantize_act_parity iq_multi_parity --parallel 4 ctest --test-dir build-sycl -R '^host_expert_jobs(_native)?_test$' --output-on-failure ``` Build succeeded; both host tests passed (32 grouping cases and 32 native evaluations). Both GPU parity tests also passed on each B50: ```sh for gpu in 0 1; do SYCL_CACHE_PERSISTENT=0 ONEAPI_DEVICE_SELECTOR="level_zero:$gpu" \ ctest --test-dir build-sycl -R '^(quantize_act_parity|iq_multi_parity)$' \ --output-on-failure --timeout 180 done ``` The exact submitted grouping code also passed this standalone sanitizer run on the B50 host and a second Linux workstation: ```sh g++ -std=c++17 -O1 -g -fno-omit-frame-pointer -fsanitize=address,undefined \ -I sycl/include -I include sycl/tests/host_expert_jobs_test.cpp -o host-jobs-asan ASAN_OPTIONS=detect_leaks=1 ./host-jobs-asan # PASS: 32 grouping cases, including duplicate IDs, full windows and reused jobs ``` **Failed:** - Before the fix, the observed 0.2.2 live request terminated the engine with exit `-11` / SIGSEGV. The private core was inspected locally and is not uploaded. - A CPU-only reproducer of the previous grouping rule fails before the out-of-bounds write with `FAIL: job token count 8, capacity 8 (nt=1 pattern=1)`. The corrected grouping passes. **Not run:** - Full-model inference on the rebased current-main revision: live model validation above was on 0.2.2 plus the identical fix, not 0.2.3/main. - Near-full 256K inference, sustained-load or performance comparisons; no speedup claim. - Windows SYCL or AOT builds. CUDA, HIP and Metal are not changed or validated by this PR. ## Limits This fixes the confirmed host-job overflow. It does not establish why repeated IDs arose, change the router, or deduplicate routing contributions. Arithmetic equivalence is established only for the synthetic Q4_0 regression, not all quantizations or configurations. AI-assisted investigation and implementation; the evidence above comes from the actual local runs. --- <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#4788
No description provided.