DEV Community

Cover image for Gemma 4 E2B on an Intel Iris Xe Laptop: Vulkan, SYCL, OpenVINO or the CPU?
xbill Subscriber for Google Developer Experts

Posted on

Gemma 4 E2B on an Intel Iris Xe Laptop: Vulkan, SYCL, OpenVINO or the CPU?

An Intel laptop with no graphics card still has a GPU: the Iris Xe inside the processor. llama.cpp can reach it three ways, through Vulkan on the Mesa driver the desktop already uses, through Intel's oneAPI SYCL compiler, and through Intel's OpenVINO runtime. This article runs Gemma 4 E2B through all three, and through the CPU cores, on the same laptop, the same model file and the same llama.cpp commit.

Vulkan and OpenVINO tie: about 360 tokens a second reading a prompt and 20.7 generating. SYCL reads at 0.60x and generates at 0.72x of Vulkan. The CPU cores generate at 25.98 tokens a second, 1.26x faster than any GPU path, and read prompts at 98.34, so the GPU's lead is on reading.

This article provides a step by step deployment guide for Gemma 4 E2B on the integrated GPU of an Intel Core i5-1335U laptop with llama.cpp, with each of its three Intel GPU backends built and measured beside a CPU-only build. Each backend is its own rig, a Makefile and a tpu.env, so serving is one command.

https://github.com/xbill9/gemma4-dev/tree/main/local-llamacpp-i51335u-2b-q4_0


The Findings

Vulkan and OpenVINO are level. llama-bench pp512 359.78 and tg128 20.65 tokens a second for Vulkan, 366.52 and 20.78 for OpenVINO. Through llama-server OpenVINO is 1.04x Vulkan on two prompts.

SYCL is the slowest GPU path. 216.67 and 14.91 tokens a second: 0.602x Vulkan on prompts and 0.722x on generation.

The CPU generates fastest. 25.98 tokens a second on all 12 threads, 1.258x Vulkan. The GPU reads a prompt 3.66x faster than the CPU.

OpenVINO needs three memory settings to load on 8 GiB. At its defaults the kernel's out-of-memory killer ends it during loading. With them, it peaks at 3.37 GiB with 248 MiB of the laptop's memory left.

Flash attention off is faster on Iris Xe. 1.385x on prompts and 1.156x on generation with Vulkan, 1.115x and 1.106x with SYCL.

The speculative drafter does not pay on Iris Xe. 0.973x and 0.767x on the GPU, 1.096x and 0.805x on the CPU.

What to do with it.

  • 🟢 Chat and short prompts: serve on the CPU build, 12 threads, 25.98 tokens a second.
  • 🟢 Long prompts, short replies: serve on Vulkan, which reads 3.66x faster than the CPU.
  • ⚠️ OpenVINO matches Vulkan but takes three switches and most of the memory to do it.
  • ❌ SYCL is behind Vulkan on every test here.

What Was Measured

One laptop, one model file, one llama.cpp commit, four builds. For each build, llama-bench with a 512-token prompt and 128 generated tokens, three repetitions, with flash attention on and off where the backend allows both. Then each build serving two greedy 256-token prompts through llama-server with the prompt cache off. Then the 2-token drafter on Vulkan and on the CPU. Then the Vulkan and CPU builds again on a second laptop with the 12th-generation Core i5-1235U.

Only speed was measured. Answer quality (GSM8K, BFCL) was not run on any of these builds.


At This Point You Should Have…

  • A laptop with an Intel Iris Xe integrated GPU and the Mesa ANV Vulkan driver, here a Lenovo Yoga 7 14IRL8 with a Core i5-1335U
  • cmake, ninja-build, glslc, libvulkan-dev and spirv-headers from apt
  • For SYCL: Intel's compute runtime (intel-opencl-icd libze-intel-gpu1 libze1) and oneAPI's intel-oneapi-compiler-dpcpp-cpp, intel-oneapi-mkl-devel and intel-oneapi-dnnl-devel
  • For OpenVINO: the OpenVINO 2026.4.1 runtime archive in /opt/intel/openvino, plus ocl-icd-opencl-dev opencl-headers opencl-clhpp-headers
  • Your user in the render group
  • A clone of gemma4-dev

Step 1 — The Machine

The i5-1335U has 2 performance cores and 8 efficiency cores, 12 threads, and an Iris Xe GPU that runs at up to 1,250 MHz. GPU and CPU share 8 GiB of LPDDR5-5200, of which the kernel sees 5.5 GiB:

