Skip to content

Commit a9295c1

Browse files
authored
[SYCL][Driver] Link Native BF16 devicelib for lnl target (#17154)
Lunarlake platform supports native bf16 conversions, should link native bf16 devicelib. --------- Signed-off-by: jinge90 <[email protected]>
1 parent a43af18 commit a9295c1

File tree

2 files changed

+41
-8
lines changed

2 files changed

+41
-8
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ static bool selectBfloatLibs(const llvm::Triple &Triple, const Compilation &C,
309309

310310
static llvm::SmallSet<StringRef, 8> GPUArchsWithNBF16{
311311
"intel_gpu_pvc", "intel_gpu_acm_g10", "intel_gpu_acm_g11",
312-
"intel_gpu_acm_g12", "intel_gpu_dg2_10", "intel_gpu_dg2_11",
313-
"intel_dg2_g12", "intel_gpu_bmg_g21"};
312+
"intel_gpu_acm_g12", "intel_gpu_dg2_g10", "intel_gpu_dg2_g11",
313+
"intel_dg2_g12", "intel_gpu_bmg_g21", "intel_gpu_lnl_m"};
314314
const llvm::opt::ArgList &Args = C.getArgs();
315315
bool NeedLibs = false;
316316

@@ -351,7 +351,8 @@ static bool selectBfloatLibs(const llvm::Triple &Triple, const Compilation &C,
351351

352352
auto checkBF = [](StringRef Device) {
353353
return Device.starts_with("pvc") || Device.starts_with("ats") ||
354-
Device.starts_with("dg2") || Device.starts_with("bmg");
354+
Device.starts_with("dg2") || Device.starts_with("bmg") ||
355+
Device.starts_with("lnl");
355356
};
356357

357358
auto checkSpirvJIT = [](StringRef Target) {

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

+37-5
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
// RUN: --sysroot=%S/Inputs/SYCL %s -### 2>&1 \
100100
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NONE
101101

102-
// Test test AOT-DG1 + JIT compilation uses native libs + no libs
102+
// Test AOT-DG1 + JIT compilation uses native libs + no libs
103103
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg1,spir64 \
104104
// RUN: --sysroot=%S/Inputs/SYCL %s -### 2>&1 \
105105
// RUN: | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-NONE
@@ -113,7 +113,7 @@
113113
// RUN: --sysroot=%S/Inputs/SYCL %s -### 2>&1 \
114114
// RUN: | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-NONE
115115

116-
// Test test AOT-PVC + JIT compilation + AOT-DG2 uses native libs + no libs + native libs
116+
// Test AOT-PVC + JIT compilation + AOT-DG2 uses native libs + no libs + native libs
117117
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc,spir64,intel_gpu_acm_g10 \
118118
// RUN: --sysroot=%S/Inputs/SYCL %s -### 2>&1 \
119119
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NONE-NATIVE
@@ -127,7 +127,7 @@
127127
// RUN: --sysroot=%S/Inputs/SYCL %s -### 2>&1 \
128128
// RUN: | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NONE-NATIVE
129129

130-
// Test test AOT-PVC + JIT compilation + AOT-DG1 uses fallback libs + no libs + fallback libs
130+
// Test AOT-PVC + JIT compilation + AOT-DG1 uses fallback libs + no libs + fallback libs
131131
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc,spir64,intel_gpu_dg1 \
132132
// RUN: --sysroot=%S/Inputs/SYCL %s -### 2>&1 \
133133
// RUN: | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-NONE-FALLBACK
@@ -141,22 +141,54 @@
141141
// RUN: --sysroot=%S/Inputs/SYCL %s -### 2>&1 \
142142
// RUN: | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-NONE-FALLBACK
143143

144-
// Test test AOT-PVC + AOT-DG1 specified via different options, uses fallback libs
144+
// Test AOT-PVC + AOT-DG1 specified via different options, uses fallback libs
145145
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc,spir64_gen \
146146
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device dg1" \
147147
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-FALLBACK
148148
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg1,spir64_gen \
149149
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device pvc" \
150150
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-FALLBACK
151151

152-
// Test test AOT-PVC + AOT-BMG specified via different options, uses native libs
152+
// Test AOT-PVC + AOT-BMG specified via different options, uses native libs
153153
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_bmg_g21,spir64_gen \
154154
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device pvc" \
155155
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NATIVE
156156
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc,spir64_gen \
157157
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device bmg-g21-a0" \
158158
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NATIVE
159159

160+
// Test AOT-DG2 + AOT-DG1 specified via different options, uses fallback libs
161+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10,spir64_gen \
162+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device dg1" \
163+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-FALLBACK
164+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg1,spir64_gen \
165+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device dg2_g12" \
166+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-FALLBACK
167+
168+
// Test AOT-PVC + AOT-DG2 specified via different options, uses native libs
169+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g11,spir64_gen \
170+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device pvc" \
171+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NATIVE
172+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc,spir64_gen \
173+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device dg2_g12" \
174+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NATIVE
175+
176+
// Test AOT-PVC + AOT-LNL specified via different options, uses native libs
177+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_lnl_m,spir64_gen \
178+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device pvc" \
179+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NATIVE
180+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_pvc,spir64_gen \
181+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device lnl_m" \
182+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-NATIVE-NATIVE
183+
184+
// Test AOT-LNL + AOT-DG1 specified via different options, uses fallback libs
185+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_lnl_m,spir64_gen \
186+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device dg1" \
187+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-FALLBACK
188+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg1,spir64_gen \
189+
// RUN: --sysroot=%S/Inputs/SYCL -Xsycl-target-backend=spir64_gen "-device lnl_m" \
190+
// RUN: %s -### 2>&1 | FileCheck %s -check-prefix=BFLOAT16-FALLBACK-FALLBACK
191+
160192
// BFLOAT16-NOT: llvm-link{{.*}} "{{.*}}libsycl-{{fallback|native}}-bfloat16.bc"
161193

162194
// BFLOAT16-NATIVE: llvm-link{{.*}} "{{.*}}libsycl-native-bfloat16.bc"

0 commit comments

Comments
 (0)