Skip to content

Commit 47c0180

Browse files
authored
[SYCL] Fix device lib req mask for spirv target (#15336)
Triple check was wrong. Found this working on thinLTO. Signed-off-by: Sarnie, Nick <[email protected]>
1 parent 5b2f1d2 commit 47c0180

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

llvm/lib/SYCLLowerIR/SYCLDeviceLibReqMask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ uint32_t getDeviceLibBits(const std::string &FuncName) {
763763
// And we don't expect non-spirv functions with "__devicelib_" prefix.
764764
uint32_t llvm::getSYCLDeviceLibReqMask(const Module &M) {
765765
// Device libraries will be enabled only for spir-v module.
766-
if (!Triple(M.getTargetTriple()).isSPIR())
766+
if (!Triple(M.getTargetTriple()).isSPIROrSPIRV())
767767
return 0;
768768
uint32_t ReqMask = 0;
769769
for (const Function &SF : M) {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; RUN: sycl-post-link -properties -split=auto < %s -o %t.files.table
2+
; RUN: FileCheck %s -input-file=%t.files_0.prop
3+
4+
; CHECK:[SYCL/devicelib req mask]
5+
; CHECK: DeviceLibReqMask=1|64
6+
7+
source_filename = "main.cpp"
8+
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
9+
target triple = "spirv64-unknown-unknown"
10+
11+
declare spir_func i32 @__devicelib_imf_umulhi(i32 noundef %0, i32 noundef %1)
12+
13+
; Function Attrs: convergent mustprogress noinline norecurse optnone
14+
define weak_odr dso_local spir_kernel void @kernel() #0 {
15+
entry:
16+
%0 = call i32 @__devicelib_imf_umulhi(i32 0, i32 0)
17+
ret void
18+
}
19+
20+
attributes #0 = { "sycl-module-id"="main.cpp" }

0 commit comments

Comments
 (0)