$ vulkaninfo --summary
    deviceName         = Intel(R) Iris(R) Xe Graphics (RPL-U)
    driverInfo         = Mesa 26.2.8-1

$ free -h
               total        used        free      shared  buff/cache   available
Mem:           5.5Gi       1.3Gi       1.6Gi       103Mi       3.0Gi       4.2Gi
Enter fullscreen mode Exit fullscreen mode

The CPU governor is the default powersave for every number in this article.


Step 2 — Four Builds of One Commit

All four builds come from one llama.cpp checkout at 7182ef71e, one build directory each. Each rig's make build adds only its own:

Rig Build directory Backend
local-llamacpp-i51335u-2b-q4_0 build-vulkan Vulkan, Mesa ANV
local-llamacpp-i51335u-2b-q4_0 build-cpu none, CPU only
local-llamacppsycl-i51335u-2b-q4_0 build-sycl SYCL, oneAPI 2026.2.1, Level Zero
local-llamacppopenvino-i51335u-2b-q4_0 build-openvino OpenVINO 2026.4.1, OpenCL

The SYCL build compiles with Intel's icx and icpx, which need a lot of memory per job: keep BUILD_JOBS at 3 or 4 on 8 GiB. Every SYCL and OpenVINO recipe sources Intel's environment script first.

All four serve the same file: the exact Q4_0 GGUF of Gemma 4 E2B, where every weight matrix is Q4_0, checked against its SHA-256 by make verify.


Step 3 — Vulkan

Vulkan needs nothing beyond Mesa. llama.cpp finds the GPU and puts every layer on it:

ggml_vulkan: 0 = Intel(R) Iris(R) Xe Graphics (RPL-U) (Intel open-source Mesa driver) | uma: 1 | fp16: 1 | bf16: 0 | fp4: 0 | warp size: 32 | shared memory: 49152 | int dot: 1 | matrix cores: none
| model                          |       size |     params | backend    | ngl | threads |  fa |            test |                  t/s |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | Vulkan     |  99 |       4 |   0 |           pp512 |        359.78 ± 1.58 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | Vulkan     |  99 |       4 |   0 |           tg128 |         20.65 ± 0.02 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | Vulkan     |  99 |       4 |   1 |           pp512 |        259.70 ± 0.42 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | Vulkan     |  99 |       4 |   1 |           tg128 |         17.87 ± 0.01 |
Enter fullscreen mode Exit fullscreen mode

Flash attention off is 1.385x faster on prompts and 1.156x on generation, so the rig serves with FLASH_ATTENTION=0. The GPU held its 1,250 MHz maximum for 35 of the 40 seconds sampled during the generation test.


Step 4 — SYCL

SYCL is Intel's own compute path for llama.cpp, built with oneAPI and run through Level Zero. It sees the GPU as one device:

SYCL0: Intel(R) Iris(R) Xe Graphics (4867 MiB, 2921 MiB free)

| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | SYCL       |  99 |       4 |   0 |           pp512 |        216.67 ± 0.57 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | SYCL       |  99 |       4 |   0 |           tg128 |         14.91 ± 0.04 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | SYCL       |  99 |       4 |   1 |           pp512 |        194.24 ± 0.63 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | SYCL       |  99 |       4 |   1 |           tg128 |         13.48 ± 0.04 |
Enter fullscreen mode Exit fullscreen mode

At its faster setting, flash attention off, SYCL reads prompts at 0.602x Vulkan and generates at 0.722x.


Step 5 — OpenVINO, and Fitting It in 8 GiB

OpenVINO's backend turns llama.cpp's compute graphs into OpenVINO graphs and compiles them for the GPU. It picks the CPU unless told otherwise:

Available devices:
  OPENVINO0: GGML_OPENVINO_DEVICE=CPU (selected) - 13th Gen Intel(R) Core(TM) i5-1335U (5657 MiB, 5657 MiB free)
  OPENVINO1: GGML_OPENVINO_DEVICE=GPU - Intel(R) Iris(R) Xe Graphics (iGPU) (4867 MiB, 4251 MiB free)
Enter fullscreen mode Exit fullscreen mode

With GGML_OPENVINO_DEVICE=GPU and nothing else, the kernel's out-of-memory killer ends llama-bench while it loads, at 4.40 GiB of resident memory. The rig's tpu.env sets three more switches:

