Repository navigation
[SYCL] fast ggml_sycl_comm_exchange() - +19% prompt eval -sm tensor t/s on Intel Arc Pro B70s - #30956
[SYCL] fast ggml_sycl_comm_exchange() - +19% prompt eval -sm tensor t/s on Intel Arc Pro B70s #3095692es wants to merge 4 commits into
Conversation
Increases -sm tensor prompt eval t/s by +19% with zero PPL change.
Replace first pair of wait() calls with ext_oneapi_submit_barrier(). The wait() calls was discovered to cause MTP degradation.
|
I did not find a comment section on your B70/MTP page so I am posting it here. You had some good open questions to resolve. I am making a hands-off scripted llama-cli script to regression test MTP. Here is the initial A/B run of a fixed 3,254 token prompt (C++ source code) that runs and exists without manual intervention to eliminate manual run-2-run variations. My initial manual llama-cli MTP tests used much shorter prompts. Preliminary results look promising: Performance Comparison: Stock vs. PatchedA/B (hands off) scripted llama-cli Qwen3.6-27B-Q4_0-MTP.gguf on SYCL0, SYCL1 Both runs processed a 3,265 token prompt and 256 generation tokens.
MTP
Notes~10% improvement in prompt evaluation speed (Time-to-First-Token) |
|
"... If you test the barrier approach where it does run, please check correctness with perplexity at ub 4 and ub 512 plus a long greedy decode against a stock build (a write-after-read race on reused staging buffers would show up there, not in a short MTP run), and post your OS, driver, and whether q0->get_context() == q1→get_context(). ..." Requested Information:The barrier patch runs with no crashes. OS: Debian Trixie Backports, Kernel 7.2.9 q0 and q1 get_context() are ALWAYS the same. 6145 tokens for all 4 runs with 60 second cool downs between runs. Note: There are run-2-run +/- variance on both stock and patched binaries. -dev SYCL0,SYCL1 -f ggml-sycl.cpp -sm tensor -ts 1,1 -ub 4 -dev SYCL0,SYCL1 -f ggml-sycl.cpp -sm tensor -ts 1,1 -ub 512 |
|
I added "-seed 1234" to try and stabilize the +/- PPL variance in both the STOCK and PATCH runs, but the run-2-run variance still remains in both. This run, the PATCH barrier's PPL is better than the STOCK with both -ub 4 and 512 where last night was better with just 512. I think we are chasing random run-2-run noise levels ( and random seed mixes ? ). Multiple interleaved hands off -seed 1234 -ub 4 runs:-dev SYCL0,SYCL1 -f ggml-sycl.cpp -sm tensor -ts 1,1 -seed 1234 -ub 4 PPL 2.5203 +/- 0.09064 - Stock PPL 2.5196 +/- 0.09056 - Patch barrier Tokens per second Stock 75.16 t/s vs Patch 72.24 t/s -dev SYCL0,SYCL1 -f ggml-sycl.cpp -sm tensor -ts 1,1 -seed 1234 -ub 512 PPL 2.5218 +/- 0.09077 - Stock As for your Windows crash, make sure code is q0:d2h_1 and q1:d2h_0. |
|
Hi @92es - Here is what we tested out: Here's what we found: Why it fails here: What this likely means for this PR: What would fix it: |
Adding comm_exchange function pointer to switch between 2 and 4 buffer ggml_sycl_comm_exchange versions @ initialization time (versus hot path) controlled by SYCL_ENABLE_DEFAULT_CONTEXTS=1 setting.
adding back 2nd half of 4-buffer free.
Patch Update:Updated the patch to react to SYCL_ENABLE_DEFAULT_CONTEXTS settings to switch between the original 4-buffer-wait version (separate SYCL contexts) and the new 2-buffer-barrier version (same SYCL context) using a function pointer to remove the runtime check out of the hot path as per @Captain-Tripps lead. kl-divergenceAlso ran llama-perplexity's --kl-divergence-base --kl-divergence to verify PPL and KLD consistency. -ub 4 was identical and -ub 512 oscillated back and forth in noise levels between baseline code and patch barrier (again, as per @Captain-Tripps lead). |
Increases -sm tensor prompt eval t/s by +19% t/s ( making -sm tensor as fast as -sm layer ) with zero PPL change
Overview
Additional information
NOTE: PPL is inherently higher in tensor split mode than layer split in the base code, thus PPL has to be A/B compared with tensor/tensor or layer/layer, NOT tensor/layer. The same delta appears in both the mainline build and the patch build.
NOTE: This a complementary patch with sycl: add set_tensor_2d for faster tensor-split loading #30358 authored by @Captain-Tripps . This patch picks up tensor split mode optimizations where his hands off (load => runtime). They do NOT depend on each other, but complement each other.
NOTE: Related PR SYCL: reduce tensor allreduce sync with pinned host buffers #29604
UPDATE: First pair of waits replaced with barriers to restore MTP and remove host.
Requirements
Collab: google.ai and Qwen3.8-27B-UD-Q8_K_4XL
Code gen: Qwen3.8-27B-UD-Q8_K_4XL
Test environment
GPUs: Dual B70s, one B70 in Gen5 x16 PCIe slot and one in Gen4 x4 PCIe slot.
OS: Debian Trixie Backports, Kernel 7.9.2
Toolkit: oneAPI 2026.1.1
Test command
llama-perplexity -m ${LLM_NAME}.gguf -dev SYCL0,SYCL1 -f ggml-sycl.cpp -sm [tensor|layer] -ts 1,1 -ngl 99 --load-mode dio --chunks 12 -n 64 -b 1024 -ub 1024 -c 512 -v
Retested with single shot llama-cli to validate MTP consistency using --spec-draft-n-max 4, 5 and 6
Out of tree unit test showed Gen5x16 to Gen4x4 pathway increased from 5.3 GB/s ( mainline code ) to 7.1 GB/s ( +34% patch code ), almost maxing out the theoretical limit of 7.5.GB/s.
Test matrix
Tensor mode — patch gain over mainline
Consistent tensor-mode gain of +16.7% … +20.6% (mean ≈ +19.0%) across every model and
quantization tested.
llama-perplexity PPL ( no change layer vs layer and tensor vs tensor )
Layer mode: stock vs patched PPL (no change)
Tensor mode: stock vs patched PPL (no change)
UPDATE:
Thanks to @Captain-Tripps eval, he discovered there was a MTP degradation with the original patch that used wait().
Switching the first pair of wait() to ext_oneapi_submit_barrier() restored MTP consistency between mainline and patch.
ext_oneapi_submit_barrier() retained the patch's speed improvements and PPL equivalencies as previously documented, confirmed by an entire rerun of the regression test suite tabled above.
Mainline vs Patch wait vs Patch barrier