[PR #667] [CLOSED] Add Intel XPU backend: Qwen decode on Arc Pro B60 via SYCL #2755

Closed
opened 2026-11-04 02:02:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/667
Author: @the-talos
Created: 10/3/2026
Status: ❌ Closed

Base: main ← Head: intel-xpu-backend


📝 Commits (2)

  • ca2e216 Add Intel XPU backend (SYCL) for Qwen decode on Arc Pro B60
  • ef5ce92 xpu: replay graphs natively and add STRATA_XPU_PROFILE

📊 Changes

14 files changed (+2023 additions, -5 deletions)

View changed files

📝 CMakeLists.txt (+18 -3)
➕ cmake/xpu_backend.cmake (+69 -0)
➕ docs/INTEL_XPU.md (+55 -0)
➕ include/strata/xpu_compat/cublas_v2.h (+74 -0)
➕ include/strata/xpu_compat/cuda_fp16.h (+70 -0)
➕ include/strata/xpu_compat/cuda_runtime.h (+1016 -0)
➕ include/strata/xpu_compat/cuda_runtime_api.h (+2 -0)
➕ include/strata/xpu_compat/intrinsics.hpp (+220 -0)
📝 src/core/device.cu (+6 -0)
📝 src/core/native_dense.cpp (+3 -1)
📝 src/core/weights.cpp (+7 -1)
📝 src/kernels/cuda/native_mmvq.cu (+4 -0)
📝 src/kernels/cuda/s2_gemv_fast.cu (+14 -0)
➕ tools/xpu/rewrite_cuda.py (+465 -0)

📄 Description

What this adds

A third backend next to CUDA and HIP, enabled with STRATA_ENABLE_XPU=ON (icpx/icx, oneAPI 2025.3). The CUDA kernels are reused unchanged: tools/xpu/rewrite_cuda.py rewrites launch syntax and declarations to SYCL at build time, and include/strata/xpu_compat/ implements the CUDA runtime API the engine leans on (graphs, streams, events, mapped memory, cublas via oneMKL) on SYCL/Level Zero. docs/INTEL_XPU.md documents the design and the build.

Numbers

Qwen3.8-Flash-Next GSQ-RCO Q2_0 on one Intel Arc Pro B60 (23.3 GB), expert cache auto (14,570 slots, 18.8 GiB), context 1024, --spec 2 --kv int8:

  • prefill 127 tokens at 73.9 tok/s, time to first token 2.1 s
  • greedy decode through the speculative verify window at 9.4 tok/s (64 tokens), exit 0
  • in-run gates pass: cache slot verified bit for bit, every layer doorbell rings

Porting notes worth reviewing

  • Graph execs deep-copy the captured op list; the engine destroys the capture right after instantiate, as CUDA allows.
  • cudaStreamQuery is an honest non-blocking idle check on the in-order queue; the verify loop polls it while spinning on doorbells.
  • Async copies from unpinned host pages (the mmap-ed GGUF shards) stage through a malloc_host bounce with an in-order host_task fill; Level Zero faults on raw pages and strands every later op on the stream.
  • The doorbell spin kernels poll host-mapped flags. Pure volatile read loops over host USM do not see CPU stores on this stack, so __nanosleep (called by every strata_spin_pause() site each iteration) issues a sycl::atomic_fence(seq_cst, system). Without it the verify window times out at the first flag wait, every run.
  • Performance is scalar so far: __dp4a and shuffles are correct subgroup implementations, XMX paths are future work.

I have run the greedy smoke test and the measurement above on the B60 container only; the CUDA and HIP builds are untouched (the new code compiles in only under STRATA_ENABLE_XPU).


🔄 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/667 **Author:** [@the-talos](https://github.com/the-talos) **Created:** 10/3/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `intel-xpu-backend` --- ### 📝 Commits (2) - [`ca2e216`](https://github.com/Niko1221/Strata/commit/ca2e21691d954c08bb58a148ff041130d4c55c46) Add Intel XPU backend (SYCL) for Qwen decode on Arc Pro B60 - [`ef5ce92`](https://github.com/Niko1221/Strata/commit/ef5ce9210957268a26f28d19b3331b9a9d38a799) xpu: replay graphs natively and add STRATA_XPU_PROFILE ### 📊 Changes **14 files changed** (+2023 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+18 -3) ➕ `cmake/xpu_backend.cmake` (+69 -0) ➕ `docs/INTEL_XPU.md` (+55 -0) ➕ `include/strata/xpu_compat/cublas_v2.h` (+74 -0) ➕ `include/strata/xpu_compat/cuda_fp16.h` (+70 -0) ➕ `include/strata/xpu_compat/cuda_runtime.h` (+1016 -0) ➕ `include/strata/xpu_compat/cuda_runtime_api.h` (+2 -0) ➕ `include/strata/xpu_compat/intrinsics.hpp` (+220 -0) 📝 `src/core/device.cu` (+6 -0) 📝 `src/core/native_dense.cpp` (+3 -1) 📝 `src/core/weights.cpp` (+7 -1) 📝 `src/kernels/cuda/native_mmvq.cu` (+4 -0) 📝 `src/kernels/cuda/s2_gemv_fast.cu` (+14 -0) ➕ `tools/xpu/rewrite_cuda.py` (+465 -0) </details> ### 📄 Description ## What this adds A third backend next to CUDA and HIP, enabled with `STRATA_ENABLE_XPU=ON` (icpx/icx, oneAPI 2025.3). The CUDA kernels are reused unchanged: `tools/xpu/rewrite_cuda.py` rewrites launch syntax and declarations to SYCL at build time, and `include/strata/xpu_compat/` implements the CUDA runtime API the engine leans on (graphs, streams, events, mapped memory, cublas via oneMKL) on SYCL/Level Zero. `docs/INTEL_XPU.md` documents the design and the build. ## Numbers Qwen3.8-Flash-Next GSQ-RCO Q2_0 on one Intel Arc Pro B60 (23.3 GB), expert cache auto (14,570 slots, 18.8 GiB), context 1024, `--spec 2 --kv int8`: - prefill 127 tokens at 73.9 tok/s, time to first token 2.1 s - greedy decode through the speculative verify window at 9.4 tok/s (64 tokens), exit 0 - in-run gates pass: cache slot verified bit for bit, every layer doorbell rings ## Porting notes worth reviewing - Graph execs deep-copy the captured op list; the engine destroys the capture right after instantiate, as CUDA allows. - `cudaStreamQuery` is an honest non-blocking idle check on the in-order queue; the verify loop polls it while spinning on doorbells. - Async copies from unpinned host pages (the mmap-ed GGUF shards) stage through a `malloc_host` bounce with an in-order `host_task` fill; Level Zero faults on raw pages and strands every later op on the stream. - The doorbell spin kernels poll host-mapped flags. Pure volatile read loops over host USM do not see CPU stores on this stack, so `__nanosleep` (called by every `strata_spin_pause()` site each iteration) issues a `sycl::atomic_fence(seq_cst, system)`. Without it the verify window times out at the first flag wait, every run. - Performance is scalar so far: `__dp4a` and shuffles are correct subgroup implementations, XMX paths are future work. I have run the greedy smoke test and the measurement above on the B60 container only; the CUDA and HIP builds are untouched (the new code compiles in only under `STRATA_ENABLE_XPU`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:02:53 +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#2755
No description provided.