[PR #1890] [CLOSED] sycl: Windows/OpenCL support for the merged port, and a live free-VRAM figure for the expert cache (#1549) #3741

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1890
Author: @demetree
Created: 10/10/2026
Status: ❌ Closed

Base: main ← Head: intel-vram-headroom-dxgi


📝 Commits (10+)

  • 223ee70 serve: make the expert-cache VRAM headroom a knob, opt-in on CUDA and HIP (#1549)
  • fe7aaa4 probe+port: a live free-VRAM figure for the OpenCL backend (#1549)
  • 9f1b6a5 Windows/OpenCL bring-up for the merged SYCL port, and a live free-VRAM figure (#1549)
  • 9188d55 sycl: the serve-side VRAM check asks the same source as the cache sizing
  • 99664a1 sycl: the per-layer sizing path asks the same source as the auto branch
  • 6cdf81f sycl verify: the eager path replays the commit instead of dereferencing a null graph (#1549)
  • d2a7dda sycl: the free-VRAM comment names the fallback that exists (#1549)
  • 1baf4c9 sycl: opt-in Level Zero on Windows, and the diagnosis behind it
  • 7e3ab52 sycl: Level Zero needs the eager replay - command graphs stall the verify window
  • 3664c0a docs: the Level Zero diagnosis, and why the driver must be the generic Arc line

📊 Changes

18 files changed (+1166 additions, -97 deletions)

View changed files

➕ LEVEL_ZERO_FINDINGS.md (+306 -0)
📝 include/strata/core/expert_cache.hpp (+43 -0)
📝 src/program/generate.cpp (+11 -1)
📝 sycl/CMakeLists.txt (+80 -5)
📝 sycl/include/strata/core/mtp.hpp (+5 -0)
📝 sycl/include/strata/core/verify.hpp (+3 -0)
➕ sycl/probe/vram_pressure.cpp (+120 -0)
➕ sycl/serve/strata-sycl.bat (+99 -0)
📝 sycl/src/core/expert_cache.cpp (+46 -0)
📝 sycl/src/core/gguf_expert_source.cpp (+43 -4)
📝 sycl/src/core/mtp.cpp (+75 -28)
📝 sycl/src/core/pinned.dp.cpp (+4 -1)
📝 sycl/src/core/verify.cpp (+24 -6)
📝 sycl/src/kernels/cuda/verify_kernels.dp.cpp (+3 -3)
📝 sycl/src/prefill/gemm.dp.cpp (+229 -18)
📝 sycl/src/program/generate.cpp (+38 -31)
➕ sycl/tools/build.bat (+31 -0)
➕ sycl/tools/onemath_config.hpp (+6 -0)

📄 Description

What this is

main now carries the SYCL port, built and measured on Linux with Level Zero, where oneMKL and command graphs both work. This is the Windows half — the pieces Windows needs that a Linux build never exercises, plus the expert-cache sizing fix that came out of building it.

Rebased onto 7695859a (the 0.1.43 release); the first version of this PR was against a1c47bc9. All measurements below are from the rebased tree.

Single card, all measurements: Arc Pro B70, 32 GB, Windows 11 24H2, driver 32.0.101.8976 (Arc Pro line) / 32.0.101.9034 (generic), OpenCL + eager replay, engine 0.1.43.

The eight commits

223ee707 serve: make the expert-cache VRAM headroom a knob, opt-in on CUDA and HIP
fe7aaa44 probe+port: a live free-VRAM figure for the OpenCL backend
9f1b6a57 Windows/OpenCL bring-up for the merged SYCL port
9188d551 sycl: the serve-side VRAM check asks the same source as the cache sizing
99664a1d sycl: the per-layer sizing path asks the same source as the auto branch
6cdf81f5 sycl verify: the eager path replays the commit instead of dereferencing a null graph
d2a7ddac sycl: the free-VRAM comment names the fallback that exists (comment only)
1baf4c95 sycl: opt-in Level Zero on Windows, and the diagnosis behind it

What it changes

1. The Windows build layer — sycl/CMakeLists.txt, sycl/tools/build.bat, sycl/tools/onemath_config.hpp, sycl/serve/strata-sycl.bat. Compiler-ID gating (/fp:precise and /W3 for MSVC, -fp-model=precise elsewhere — the precise model is load-bearing: quantize_act_parity goes from byte-exact to 303k mismatches without it), STRATA_SYCL_JIT_STATELESS (the IGC >4 GiB surface-offset bug), the oneMKL stub for an installer-free conda install, and the DLLs beside strata.exe.

2. Portability fixes in the migrated copies — the STRATA_USE_CUDA guard in pinned.dp.cpp, OUT→WRITE_OUT in verify_kernels.dp.cpp, Windows file I/O in gguf_expert_source.cpp, the small/memmem fixes in generate.cpp, and the plain-SYCL fallback GEMM in gemm.dp.cpp gated on onemkl_usable().

3. The live free-VRAM figure — on OpenCL there is no free-VRAM query at all (ext_intel_free_memory needs Level Zero sysman), so get_memory_info answers 0, which sizes the cache to nothing. own_gpu_local() asks DXGI. Same binary, free card, 2047-token prompt: 0 slots / refused → 12,288 slots / 23.42 GiB, prompt 81.1 tok/s, decode 66.6 tok/s.

4. 6cdf81f5, submitted separately as #2106 — completes STRATA_VERIFY_EAGER for the commit path. main's eager support covers the window (record_window, run()'s guard) but not the commit; mtp.cpp's prepare_chain documents the gap out loud.

5. 1baf4c95, the Level Zero diagnosis — opt-in STRATA_SYCL_LEVEL_ZERO=1 in the launcher, off by default, plus LEVEL_ZERO_FINDINGS.md recording how it was established. Off by default because the serve request path stalls intermittently; when it runs it is 108.8 tok/s decode and 81.1 prefill against OpenCL's 66.6 / 81.1, with the v1 Level Zero adapter beating v2 by +24% decode and 34x faster graph capture.

The one thing I would most want reviewed

ur_adapter_level_zero.dll imports UMF.dll and the VCRUNTIME140* set, and sycl/CMakeLists.txt stages neither beside strata.exe. The adapter fails to load, the UR loader reports only OpenCL, and ONEAPI_DEVICE_SELECTOR=level_zero:0 kills the process with 0xC0000409 before main prints anything. The silence is the expensive part: every Level Zero adapter failure looks like "there is no Level Zero here", which is what sent me down the OpenCL path in the first place and cost days. The workaround in this PR is Library\bin first on PATH; the proper fix is to extend the copy list.

Second, and related: the v1 Level Zero adapter beats v2 decisively on this card (+24% decode, graph capture 276 ms vs 9,495 ms). #1940 pins v2 on for graph replay (intel/llvm#23073); on a B70 with this workload that trade is the wrong one.

What this leaves alone

Every new feature is opt-in and the default path is byte-identical unless a variable is set: STRATA_EXPERT_CACHE_HEADROOM defaults to 0 everywhere, STRATA_SYCL_LEVEL_ZERO is unset by default, and STRATA_VERIFY_EAGER is only read where it already was. Every launcher variable is only written when not already defined, so an explicit ONEAPI_DEVICE_SELECTOR for a two-card split still wins. No engine source changed in 1baf4c95.

What I could not verify — please read before reviewing

  • Built and run on SYCL/Windows only. I have no CUDA, HIP or Linux toolchain on this machine. Files here are shared across backends and I could not build them.
  • A clean checkout of the SYCL port does not compile on Windows without commit 9f1b6a57 (pinned.dp.cpp's unguarded CUDA calls, the OUT macro in verify_kernels.dp.cpp). So it cannot be built standalone here.
  • oneMKL still refuses — "does not support this API" — against both the PyPI runtime and the standalone oneAPI 2026.0 runtime, with identical timings. The engine's expert GEMMs are BF16 (gemm.dp.cpp:1031), the likely unsupported type; that is a hypothesis, not a measurement. So the prompt path is on the plain-SYCL fallback and the prefill figures are not oneMKL-backed.
  • The Level Zero path is not reliable as a default. The stall message, what it is not, and where to instrument next are in LEVEL_ZERO_FINDINGS.md.

Suggested review order

  1. gemm.dp.cpp — the plain-SYCL fallback is what makes prompts run at all here, and it is the biggest piece.
  2. verify.cpp — the capture_commit eager guard (#2106 is the same change standalone).
  3. expert_cache.cpp — the DXGI figure, since it changes sizing behaviour on every SYCL backend.
  4. CMakeLists.txt — the copy list above, and the compiler-ID gating.

I would rather split this: 223ee707 + d2a7ddac are one coherent knob, 6cdf81f5 is #2106, and 1baf4c95 is really a bug report about the copy list with an opt-in switch attached.


🔄 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/1890 **Author:** [@demetree](https://github.com/demetree) **Created:** 10/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `intel-vram-headroom-dxgi` --- ### 📝 Commits (10+) - [`223ee70`](https://github.com/Niko1221/Strata/commit/223ee707198cb680aabb0c51d7dc321213498222) serve: make the expert-cache VRAM headroom a knob, opt-in on CUDA and HIP (#1549) - [`fe7aaa4`](https://github.com/Niko1221/Strata/commit/fe7aaa4428828bfcf3734b33bded6f8408836745) probe+port: a live free-VRAM figure for the OpenCL backend (#1549) - [`9f1b6a5`](https://github.com/Niko1221/Strata/commit/9f1b6a57a8f127caa789a44e69ad969c9ea47b70) Windows/OpenCL bring-up for the merged SYCL port, and a live free-VRAM figure (#1549) - [`9188d55`](https://github.com/Niko1221/Strata/commit/9188d551e082b362fff9f85647dfab8c54470c0d) sycl: the serve-side VRAM check asks the same source as the cache sizing - [`99664a1`](https://github.com/Niko1221/Strata/commit/99664a1d95abd210c4fdde59d923ae903dc280f3) sycl: the per-layer sizing path asks the same source as the auto branch - [`6cdf81f`](https://github.com/Niko1221/Strata/commit/6cdf81f50c7d320b69b2fb6f16798d67d05db27f) sycl verify: the eager path replays the commit instead of dereferencing a null graph (#1549) - [`d2a7dda`](https://github.com/Niko1221/Strata/commit/d2a7ddacf027b71d5cfa349d44f7acfd94a82baf) sycl: the free-VRAM comment names the fallback that exists (#1549) - [`1baf4c9`](https://github.com/Niko1221/Strata/commit/1baf4c952ef5799a52a1a82c12fdca8b90845898) sycl: opt-in Level Zero on Windows, and the diagnosis behind it - [`7e3ab52`](https://github.com/Niko1221/Strata/commit/7e3ab5213728486791b70798bf3c98d80110ffd5) sycl: Level Zero needs the eager replay - command graphs stall the verify window - [`3664c0a`](https://github.com/Niko1221/Strata/commit/3664c0a3b23ee00331154ab0202199b8319b847e) docs: the Level Zero diagnosis, and why the driver must be the generic Arc line ### 📊 Changes **18 files changed** (+1166 additions, -97 deletions) <details> <summary>View changed files</summary> ➕ `LEVEL_ZERO_FINDINGS.md` (+306 -0) 📝 `include/strata/core/expert_cache.hpp` (+43 -0) 📝 `src/program/generate.cpp` (+11 -1) 📝 `sycl/CMakeLists.txt` (+80 -5) 📝 `sycl/include/strata/core/mtp.hpp` (+5 -0) 📝 `sycl/include/strata/core/verify.hpp` (+3 -0) ➕ `sycl/probe/vram_pressure.cpp` (+120 -0) ➕ `sycl/serve/strata-sycl.bat` (+99 -0) 📝 `sycl/src/core/expert_cache.cpp` (+46 -0) 📝 `sycl/src/core/gguf_expert_source.cpp` (+43 -4) 📝 `sycl/src/core/mtp.cpp` (+75 -28) 📝 `sycl/src/core/pinned.dp.cpp` (+4 -1) 📝 `sycl/src/core/verify.cpp` (+24 -6) 📝 `sycl/src/kernels/cuda/verify_kernels.dp.cpp` (+3 -3) 📝 `sycl/src/prefill/gemm.dp.cpp` (+229 -18) 📝 `sycl/src/program/generate.cpp` (+38 -31) ➕ `sycl/tools/build.bat` (+31 -0) ➕ `sycl/tools/onemath_config.hpp` (+6 -0) </details> ### 📄 Description ## What this is `main` now carries the SYCL port, built and measured on Linux with Level Zero, where oneMKL and command graphs both work. This is the **Windows half** — the pieces Windows needs that a Linux build never exercises, plus the expert-cache sizing fix that came out of building it. **Rebased onto `7695859a`** (the 0.1.43 release); the first version of this PR was against `a1c47bc9`. All measurements below are from the rebased tree. Single card, all measurements: **Arc Pro B70, 32 GB, Windows 11 24H2, driver 32.0.101.8976 (Arc Pro line) / 32.0.101.9034 (generic), OpenCL + eager replay, engine 0.1.43**. ## The eight commits | | | |---|---| | `223ee707` | serve: make the expert-cache VRAM headroom a knob, opt-in on CUDA and HIP | | `fe7aaa44` | probe+port: a live free-VRAM figure for the OpenCL backend | | `9f1b6a57` | Windows/OpenCL bring-up for the merged SYCL port | | `9188d551` | sycl: the serve-side VRAM check asks the same source as the cache sizing | | `99664a1d` | sycl: the per-layer sizing path asks the same source as the auto branch | | `6cdf81f5` | sycl verify: the eager path replays the commit instead of dereferencing a null graph | | `d2a7ddac` | sycl: the free-VRAM comment names the fallback that exists (comment only) | | `1baf4c95` | sycl: opt-in Level Zero on Windows, and the diagnosis behind it | ## What it changes **1. The Windows build layer** — `sycl/CMakeLists.txt`, `sycl/tools/build.bat`, `sycl/tools/onemath_config.hpp`, `sycl/serve/strata-sycl.bat`. Compiler-ID gating (`/fp:precise` and `/W3` for MSVC, `-fp-model=precise` elsewhere — the precise model is load-bearing: `quantize_act_parity` goes from byte-exact to 303k mismatches without it), `STRATA_SYCL_JIT_STATELESS` (the IGC >4 GiB surface-offset bug), the oneMKL stub for an installer-free conda install, and the DLLs beside `strata.exe`. **2. Portability fixes in the migrated copies** — the `STRATA_USE_CUDA` guard in `pinned.dp.cpp`, `OUT`→`WRITE_OUT` in `verify_kernels.dp.cpp`, Windows file I/O in `gguf_expert_source.cpp`, the `small`/`memmem` fixes in `generate.cpp`, and the plain-SYCL fallback GEMM in `gemm.dp.cpp` gated on `onemkl_usable()`. **3. The live free-VRAM figure** — on OpenCL there is no free-VRAM query at all (`ext_intel_free_memory` needs Level Zero sysman), so `get_memory_info` answers **0**, which sizes the cache to *nothing*. `own_gpu_local()` asks DXGI. Same binary, free card, 2047-token prompt: **0 slots / refused** → **12,288 slots / 23.42 GiB, prompt 81.1 tok/s, decode 66.6 tok/s**. **4. `6cdf81f5`, submitted separately as #2106** — completes `STRATA_VERIFY_EAGER` for the commit path. `main`'s eager support covers the window (`record_window`, `run()`'s guard) but not the commit; `mtp.cpp`'s `prepare_chain` documents the gap out loud. **5. `1baf4c95`, the Level Zero diagnosis** — opt-in `STRATA_SYCL_LEVEL_ZERO=1` in the launcher, off by default, plus `LEVEL_ZERO_FINDINGS.md` recording how it was established. Off by default because the serve request path stalls intermittently; when it runs it is **108.8 tok/s decode and 81.1 prefill against OpenCL's 66.6 / 81.1**, with the v1 Level Zero adapter beating v2 by +24% decode and 34x faster graph capture. ## The one thing I would most want reviewed `ur_adapter_level_zero.dll` imports `UMF.dll` and the `VCRUNTIME140*` set, and `sycl/CMakeLists.txt` stages neither beside `strata.exe`. The adapter fails to load, the UR loader reports only OpenCL, and `ONEAPI_DEVICE_SELECTOR=level_zero:0` kills the process with `0xC0000409` before `main` prints anything. **The silence is the expensive part**: every Level Zero adapter failure looks like "there is no Level Zero here", which is what sent me down the OpenCL path in the first place and cost days. The workaround in this PR is `Library\bin` first on `PATH`; the proper fix is to extend the copy list. Second, and related: the **v1 Level Zero adapter beats v2** decisively on this card (+24% decode, graph capture 276 ms vs 9,495 ms). #1940 pins v2 on for graph replay (intel/llvm#23073); on a B70 with this workload that trade is the wrong one. ## What this leaves alone Every new feature is opt-in and the default path is byte-identical unless a variable is set: `STRATA_EXPERT_CACHE_HEADROOM` defaults to 0 everywhere, `STRATA_SYCL_LEVEL_ZERO` is unset by default, and `STRATA_VERIFY_EAGER` is only read where it already was. Every launcher variable is only written when not already defined, so an explicit `ONEAPI_DEVICE_SELECTOR` for a two-card split still wins. No engine source changed in `1baf4c95`. ## What I could not verify — please read before reviewing - **Built and run on SYCL/Windows only.** I have no CUDA, HIP or Linux toolchain on this machine. Files here are shared across backends and I could not build them. - **A clean checkout of the SYCL port does not compile on Windows** without commit `9f1b6a57` (`pinned.dp.cpp`'s unguarded CUDA calls, the `OUT` macro in `verify_kernels.dp.cpp`). So it cannot be built standalone here. - **oneMKL still refuses** — *"does not support this API"* — against both the PyPI runtime and the standalone oneAPI 2026.0 runtime, with identical timings. The engine's expert GEMMs are BF16 (`gemm.dp.cpp:1031`), the likely unsupported type; that is a hypothesis, not a measurement. So the prompt path is on the plain-SYCL fallback and the prefill figures are not oneMKL-backed. - **The Level Zero path is not reliable as a default.** The stall message, what it is not, and where to instrument next are in `LEVEL_ZERO_FINDINGS.md`. ## Suggested review order 1. `gemm.dp.cpp` — the plain-SYCL fallback is what makes prompts run at all here, and it is the biggest piece. 2. `verify.cpp` — the `capture_commit` eager guard (#2106 is the same change standalone). 3. `expert_cache.cpp` — the DXGI figure, since it changes sizing behaviour on every SYCL backend. 4. `CMakeLists.txt` — the copy list above, and the compiler-ID gating. I would rather split this: `223ee707` + `d2a7ddac` are one coherent knob, `6cdf81f5` is #2106, and `1baf4c95` is really a bug report about the copy list with an opt-in switch attached. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:30:25 +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#3741
No description provided.