Skip to content

[SYCL] Link native bfloat16 device library for intel_gpu_cri AOT target#21675

Merged
againull merged 1 commit intosyclfrom
copilot/link-bfloat16-library-intel-gpu
Apr 3, 2026
Merged

[SYCL] Link native bfloat16 device library for intel_gpu_cri AOT target#21675
againull merged 1 commit intosyclfrom
copilot/link-bfloat16-library-intel-gpu

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

intel_gpu_cri supports native bfloat16 but was missing from the AOT compilation path that selects the native bfloat16 device library, causing it to fall back to the software emulation library.

Changes

  • clang/lib/Driver/ToolChains/SYCL.cpp

    • Add "intel_gpu_cri" to GPUArchsWithNBF16 — covers -fsycl-targets=intel_gpu_cri usage
    • Add cri prefix to checkBF lambda — covers -Xsycl-target-backend=spir64_gen "-device cri" usage
  • clang/test/Driver/sycl-device-lib-bfloat16.cpp

    • Add test cases for both -fsycl-targets=intel_gpu_cri and -device cri via spir64_gen, asserting BFLOAT16-NATIVE is selected

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes SYCL AOT bfloat16 device library selection for the intel_gpu_cri target by ensuring the driver recognizes cri as a native-bfloat16-capable Intel GPU in both -fsycl-targets=... and -device ... argument paths.

Changes:

  • Add intel_gpu_cri to the set of Intel GPU AOT targets that should link the native bfloat16 device library.
  • Teach the -device ... parsing path to treat cri devices as native-bfloat16-capable.
  • Extend driver tests to assert the native bfloat16 library is selected for intel_gpu_cri / -device cri.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
clang/lib/Driver/ToolChains/SYCL.cpp Updates native-bfloat16 target detection for intel_gpu_cri and cri devices.
clang/test/Driver/sycl-device-lib-bfloat16.cpp Adds coverage ensuring cri AOT paths select BFLOAT16-NATIVE.

static llvm::SmallSet<StringRef, 8> GPUArchsWithNBF16{
"intel_gpu_pvc", "intel_gpu_acm_g10", "intel_gpu_acm_g11",
"intel_gpu_acm_g12", "intel_gpu_dg2_g10", "intel_gpu_dg2_g11",
"intel_dg2_g12", "intel_gpu_bmg_g21", "intel_gpu_lnl_m",
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPUArchsWithNBF16 includes "intel_dg2_g12", but elsewhere the target is consistently named intel_gpu_dg2_g12 (e.g., resolveGenDevice() cases). As written, -fsycl-targets=intel_gpu_dg2_g12 won’t be recognized as supporting native bfloat16 here and will incorrectly select the fallback library. Update the entry to the correct target name.

Suggested change
"intel_dg2_g12", "intel_gpu_bmg_g21", "intel_gpu_lnl_m",
"intel_gpu_dg2_g12", "intel_gpu_bmg_g21", "intel_gpu_lnl_m",

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue is not cri specific, I will create separate PR to solve.

Comment on lines 241 to +246
static llvm::SmallSet<StringRef, 8> GPUArchsWithNBF16{
"intel_gpu_pvc", "intel_gpu_acm_g10", "intel_gpu_acm_g11",
"intel_gpu_acm_g12", "intel_gpu_dg2_g10", "intel_gpu_dg2_g11",
"intel_dg2_g12", "intel_gpu_bmg_g21", "intel_gpu_lnl_m",
"intel_gpu_ptl_h", "intel_gpu_ptl_u", "intel_gpu_wcl"};
"intel_gpu_ptl_h", "intel_gpu_ptl_u", "intel_gpu_wcl",
"intel_gpu_cri"};
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolveGenDevice() treats intel_gpu_cri and intel_gpu_35_11_0 as the same device, but GPUArchsWithNBF16 only lists intel_gpu_cri. If users pass -fsycl-targets=intel_gpu_35_11_0, this logic will currently fall back to the software bfloat16 library. Consider adding the numeric alias (and/or using the resolved gen device name) so both forms select the native bfloat16 library.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue is not cri specific, I will create separate PR to solve.

@jinge90
Copy link
Copy Markdown
Contributor

jinge90 commented Apr 2, 2026

Hi, @intel/dpcpp-clang-driver-reviewers
Could you help review this PR?
Thanks very much.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

@intel/llvm-gatekeepers please consider merging

@againull againull merged commit 65e2c7e into sycl Apr 3, 2026
35 checks passed
@bader bader deleted the copilot/link-bfloat16-library-intel-gpu branch April 5, 2026 13:16
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.

5 participants