Skip to content

Crescent Island (cri) support for the XPU/SYCL build - #734

Open
jiqing-feng wants to merge 10 commits into
huggingface:mainfrom
jiqing-feng:cri
Open

Crescent Island (cri) support for the XPU/SYCL build#734
jiqing-feng wants to merge 10 commits into
huggingface:mainfrom
jiqing-feng:cri

Conversation

@jiqing-feng

@jiqing-feng jiqing-feng commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Adds Intel Crescent Island (cri) as an AOT target for SYCL kernels.

Why it isn't just one more device in the list

cri needs a newer toolchain: ocloc 25.35 doesn't know the device, and
sycl-tla 0.9.1 has no cri kernels. Both are bumped (ocloc → 26.22.38646.4,
sycl-tla → 0.9.2), and AOT for cri is gated on DPC++ 2026.0.

The bigger problem is that a kernel compiled with __SYCL_TARGET_INTEL_GPU_CRI__
contains Xe35-only MXFP code that ocloc refuses to lower for pvc or bmg. So
such a translation unit can't share one AOT image across devices. The build now
detects that flag and picks the layout:

  • without it — a single spir64_gen image serves pvc,bmg-g21,cri, which keeps
    the number of device compilations per TU down;
  • with it — the generic image is restricted to cri, and pvc/bmg get separate
    intel_gpu_* alias targets.

Either way the .so also carries a spir64 JIT fallback, so a GPU that isn't
in the AOT list still runs.

Why the flag handling was rewritten

The SYCL flags used to be two hardcoded strings that dependencies patched with
string(REPLACE ...). That stops working once the target list is dynamic, and
it hid three failure modes that all produce a binary that builds fine and then
misbehaves:

  • backend options must be repeated per target, and CMake deduplicates the
    identical -options strings, silently dropping every target but the first —
    SHELL: prevents this;
  • -spirv-ext only reaches the image whose triple matches the exact
    -fsycl-targets alias, so it has to be emitted once per target;
  • the SPIR-V translator replaces the extension list instead of merging, so the
    driver defaults are now probed with icpx -### and sycl-tla's extras appended.
    A failed probe is a hard error rather than a silent fallback.

Flags are now built from a few variables through a xpu_compose_sycl_flags()
macro, so a dependency changes a variable and recomposes.

Validation

Built flash-attn2 and megablocks from kernels-community against this
branch (torch213-cxx11-xpu20260-x86_64-linux) and checked numerics on both
BMG hardware and the CRI TBX simulator. Each case runs only the kernel on XPU;
data generation, the fp32 reference, MXFP4/MXFP8 dequantization and error
statistics stay on CPU.

  • flash-attn2 — 8/8 pass (fix / varlen × fp16 / bf16 × causal / non-causal),
    max abs error 5.4e-04 (fp16) / 4.0e-03 (bf16).
  • megablocks grouped GEMM — 5/5 pass (bf16 ±bias, fp16, mxfp4, mxfp8), max
    relative error 2.6e-03.

Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
ocloc 25.35 rejects the 'cri' device (Failed to parse target: cri - invalid
device), which breaks the pvc,bmg,cri fat-binary link. Bump compute-runtime to
26.22.38646.4 (IGC v2.36.3, gmmlib 22.10.0) whose ocloc recognises cri.
The v0.9.1 tag predates the Crescent Island (cri) reverse-kernel support; pin to
the upstream commit that landed it (sycl-tla d54352d, 'Upstream CRI code #833')
so the Nix build can compile the cri AOT images. Revert to a released tag once
one containing cri is available.
Build one .so with three AOT images. fp16/bf16 kernels compile for
intel_gpu_pvc,intel_gpu_bmg_g21,spir64_gen; MXFP kernels are gated behind
__SYCL_TARGET_INTEL_GPU_CRI__ and compile spir64_gen-only, AOT-lowered to
cri via -device cri. Emit one -Xspirv-translator=<alias> per offload target
so the custom -spirv-ext reaches every image (translator replaces, not merges).
@jiqing-feng
jiqing-feng marked this pull request as draft July 29, 2026 07:15
Signed-off-by: jiqing-feng <jiqing.feng@intel.com>
The tri-target AOT-only build dropped the spir64 image, so sycl-tla
kernels only loaded on pvc/bmg/cri. Re-add spir64 alongside the AOT
targets to restore JIT coverage for other Intel GPUs. MXFP is absent
from the JIT image, which is harmless since its dispatch is gated on
device IP version >= 35 at runtime.

Also align the sycl-tla revision across both paths. The non-nix
FetchContent fallback pinned v0.9.1, which carries cri only as a
placeholder constant and none of the Xe35 block-scaled kernels.
nix-builder already pinned d54352d; v0.9.2 is exactly that commit, so
both now use the tag and the source hash is unchanged.
…2026.0

The previous cri work passed -Xsycl-target-backend=spir64_gen only, which
reaches the generic image alone, so the intel_gpu_pvc and intel_gpu_bmg_g21
alias images silently lost their backend options. Emitting one option per
target then hit CMake's link-option deduplication, which dropped every
repeated -options and made ocloc parse the next flag as its value, so use
SHELL: to keep each pair intact.

cri has no intel_gpu_* alias and is only reachable as a -device of the
generic image. Only a kernel with an Xe35-only TU needs alias targets to
keep MXFP code away from pvc/bmg; every other kernel can lower one generic
image to all three devices, halving the device compilations per TU.

Also gate the AOT device list on DPCPP 2026.0, since cri needs sycl-tla
v0.9.2 and ocloc 26.22, and fail the build when the SPIR-V extension probe
fails instead of silently dropping the compiler's default extensions.
@jiqing-feng jiqing-feng changed the title Cri Crescent Island (cri) support for the XPU/SYCL build Aug 5, 2026
@jiqing-feng
jiqing-feng marked this pull request as ready for review August 5, 2026 08:01
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.

1 participant