Skip to content

Commit

Permalink
[SYCL] Fix device lib req mask for spirv target (intel#15336)
Browse files Browse the repository at this point in the history
Triple check was wrong.

Found this working on thinLTO.

Signed-off-by: Sarnie, Nick <[email protected]>
  • Loading branch information
sarnex authored Sep 12, 2024
1 parent 5b2f1d2 commit 47c0180
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/SYCLLowerIR/SYCLDeviceLibReqMask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ uint32_t getDeviceLibBits(const std::string &FuncName) {
// And we don't expect non-spirv functions with "__devicelib_" prefix.
uint32_t llvm::getSYCLDeviceLibReqMask(const Module &M) {
// Device libraries will be enabled only for spir-v module.
if (!Triple(M.getTargetTriple()).isSPIR())
if (!Triple(M.getTargetTriple()).isSPIROrSPIRV())
return 0;
uint32_t ReqMask = 0;
for (const Function &SF : M) {
Expand Down
20 changes: 20 additions & 0 deletions llvm/test/tools/sycl-post-link/device-requirements/mask.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
; RUN: sycl-post-link -properties -split=auto < %s -o %t.files.table
; RUN: FileCheck %s -input-file=%t.files_0.prop

; CHECK:[SYCL/devicelib req mask]
; CHECK: DeviceLibReqMask=1|64

source_filename = "main.cpp"
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"
target triple = "spirv64-unknown-unknown"

declare spir_func i32 @__devicelib_imf_umulhi(i32 noundef %0, i32 noundef %1)

; Function Attrs: convergent mustprogress noinline norecurse optnone
define weak_odr dso_local spir_kernel void @kernel() #0 {
entry:
%0 = call i32 @__devicelib_imf_umulhi(i32 0, i32 0)
ret void
}

attributes #0 = { "sycl-module-id"="main.cpp" }

0 comments on commit 47c0180

Please sign in to comment.