Skip to content

xpu: Gen12LP (Iris Xe, DG1) builds Nemotron's kernels without DPAS - #1673

Merged
ashhart merged 3 commits into
ashhart:mainfrom
jschmied:xpu-gen12lp
Nov 1, 2026
Merged

ashhart merged 3 commits into
ashhart:mainfrom
jschmied:xpu-gen12lp

Conversation

@jschmied

Copy link
Copy Markdown
Contributor

Problem

ocloc refuses intel_sub_group_bf16_bf16_matrix_mad_k16 for Gen12LP devices (tgllp, rkl, adl-*, dg1), which have no DPAS. nem_attn_dec.cl uses it for Nemotron's decode attention. So zig build xpu-spirv failed for an Iris Xe and nothing in the XPU tree could be built there.

Change

  • -Dxpu-dpas:
    • defaults to off for the Gen12LP device names and on for everything else;
    • off adds -DTF_XPU_NO_DPAS to every SPIR-V image's ocloc options;
    • it is also passed into the runtime as kernels.dpas.
  • nem_attn_dec.cl: with TF_XPU_NO_DPAS, the two DPAS products become a plain 8×16 by 16×16 bf16 product (sub-group shuffles, fp32 FMA). The DPAS path is unchanged.
  • Nemotron (xpu_model.zig): without DPAS it leaves a_dec null and decodes through attn_partial/attn_merge. On Iris Xe that path measured faster than the fallback kernel, which spills 128 KiB of registers (12.0 against 57.3 ms at 131k keys).

Builds for DPAS devices are unchanged, since the macro is off for them.

Checks

  • Iris Xe (WSL2, Gen12LP):
    • zig build -Dxpu xpu-spirv xpu-tests builds;
    • device smoke test passes; panic codes are as expected;
    • the nem_attn_dec fallback against an FP64 replay: max error 3.3e-3.
  • DPAS devices: the SPIR-V images built for bmg are byte-equal to main: 14 of 14 at 8b0f219 against ea3567b.
  • Not covered: zig build xpu-native still fails for tgllp, on main as well: the Qwen3.8-27B XPU runner is always compiled into the server, and its kernels need DPAS, 2D block loads and the nGEN headers. A Gen12LP server needs that engine made optional when -Dxpu-dpas=false; that would be a follow-up.
  • Not run: the Nemotron fixture op tests need the 30B-A3B checkpoint, which does not fit this machine (16 GB), so they skip. No Arc/Xe2 run.
  • Spark: lean check reports no new findings; zig build test, the contract, golden, security and fuzz steps pass; git diff --check is clean.

Stacked on #1672 (the device enumeration fix, needed to open the device on this machine).

@ashhart

ashhart commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thanks @jschmied. Byte-equal images on bmg settle the DPAS side, and the FP64 check covers the fallback. We'll land it. #1692 can follow once it's rebased past Gemma 4's XPU engine.

jschmied and others added 3 commits November 1, 2026 07:52
…allback for its two DPAS products

ocloc refuses intel_sub_group_bf16_bf16_matrix_mad_k16 for tgllp. With TF_XPU_NO_DPAS, nem_attn_dec.cl computes the same 8x16 by 16x16 bf16 product with sub-group shuffles and fp32 FMAs. -Dxpu-dpas (default off for tgllp, rkl, adl-*, dg1, gen12lp devices) passes it to every SPIR-V image's ocloc options; other devices build as before.
kernels.dpas carries -Dxpu-dpas. Without it nem_attn_dec builds from its fallback but Nemotron leaves a_dec null and decodes through attn_partial/attn_merge, which measured faster on Iris Xe (12.0 against 57.3 ms at 131k keys; the fallback spills 128 KiB of registers).
@ashhart
ashhart merged commit 1dfc78c into ashhart:main Nov 1, 2026
9 checks passed
@ashhart

ashhart commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thank you @jschmied. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

@ashhart

ashhart commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Thanks @jschmied! Nemotron's kernels now build on Gen12LP GPUs (Iris Xe, DG1) in 1.2.1: https://github.com/ashhart/TensorFold/releases/tag/v1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants