diff --git a/README.md b/README.md index a5414f83..9b826c3f 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,72 @@ AVX-512/AVX2 kernels (`libavx`) serve every model here: the small ones (Embeddin Qwen3-ASR, the 0.8B-3B models) at interactive speed on a desktop CPU, the 27B and larger far more slowly than a card. +This fork adds a native **Intel GPU backend** (SYCL / Level Zero, kernel library `libxe2`) for the +Arc Pro B65 (Battlemage, Xe2), next to the unchanged AMD and CPU paths. Its state and to-dos are in +[Intel GPU backend](#intel-gpu-backend-sycl) below. + To support the development of radiance: [Patreon](https://patreon.com/StillDeadCode). +## Intel GPU backend (SYCL) + +Target: Arc Pro B65 (`intel_gpu_bmg_g31`, 32 GB), oneAPI 2026.2. Main test model: +`Qwen3.8-27B-DFLASH2-PARO-M2XFP4` (m2xfp4 weights, gated DeltaNet + full attention, DFlash2 +drafter). Reference point: vLLM-SYCL on the same class of model, ~90 tok/s decode and ~1200 tok/s +prefill. The full log, measurements and decisions are in +[`docs/SYCL_PROGRESS.md`](docs/SYCL_PROGRESS.md); the design is in +[`docs/SYCL_PORTING.md`](docs/SYCL_PORTING.md). + +**Current numbers** (Qwen3.8-27B M2XFP4, one sequence, BetterBench quick runs): + +| | decode tok/s | prefill tok/s (~2000 tokens) | +|---|---|---| +| first bring-up | 0.1 | 68 | +| now (`8af007c`) | 35-37 | 341-349 | +| vLLM-SYCL reference | ~90 | ~1200 | + +MiniCPM5-2B bf16: decode 51.8 tok/s, prefill 1576 tok/s. + +**Done** +- A SYCL device backend in the engine and the `libxe2` kernel library: every op MiniCPM5-2B and + Qwen3.8-27B M2XFP4 need, each with an exact form that matches libref bit for bit + (`XE2_EXACT=1` selects them all). +- Fast kernels checked against libref with `rad-kbench` (1410/1410 fixture cases) and on live + operands with the engine's op oracle; end to end held to a KL bound against the exact kernels. +- Decode: m2xfp4 GEMV, 8-row verify GEMMs, the logits and 2-bit draft heads, the Givens rotation + and split-KV attention on the matrix engine through register DPAS; exact DeltaNet recurrence, + norms and drafter selection ops. +- Speculative decoding with the DFlash2 drafter (~4 tokens accepted a round). +- Prefill: GEMMs on oneMKL (85-91 TFLOPS), exact chunk-parallel DeltaNet scan and kkt solve. +- BetterBench runs with reports posted to Discord (`scripts/sycl/bench_report.sh`), a decode + profiler (`scripts/sycl/profile_decode.sh`). + +**To do** +- [ ] Decode: the 8-row m2xfp4 verify GEMMs (~60 ms of a ~112 ms speculative round, ~2.5x their + bandwidth floor). +- [ ] Decode: the DeltaNet update, the norms' ordered-sum floor, the draft head's group terms. +- [ ] Prefill: attention on the matrix engine with the keys shared across query heads (now ~1.0 s + of a 1900-token prefill), or oneDNN's SDPA. +- [ ] Prefill: a matrix-engine form of the DeltaNet chunk scan (0.9 s), the m2xfp4 decode to fp16 + ahead of the GEMM, kkt, gated_quant. +- [ ] A KL check of the speculative (8-row) path, which the KL tool's 64-token chunks do not reach. +- [ ] Batched serving (several sequences) on the fast paths; most fast paths assume one sequence. +- [ ] Phase 5: README/Docker image for the Intel build, more model families. + +**Build and run** + +```sh +. /opt/intel/oneapi/setvars.sh # icpx, Level Zero, oneMKL; also needed at run time +cmake -S . -B build-sycl -G Ninja -DRAD_SYCL=ON # RAD_SYCL_TARGETS defaults to intel_gpu_bmg_g31 +cmake --build build-sycl -j16 +RADIANCE_HOME=$PWD/build-sycl/radiance_home build-sycl/bin/radiance \ + --model /models/qwen3.8-27b-dflash2-paro-m2xfp4/Qwen3.8-27B-DFLASH2-PARO-M2XFP4.rad \ + --max-model-len 8192 --max-num-seqs 1 --embedding-placement vram +``` + +On a card behind a narrow PCIe link (the B65 here runs at x1), `--embedding-placement vram` keeps the +token embedding on the card instead of reading it over the link. oneMKL is linked when CMake finds +it (`-DRAD_XE2_MKL=OFF`, or `XE2_NO_MKL=1` at run time, keeps the hand-written prefill GEMMs). + ## Models | model | container | get it | compose file | @@ -318,6 +382,7 @@ ctest --test-dir build -L oot # rebuilds every bundled plugin out o | [`docs/ARCHITECTURES.md`](docs/ARCHITECTURES.md) | the supported model families and their geometry | | [`docs/TP3.md`](docs/TP3.md) | any world size: the attention world and uneven delta-net heads; three ranks | | [`docs/OPS.md`](docs/OPS.md), [`docs/KERNELS.md`](docs/KERNELS.md) | the op vocabulary, and what `rad-kbench` last measured | +| [`docs/SYCL_PROGRESS.md`](docs/SYCL_PROGRESS.md), [`docs/SYCL_PORTING.md`](docs/SYCL_PORTING.md) | the Intel GPU (SYCL) backend: progress log and design | | [`spec.md`](spec.md) | the design | ## License