GGML_OPENVINO_DEVICE=GPU
GGML_OPENVINO_MEMORY_OPTIMIZE=1
GGML_OPENVINO_RELEASE_WEIGHTS=0
GGML_OPENVINO_SPILL_DIR=/home/xbill/ov-spill
Enter fullscreen mode Exit fullscreen mode

MEMORY_OPTIMIZE requantizes the weights as a stream and keeps a weight buffer in the spill directory on disk. On its own it also frees the host copy of the weights after the first graph is compiled, and the generation graph that comes next then fails:

ggml-openvino: cannot compile a new graph after releasing host weights
llama_bench: error: failed to run gen warmup
Enter fullscreen mode Exit fullscreen mode

RELEASE_WEIGHTS=0 keeps the host copy. With all four set the run completes, and llama.cpp's own OpenVINO guide says llama-bench on this backend needs -fa 1:

| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | OPENVINO   |  99 |       4 |   1 |           pp512 |       366.52 ± 40.35 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | OPENVINO   |  99 |       4 |   1 |           tg128 |         20.78 ± 0.71 |
Enter fullscreen mode Exit fullscreen mode

That is 1.019x Vulkan on prompts and 1.006x on generation, level, with a prompt figure that varies by ±40 across three repetitions. The run peaked at 3.37 GiB resident with 248 MiB of the laptop's memory available. Close the browser before starting it.


Step 6 — The CPU

The CPU-only build has no GPU code at all, so its numbers include no GPU work:

| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |       4 |   1 |           pp512 |         76.81 ± 0.08 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |       4 |   1 |           tg128 |         22.12 ± 0.12 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |       6 |   1 |           pp512 |         77.87 ± 0.42 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |       6 |   1 |           tg128 |         24.59 ± 2.92 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |      12 |   1 |           pp512 |         98.34 ± 0.42 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |      12 |   1 |           tg128 |         25.98 ± 0.12 |
Enter fullscreen mode Exit fullscreen mode

All 12 threads are fastest on both tests. At 25.98 tokens a second the CPU generates 1.258x Vulkan, and at 98.34 it reads prompts at about a quarter of Vulkan's speed. make serve-cpu serves this build.


Step 7 — Through llama-server

Each build served the same two prompts, a Python function and a short story, greedy, 256 tokens, prompt cache off, -c 8192. The Vulkan server's own timing lines:

eval time =   13481.28 ms /   256 tokens (   52.87 ms per token,    18.92 tokens per second)
eval time =   13472.84 ms /   256 tokens (   52.83 ms per token,    18.93 tokens per second)
Enter fullscreen mode Exit fullscreen mode
Build Code, tokens / s Story, tokens / s Server memory
🥇 CPU, 12 threads 26.47 25.57 —
🥈 OpenVINO 19.69 19.60 764 MiB
🥉 Vulkan 18.92 18.93 194 MiB
SYCL 14.91 14.83 972 MiB

OpenVINO runs 1.041x and 1.035x Vulkan, SYCL 0.788x and 0.783x. The CPU server is 1.399x and 1.351x Vulkan; its row comes from a separate server run on the same prompts and settings. Server memory is the process's own resident set; Vulkan's weights sit in GPU memory, which that figure does not count. make serve answers its health check 8 seconds after start on SYCL and 22 on OpenVINO.

All three GPU builds write coherent replies to both prompts. Their greedy text differs slightly between backends.


Step 8 — The Drafter

The exact Q4_0 drafter guesses 2 tokens ahead and llama-server keeps the ones the full model agrees with. On this laptop it does not pay:

spec=False 18.69 tok/s 256 tok None None          # iGPU, code prompt
spec=False 18.47 tok/s 256 tok None None          # iGPU, story prompt
spec=True 18.18 tok/s 256 tok 217 146             # iGPU + drafter, code
spec=True 14.17 tok/s 256 tok 281 114             # iGPU + drafter, story
cpu spec=False 26.47 tok/s None None              # CPU -t 12, code
cpu spec=False 25.57 tok/s None None              # CPU -t 12, story
cpu spec=True 29.0 tok/s 209 150                  # CPU + drafter, code
cpu spec=True 20.58 tok/s 292 109                 # CPU + drafter, story
Enter fullscreen mode Exit fullscreen mode

0.973x and 0.767x on Vulkan, 1.096x and 0.805x on the CPU. Every rig serves without it.


Step 9 — A 12th-Generation Laptop

