Skip to content

Commit f91c0eb

Browse files
Copilotjinge90
andauthored
[SYCL] Add novalake GPU devices to native bfloat16 target list (#21993)
- [x] Add `nvl_s`, `nvl_u`, `nvl_p` to `GPUArchsWithNBF16` set in `SYCL.cpp` - [x] Add `nvl` prefix check to `checkBF` lambda in `SYCL.cpp` - [x] Add test cases for novalake devices in `sycl-device-lib-bfloat16.cpp` - [x] Fix clang-format issue in `GPUArchsWithNBF16` initializer --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jinge90 <43599496+jinge90@users.noreply.github.com>
1 parent 03eb8e0 commit f91c0eb

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ static bool selectBfloatLibs(const llvm::opt::ArgList &Args,
235235
const llvm::Triple &Triple, const ToolChain &TC,
236236
bool &UseNative) {
237237
static llvm::SmallSet<StringRef, 8> GPUArchsWithNBF16{
238-
"pvc", "acm_g10", "acm_g11", "acm_g12", "bmg_g21",
239-
"lnl_m", "ptl_h", "ptl_u", "wcl", "cri"};
238+
"pvc", "acm_g10", "acm_g11", "acm_g12", "bmg_g21", "lnl_m", "ptl_h",
239+
"ptl_u", "wcl", "cri", "nvl_s", "nvl_u", "nvl_p"};
240240
bool NeedLibs = false;
241241

242242
// spir64 target is actually JIT compilation, so we defer selection of
@@ -269,7 +269,7 @@ static bool selectBfloatLibs(const llvm::opt::ArgList &Args,
269269
Device.starts_with("acm") || Device.starts_with("dg2") ||
270270
Device.starts_with("bmg") || Device.starts_with("lnl") ||
271271
Device.starts_with("ptl") || Device.starts_with("wcl") ||
272-
Device.starts_with("cri");
272+
Device.starts_with("cri") || Device.starts_with("nvl");
273273
};
274274

275275
auto checkSpirvJIT = [](StringRef Target) {

clang/test/Driver/sycl-device-lib-bfloat16.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,38 @@
6161
// RUN: "-device cri" /clang:--sysroot=%S/Inputs/SYCL -- %s 2>&1 \
6262
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
6363

64+
// Test that a novalake AOT compilation uses the native library.
65+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend \
66+
// RUN: "-device nvl_s" %s --sysroot=%S/Inputs/SYCL -### 2>&1 \
67+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
68+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_nvl_s %s \
69+
// RUN: --sysroot=%S/Inputs/SYCL -### 2>&1 \
70+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
71+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_30_4_0 %s \
72+
// RUN: --sysroot=%S/Inputs/SYCL -### 2>&1 \
73+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
74+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend \
75+
// RUN: "-device nvl_u" %s --sysroot=%S/Inputs/SYCL -### 2>&1 \
76+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
77+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_nvl_u %s \
78+
// RUN: --sysroot=%S/Inputs/SYCL -### 2>&1 \
79+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
80+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_30_5_0 %s \
81+
// RUN: --sysroot=%S/Inputs/SYCL -### 2>&1 \
82+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
83+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend \
84+
// RUN: "-device nvl_p" %s --sysroot=%S/Inputs/SYCL -### 2>&1 \
85+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
86+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_nvl_p %s \
87+
// RUN: --sysroot=%S/Inputs/SYCL -### 2>&1 \
88+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
89+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_35_10_0 %s \
90+
// RUN: --sysroot=%S/Inputs/SYCL -### 2>&1 \
91+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
92+
// RUN: %clang_cl -### -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend \
93+
// RUN: "-device nvl_s" /clang:--sysroot=%S/Inputs/SYCL -- %s 2>&1 \
94+
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE
95+
6496
// Test that unless all targets support bfloat16, AOT compilation uses the
6597
// fallback library.
6698
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend \

0 commit comments

Comments
 (0)