Squeezing Every Token/s from the Intel Arc Pro B70 #27593
JohnTDI-cpu
started this conversation in
General
Replies: 1 comment
|
@JohnTDI-cpu I supply some info:
Here is our suggestion: We keep fp32 as default build argument to keep compatible for CI/test script.
Thank you! |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Testing llama.cpp settings on an Intel Arc Pro B70
A log of configuration variants tried on one B70, using stock llama.cpp at
master
63b64a50a— no patches or forks, only build flags, command line flagsand environment variables.
Much of the ground here is already covered by others; links are in the last
section. This adds a dense 27B Q8_0 model with built-in multi-token prediction,
plus a few variants that did not seem to have numbers published yet.
What mattered most, in order:
-DGGML_SYCL_F16=ON--spec-type draft-mtp-ub 2048-ctk q4_0 -ctv q4_0-fa 1GGML_SYCL_ENABLE_OPT=0What the numbers mean
If you have not benchmarked llama.cpp before:
pp) is reading your prompt.pp2048means a 2048-token prompt. This is what you wait for before the first word
appears.
tg) is writing the answer, one token at atime.
tg128means 128 generated tokens. This is the speed you watch while ittypes.
a setting can help one and do nothing for the other.
check them in one pass. Draft acceptance is the fraction of those guesses
that turn out right; the higher it is, the more time the trick saves.
Setup
BMG G31xe, kernel 7.0.0-28-generic, Level Zero 1.15.39122qwen35nextn_predict_layers = 1: MTP is part of the model, Q8 like the rest of it-ngl 99 -b 4096 -ub 2048 -fa 1, 2–3 repetitions, stddev under 0.5%Build flags
-DGGML_SYCL_F16=OFF(CMake default)-DGGML_SYCL_F16=ON3.72x on prefill from one flag that defaults to OFF, with generation
untouched — which is why it is easy to miss if you only watch decode. The
official Intel container sets it; source builds do not.
cmake -B build -DGGML_SYCL=ON -DGGML_SYCL_TARGET=INTEL \ -DGGML_SYCL_F16=ON -DGGML_SYCL_DEVICE_ARCH=bmg_g21 \ -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx-DGGML_SYCL_DEVICE_ARCH=bmg_g21compiles ahead of time and removes the JITstall on first inference. The card reports itself as
BMG G31;g21still works.Speculative decoding (MTP)
The model carries its multi-token-prediction layer in the file, so
--spec-type draft-mtpneeds no extra download and no separate draft model.Throughput is governed by draft acceptance, and acceptance depends on how
predictable the answer is. Both columns are natural generation, greedy,
-c 4096:--spec-draft-n-max-c 4096Short answers reach 50.9 t/s, 3.2x over plain generation. Long ones peak at
33.5, 2.1x — and they peak at a different draft length.
The optimum is not one value. A short reply keeps improving to
n-max 6,because acceptance stays high enough that the extra drafted tokens pay for
themselves. A long technical passage gets steadily harder to guess — acceptance
falls from 0.87 to 0.40 across the sweep — and peaks at
n-max 3.Serving chat, use 6. Generating long documents, 3 is enough.
--spec-draft-device,--spec-draft-ngland--backend-samplingmade nomeasurable difference, so the MTP layer reaches the GPU without being told.
Micro-batch
-b-ub512 → 2048 is +34.8%;
-bmakes almost no difference as long as it is atleast
-ub. For prompts of 8K and up,-ub 4096adds another 2%. Below about1024 tokens of prompt the flag does nothing, because there is nothing to fill
the micro-batch with.
A published figure for a dense model on the B60 is +8%; this card and this model
give considerably more.
Flash attention
-fa 0-fa 1Worth +6% at a 2048-token prompt and +9% at 8192 — the longer the prompt, the
more it helps. Generation is unaffected. The default is
auto; make it explicit.KV cache and context length
f16q8_0q4_0These are the sizes that were run, not measured ceilings —
f16was not pushedpast 49152, and
q8_0not past 65536.Cost at short context is small — tg128 is 15.79 / 15.72 / 15.69 for
f16 / q8_0 / q4_0, prefill unchanged. A 27B Q8 model does reach its full 128K
context on a single 32 GB card with
q4_0KV.Others report
q4_0KV costing roughly half of generation speed past 16Kcontext. Deep-context generation was not measured here, so treat the cheapness
above as applying to short contexts only.
Environment variables
Against the same baseline (pp2048 1438.3, tg128 15.79). Repeated runs of the
unchanged configuration land between 1434 and 1450, so treat anything within
about ±1% on prefill as noise — several rows below sit above the baseline
purely for that reason:
GGML_SYCL_ENABLE_OPT=0GGML_SYCL_PRIORITIZE_DMMV=1GGML_SYCL_FA_ONEDNN=0SYCL_UR_USE_LEVEL_ZERO_V2=0GGML_SYCL_ENABLE_FUSION=0GGML_SYCL_USM_SYSTEM=1GGML_SYCL_ENABLE_DNN=0GGML_SYCL_ENABLE_VMM=0GGML_SYCL_ENABLE_ESIMD=0GGML_SYCL_ENABLE_MKL_FA=0GGML_SYCL_ENABLE_GRAPH=1GGML_SYCL_USE_ASYNC_MEM_OP=0GGML_SYCL_NO_PINNED=1Two seem worth flagging.
GGML_SYCL_ENABLE_OPT=0costs 68% of generation speed. That switch is thedocumented workaround for issue #21893, where the reorder optimisation produces
corrupted output on this exact card. On this setup — master
63b64a50a, LevelZero 1.15.39122, kernel 7.0.0-28 — the corruption does not reproduce: perplexity
is 6.4750 with the optimisation on and 6.4747 with the workaround. Anyone still
carrying that workaround may want to retest whether they need it.
SYCL_UR_USE_LEVEL_ZERO_V2=0— the older Level Zero adapter is slightlyfaster at generation and costs nothing at prefill.
Settings we ended up using
Long prompts:
Chat and long answers:
GGML_SYCL_FA_ONEDNN=0 SYCL_UR_USE_LEVEL_ZERO_V2=0 \ llama-server -m model.gguf -ngl 99 -b 4096 -ub 2048 -fa 1 \ --spec-type draft-mtp --spec-draft-n-max 6Built with
-DGGML_SYCL_F16=ON -DGGML_SYCL_DEVICE_ARCH=bmg_g21.The two environment variables in the chat profile were measured on plain
generation, so they were rechecked with MTP on — they still help there: 51.30
against 50.69 t/s on a short answer, 32.98 against 31.95 on a long one.
Host notes
Battlemage needs the
xedriver, noti915—lsmod | grep '^xe '. Your userneeds to be in the
rendergroup.For GPU performance counters with
unitraceor VTune:Without it the profiler fails with
Failed to create metric query pool (status = 0x78000004);ZET_ENABLE_METRICS=1alone does not help. It does notaffect inference speed, and it does not survive a reboot unless written to a file.
A note on Vulkan
Vulkan was measured as an alternative and set aside: prompt processing is 2.2x
slower, because it multiplies the Q8_0 weights directly in cooperative-matrix
shaders at about 46 TFLOPS while SYCL dequantizes them to F16 and hands the GEMM
to oneDNN on the XMX units at about 174, and under speculative decoding roughly a
third of requests come back as a single end-of-sequence token where SYCL answers
all of them. Its generation speed also swings by a factor of three between driver
releases — 6.1 t/s on Mesa 26.0.8 against 17.9 on 26.1.7, with the shader
compiler version making under 0.5% either way — so any Vulkan figure is only as
good as the driver it was taken on.
Prior work covering the same ground
GGML_SYCL_F16andGGML_SYCL_PRIORITIZE_DMMVGGML_SYCL_F16, flash attention,xevsi915-b/-ubon the B60GGML_SYCL_DISABLE_OPT=1workaroundAll reactions