The Vulkan and CPU builds ran again on a Samsung Galaxy Book2 360 with a Core i5-1235U, the 12th-generation part, with 8 GiB of slower LPDDR4X-4267:

| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | Vulkan     |  99 |       4 |   0 |           pp512 |        358.28 ± 0.64 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | Vulkan     |  99 |       4 |   0 |           tg128 |         18.60 ± 0.02 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |      12 |   1 |           pp512 |         68.50 ± 1.81 |
| gemma4 E2B Q4_0                |   2.43 GiB |     4.63 B | CPU        |      12 |   1 |           tg128 |         22.08 ± 3.35 |
Enter fullscreen mode Exit fullscreen mode

The same pattern holds. The GPU reads prompts 5.230x the CPU, and the CPU generates 1.187x the GPU, with a wide spread between repetitions (± 3.35). Against the 13th-generation laptop the GPU reads at 0.996x and generates at 0.901x.


Compare and Contrast

The four ways to serve on the i5-1335U, llama-bench at each one's faster flash-attention setting:

Build Generate, tokens / s Prompt, tokens / s Setup
🥇 CPU, 12 threads 25.98 98.34 apt
🥈 OpenVINO 20.78 366.52 archive + 3 memory switches
🥉 Vulkan 20.65 359.78 apt
SYCL 14.91 216.67 oneAPI repository
  • CPU. 🟢 Fastest generation, leaves the GPU to the desktop. ❌ A 2,000-token prompt waits about 20.3 seconds.
  • Vulkan. 🟢 Fast prompts, Mesa only, 194 MiB of process memory. ⚠️ Generates at 0.795x the CPU.
  • OpenVINO. 🟢 Level with Vulkan. ❌ Needs three switches to load, 3.37 GiB at peak and a disk spill directory.
  • SYCL. ⚠️ Reads prompts 2.203x the CPU. ❌ Behind Vulkan on every test.

An AMD laptop of the same class, the Ryzen 5 7530U with its Radeon integrated GPU, generates at 32.37 tokens a second through Vulkan on the same commit and file: 1.568x the Iris Xe, and ahead of its own CPU cores.


So, Which One?

For chat, serve the CPU build on all 12 threads: 25.98 tokens a second, nothing to install past cmake.

For long prompts with short replies, such as summarising a document, serve Vulkan: a 2,000-token prompt is read in about 5.6 seconds against 20.3 on the CPU.

OpenVINO gives the same speed as Vulkan and costs most of the laptop's memory to load. SYCL gives less.


Summary

The goal of this article was to find the fastest way to serve Gemma 4 E2B on an Intel laptop with only an integrated GPU. The key to the solution was building one llama.cpp commit four ways, with Vulkan, SYCL, OpenVINO and no GPU at all, and measuring each on the same file. The results were:

  • 🟢 The CPU generates fastest, 25.98 tokens a second, 1.258x the best GPU path.
  • 🟢 Vulkan and OpenVINO read prompts at 359.78 and 366.52 tokens a second, 3.66x the CPU.
  • ⚠️ OpenVINO loads on 8 GiB only with MEMORY_OPTIMIZE=1, RELEASE_WEIGHTS=0 and a spill directory, peaking at 3.37 GiB.
  • ❌ SYCL runs at 0.602x Vulkan on prompts and 0.722x on generation.
  • ❌ The 2-token drafter slows generation on the GPU, 0.973x and 0.767x.

Scope: one Lenovo Yoga 7 14IRL8 with a Core i5-1335U (Iris Xe, Mesa 26.2.8 ANV, Intel compute runtime 26.27.39122, oneAPI 2026.2.1, OpenVINO 2026.4.1) and one Samsung Galaxy Book2 360 with a Core i5-1235U, Debian sid, kernel 7.4.0-rc5, llama.cpp 7182ef71e, xbill9/gemma-4-E2B-it-qat-q4_0-exact-gguf, CPU governor powersave, all on 2026-12-02. llama-bench runs are three repetitions each; server runs are two prompts, one pass each, one request at a time, thinking off. The CPU server row comes from a separate run from the GPU rows. The prompt waits are arithmetic from the llama-bench prompt speed. Answer quality, long contexts, several requests at once, sustained heat and SYCL's and OpenVINO's tuning switches were not measured.

The strategy for serving Gemma 4 E2B on an Intel integrated laptop GPU was validated with an incremental step by step approach.


References

Hope you enjoyed it!

Top comments (0)