[PR #1602] [CLOSED] sycl: make the Intel Arc A-series (Alchemist) work — prompt handshake, mirror, and the >4 GiB kernel-address bug #3558

Closed
opened 2026-11-07 14:42:19 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1602
Author: @duncanmcqueen
Created: 10/8/2026
Status: ❌ Closed

Base: main ← Head: intel-sycl-handshake


📝 Commits (8)

  • 8f69d94 sycl: publish the doorbell with the uncached write hint
  • 33064c3 sycl: chunk the expert mirror and raise memlock in the wrapper
  • 039992e sycl: keep Alchemist's prompt path on its own buffers
  • c756d4b sycl: add the doorbell payload checksum
  • aa71188 sycl: stage oneMKL GEMM operands that lie more than 4 GiB into their allocation
  • b40f69f sycl: build Alchemist kernels for allocations past 4 GiB
  • ebe06f9 sycl: setup picks the Intel card by PCI id and configures Alchemist
  • 712bbc9 sycl: fix the GEMM staging scratch lifetime and unregister freed allocations

📊 Changes

17 files changed (+523 additions, -160 deletions)

View changed files

📝 docs/INTEL.md (+9 -0)
📝 include/strata/kernels/elementwise.hpp (+15 -0)
📝 sycl/CMakeLists.txt (+8 -1)
📝 sycl/include/strata/core/gguf_expert_source.hpp (+7 -4)
📝 sycl/include/strata/sycl_doorbell.hpp (+30 -0)
📝 sycl/include/strata/sycl_queue.hpp (+45 -1)
➕ sycl/probe/doorbell_store.cpp (+43 -0)
📝 sycl/serve/strata-sycl.sh (+1 -0)
📝 sycl/setup_intel.py (+51 -16)
📝 sycl/src/core/expert_cache.cpp (+6 -0)
📝 sycl/src/core/gguf_expert_source.cpp (+72 -38)
📝 sycl/src/core/layer.cpp (+2 -2)
📝 sycl/src/core/session.cpp (+8 -0)
📝 sycl/src/core/verify.cpp (+16 -0)
📝 sycl/src/kernels/cuda/elementwise.dp.cpp (+123 -96)
📝 sycl/src/prefill/gemm.dp.cpp (+58 -0)
📝 sycl/src/program/generate.cpp (+29 -2)

📄 Description

Title

sycl: make the Intel Arc A-series (Alchemist) work — prompt handshake, mirror, and the >4 GiB kernel-address bug

Issue: Resolves # (none)

Summary

The SYCL base engine on an Intel Arc A770 answered short prompts but produced garbage ("!!!!!!!!!!!!!!!!")
for prompts longer than a few dozen tokens. This series fixes the A-series path end to end: the doorbell the host
polls, the expert mirror on Alchemist, the prompt path's own buffers, and — the actual cause of the garbage — a JIT
kernel-address bug where IGC turned a kernel's pointer arguments into 32-bit offsets from the allocation's base, so
kernels misread any bytes more than 4 GiB into an allocation while a memcpy of the same bytes was right.

Measured on an Arc A770 (16 GB, xe, PCI 56a0), Qwen3.8-Flash-Next Coder IQ1_M, --stream-experts with a 4.46 GiB
VRAM expert cache: before, a 542-token prompt generated 16 tokens of ! (every prompt answered token 0); after,
prompts of 73-542 tokens have 0 non-finite values (STRATA_DBG_NAN=1) and the 542-token prompt answers right
(17 + 24 = 41). Short prompts were correct throughout.

What changed

Commits (oldest first):

  • 8f69d94 sycl: publish the doorbell with the uncached write hint — a plain atomic store to host USM reaches the
    host only when the kernel ends on xe; the doorbell now stores through write_hint<cache_mode::uncached> so the
    host sees the sequence number mid-kernel (probe: 230 ms vs 2038 ms). Adds sycl/probe/doorbell_store.cpp.
  • 33064c3 sycl: chunk the expert mirror and raise memlock in the wrapper — Alchemist refuses a single
    sycl::malloc_host past ~3 GiB; the mirror is built in chunks so a 17.6 GiB mirror loads on the A770.
  • 039992e sycl: keep Alchemist's prompt path on its own buffers — the prompt path no longer carves its buffers
    from borrowed expert-cache slots on A-series; this removes a prefill crash (routed id out of range, exit 139).
  • c756d4b sycl: add the doorbell payload checksum — the publish kernels write a ring tag and a checksum of the
    payload next to the sequence word; the host waits for the whole payload before the CPU pool reads it. Robustness
    for the CPU-expert mode (not the A770 cure).
  • aa71188 sycl: stage oneMKL GEMM operands that lie more than 4 GiB into their allocation — oneMKL's own
    precompiled GEMM reads the last partial tile of an operand wrongly past 4 GiB (its kernels do not get the build
    option below). A small allocation registry (device_offset_end) plus staging in Gemm::bf16/f16;
    STRATA_SYCL_GEMM_NO_STAGE=1 is the negative control.
  • b40f69f sycl: build Alchemist kernels for allocations past 4 GiB — the fix. The JIT (non-AOT) build now
    passes -ze-opt-greater-than-4GB-buffer-required to the spir64 backend (in the same argument as the
    divide/sqrt option; CMake drops a repeated -Xsycl-target-backend=spir64). AOT build unchanged.
  • ebe06f9 sycl: setup picks the Intel card by PCI id and configures Alchemist — setup_intel.py carries the
    PCI device id through so an A-series on xe is told from a Battlemage; every Alchemist id gets the driver's FP64
    emulation. On i915 the experts still load into a CPU-computed RAM arena; on xe the A-series takes the ordinary
    streamed path (mirror chunked + the build option above).

Files: sycl/CMakeLists.txt, sycl/include/strata/sycl_doorbell.hpp, sycl/include/strata/sycl_queue.hpp,
sycl/src/core/{expert_cache,layer,session,verify}.cpp, sycl/src/prefill/gemm.dp.cpp,
sycl/src/kernels/cuda/elementwise.dp.cpp, sycl/src/program/generate.cpp, include/strata/kernels/elementwise.hpp,
sycl/setup_intel.py, docs/INTEL.md.

Extra Notes

  • The oneMKL staging (aa71188) did not fix the A770 garbage by itself: instrumentation showed no operand ever
    lies >4 GiB into its allocation in the reproducing config. It is kept as a defensive fix for the case the build
    option cannot cover (oneMKL's precompiled kernels), matching what the CUDA/HIP shims do. The b40f69f build option
    is the actual cure.
  • The change is A-series-specific in effect but safe for other Intel cards: the backend option keeps kernels on
    64-bit addresses, and the doorbell/mirror/setup changes are gated by driver or device id.
  • tools/test_setup_sycl.py passes (14 tests). Speed cost of the build option is not measured.
  • Build: docker run ... strata-sycl-dev "bash sycl/tools/build.sh strata" (JIT). No AOT change.

🔄 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/1602 **Author:** [@duncanmcqueen](https://github.com/duncanmcqueen) **Created:** 10/8/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `intel-sycl-handshake` --- ### 📝 Commits (8) - [`8f69d94`](https://github.com/Niko1221/Strata/commit/8f69d94b74310aab13d3e9444e5f47e3d56c3068) sycl: publish the doorbell with the uncached write hint - [`33064c3`](https://github.com/Niko1221/Strata/commit/33064c3500e659c4667d7afc9109320689ef6223) sycl: chunk the expert mirror and raise memlock in the wrapper - [`039992e`](https://github.com/Niko1221/Strata/commit/039992e4f997a8accd74da382abe84e48db8071c) sycl: keep Alchemist's prompt path on its own buffers - [`c756d4b`](https://github.com/Niko1221/Strata/commit/c756d4bf2bddf3b085e29410e95d4dce23f5706d) sycl: add the doorbell payload checksum - [`aa71188`](https://github.com/Niko1221/Strata/commit/aa71188b5b90a60edf3e90e5c15490fa075ee83a) sycl: stage oneMKL GEMM operands that lie more than 4 GiB into their allocation - [`b40f69f`](https://github.com/Niko1221/Strata/commit/b40f69f642418336adb75f425822ff82b716b0c5) sycl: build Alchemist kernels for allocations past 4 GiB - [`ebe06f9`](https://github.com/Niko1221/Strata/commit/ebe06f9fffeac9942897a7610647567ef37c5c5a) sycl: setup picks the Intel card by PCI id and configures Alchemist - [`712bbc9`](https://github.com/Niko1221/Strata/commit/712bbc9701a663b9528559bb3e15020d10741001) sycl: fix the GEMM staging scratch lifetime and unregister freed allocations ### 📊 Changes **17 files changed** (+523 additions, -160 deletions) <details> <summary>View changed files</summary> 📝 `docs/INTEL.md` (+9 -0) 📝 `include/strata/kernels/elementwise.hpp` (+15 -0) 📝 `sycl/CMakeLists.txt` (+8 -1) 📝 `sycl/include/strata/core/gguf_expert_source.hpp` (+7 -4) 📝 `sycl/include/strata/sycl_doorbell.hpp` (+30 -0) 📝 `sycl/include/strata/sycl_queue.hpp` (+45 -1) ➕ `sycl/probe/doorbell_store.cpp` (+43 -0) 📝 `sycl/serve/strata-sycl.sh` (+1 -0) 📝 `sycl/setup_intel.py` (+51 -16) 📝 `sycl/src/core/expert_cache.cpp` (+6 -0) 📝 `sycl/src/core/gguf_expert_source.cpp` (+72 -38) 📝 `sycl/src/core/layer.cpp` (+2 -2) 📝 `sycl/src/core/session.cpp` (+8 -0) 📝 `sycl/src/core/verify.cpp` (+16 -0) 📝 `sycl/src/kernels/cuda/elementwise.dp.cpp` (+123 -96) 📝 `sycl/src/prefill/gemm.dp.cpp` (+58 -0) 📝 `sycl/src/program/generate.cpp` (+29 -2) </details> ### 📄 Description ## Title sycl: make the Intel Arc A-series (Alchemist) work — prompt handshake, mirror, and the >4 GiB kernel-address bug Issue: Resolves # (none) ## Summary The SYCL base engine on an **Intel Arc A770** answered short prompts but produced garbage (`"!!!!!!!!!!!!!!!!"`) for prompts longer than a few dozen tokens. This series fixes the A-series path end to end: the doorbell the host polls, the expert mirror on Alchemist, the prompt path's own buffers, and — the actual cause of the garbage — a JIT kernel-address bug where IGC turned a kernel's pointer arguments into 32-bit offsets from the allocation's base, so kernels misread any bytes more than 4 GiB into an allocation while a memcpy of the same bytes was right. Measured on an Arc A770 (16 GB, `xe`, PCI `56a0`), Qwen3.8-Flash-Next Coder IQ1_M, `--stream-experts` with a 4.46 GiB VRAM expert cache: before, a 542-token prompt generated 16 tokens of `!` (every prompt answered token 0); after, prompts of 73-542 tokens have 0 non-finite values (`STRATA_DBG_NAN=1`) and the 542-token prompt answers right (`17 + 24 = 41`). Short prompts were correct throughout. ## What changed Commits (oldest first): - **`8f69d94` sycl: publish the doorbell with the uncached write hint** — a plain atomic store to host USM reaches the host only when the kernel ends on `xe`; the doorbell now stores through `write_hint<cache_mode::uncached>` so the host sees the sequence number mid-kernel (probe: 230 ms vs 2038 ms). Adds `sycl/probe/doorbell_store.cpp`. - **`33064c3` sycl: chunk the expert mirror and raise memlock in the wrapper** — Alchemist refuses a single `sycl::malloc_host` past ~3 GiB; the mirror is built in chunks so a 17.6 GiB mirror loads on the A770. - **`039992e` sycl: keep Alchemist's prompt path on its own buffers** — the prompt path no longer carves its buffers from borrowed expert-cache slots on A-series; this removes a prefill crash (`routed id out of range`, exit 139). - **`c756d4b` sycl: add the doorbell payload checksum** — the publish kernels write a ring tag and a checksum of the payload next to the sequence word; the host waits for the whole payload before the CPU pool reads it. Robustness for the CPU-expert mode (not the A770 cure). - **`aa71188` sycl: stage oneMKL GEMM operands that lie more than 4 GiB into their allocation** — oneMKL's own precompiled GEMM reads the last partial tile of an operand wrongly past 4 GiB (its kernels do not get the build option below). A small allocation registry (`device_offset_end`) plus staging in `Gemm::bf16`/`f16`; `STRATA_SYCL_GEMM_NO_STAGE=1` is the negative control. - **`b40f69f` sycl: build Alchemist kernels for allocations past 4 GiB** — **the fix.** The JIT (non-AOT) build now passes `-ze-opt-greater-than-4GB-buffer-required` to the `spir64` backend (in the same argument as the divide/sqrt option; CMake drops a repeated `-Xsycl-target-backend=spir64`). AOT build unchanged. - **`ebe06f9` sycl: setup picks the Intel card by PCI id and configures Alchemist** — `setup_intel.py` carries the PCI device id through so an A-series on `xe` is told from a Battlemage; every Alchemist id gets the driver's FP64 emulation. On `i915` the experts still load into a CPU-computed RAM arena; on `xe` the A-series takes the ordinary streamed path (mirror chunked + the build option above). Files: `sycl/CMakeLists.txt`, `sycl/include/strata/sycl_doorbell.hpp`, `sycl/include/strata/sycl_queue.hpp`, `sycl/src/core/{expert_cache,layer,session,verify}.cpp`, `sycl/src/prefill/gemm.dp.cpp`, `sycl/src/kernels/cuda/elementwise.dp.cpp`, `sycl/src/program/generate.cpp`, `include/strata/kernels/elementwise.hpp`, `sycl/setup_intel.py`, `docs/INTEL.md`. ## Extra Notes - The oneMKL staging (`aa71188`) did **not** fix the A770 garbage by itself: instrumentation showed no operand ever lies >4 GiB into its allocation in the reproducing config. It is kept as a defensive fix for the case the build option cannot cover (oneMKL's precompiled kernels), matching what the CUDA/HIP shims do. The `b40f69f` build option is the actual cure. - The change is A-series-specific in effect but safe for other Intel cards: the backend option keeps kernels on 64-bit addresses, and the doorbell/mirror/setup changes are gated by driver or device id. - `tools/test_setup_sycl.py` passes (14 tests). Speed cost of the build option is not measured. - Build: `docker run ... strata-sycl-dev "bash sycl/tools/build.sh strata"` (JIT). No AOT change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 14:42:19 +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#3558
No description provided.