Skip to content

Commit 535380d

Browse files
committed
Merge branch 'sycl' into llvmspirv_pulldown
2 parents 91163e6 + 726f8d2 commit 535380d

File tree

79 files changed

+802
-1781
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+802
-1781
lines changed

clang/test/Driver/sycl-linker-wrapper-image.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,19 @@ int main() {
4444
// CHECK-DAG: @.sycl_offloading.target.0 = internal unnamed_addr constant [7 x i8] c"spir64\00"
4545
// CHECK-DAG: @.sycl_offloading.opts.compile.0 = internal unnamed_addr constant [1 x i8] zeroinitializer
4646
// CHECK-DAG: @.sycl_offloading.opts.link.0 = internal unnamed_addr constant [1 x i8] zeroinitializer
47-
// CHECK-DAG: @prop = internal unnamed_addr constant [17 x i8] c"DeviceLibReqMask\00"
48-
// CHECK-DAG: @__sycl_offload_prop_sets_arr = internal constant [1 x %_pi_device_binary_property_struct] [%_pi_device_binary_property_struct { ptr @prop, ptr null, i32 1, i64 0 }]
49-
// CHECK-DAG: @SYCL_PropSetName = internal unnamed_addr constant [24 x i8] c"SYCL/devicelib req mask\00"
50-
// CHECK-DAG: @prop.1 = internal unnamed_addr constant [8 x i8] c"aspects\00"
47+
// CHECK-DAG: @prop = internal unnamed_addr constant [8 x i8] c"aspects\00"
5148
// CHECK-DAG: @prop_val = internal unnamed_addr constant [8 x i8] zeroinitializer
52-
// CHECK-DAG: @__sycl_offload_prop_sets_arr.2 = internal constant [1 x %_pi_device_binary_property_struct] [%_pi_device_binary_property_struct { ptr @prop.1, ptr @prop_val, i32 2, i64 8 }]
53-
// CHECK-DAG: @SYCL_PropSetName.3 = internal unnamed_addr constant [25 x i8] c"SYCL/device requirements\00"
54-
// CHECK-DAG: @SYCL_PropSetName.4 = internal unnamed_addr constant [22 x i8] c"SYCL/kernel param opt\00"
55-
// CHECK-DAG: @__sycl_offload_prop_sets_arr.5 = internal constant [3 x %_pi_device_binary_property_set_struct] [%_pi_device_binary_property_set_struct { ptr @SYCL_PropSetName, ptr @__sycl_offload_prop_sets_arr, ptr getelementptr ([1 x %_pi_device_binary_property_struct], ptr @__sycl_offload_prop_sets_arr, i64 0, i64 1) }, %_pi_device_binary_property_set_struct { ptr @SYCL_PropSetName.3, ptr @__sycl_offload_prop_sets_arr.2, ptr getelementptr ([1 x %_pi_device_binary_property_struct], ptr @__sycl_offload_prop_sets_arr.2, i64 0, i64 1) }, %_pi_device_binary_property_set_struct { ptr @SYCL_PropSetName.4, ptr null, ptr null }]
49+
// CHECK-DAG: @__sycl_offload_prop_sets_arr = internal constant [1 x %_pi_device_binary_property_struct] [%_pi_device_binary_property_struct { ptr @prop, ptr @prop_val, i32 2, i64 8 }]
50+
// CHECK-DAG: @SYCL_PropSetName = internal unnamed_addr constant [25 x i8] c"SYCL/device requirements\00"
51+
// CHECK-DAG: @SYCL_PropSetName.1 = internal unnamed_addr constant [22 x i8] c"SYCL/kernel param opt\00"
52+
// CHECK-DAG: @__sycl_offload_prop_sets_arr.2 = internal constant [2 x %_pi_device_binary_property_set_struct] [%_pi_device_binary_property_set_struct { ptr @SYCL_PropSetName, ptr @__sycl_offload_prop_sets_arr, ptr getelementptr ([1 x %_pi_device_binary_property_struct], ptr @__sycl_offload_prop_sets_arr, i64 0, i64 1) }, %_pi_device_binary_property_set_struct { ptr @SYCL_PropSetName.1, ptr null, ptr null }]
5653
// CHECK-DAG: @.sycl_offloading.0.data = internal unnamed_addr constant [[[SIZE1:.*]] x i8]
5754
// CHECK-DAG: @__sycl_offload_entry_name = internal unnamed_addr constant [25 x i8] c"_ZTSZ4mainE11fake_kernel\00"
5855
// CHECK-DAG: @__sycl_offload_entries_arr = internal constant [1 x %struct.__tgt_offload_entry] [%struct.__tgt_offload_entry { i64 0, i16 1, i16 8, i32 0, ptr null, ptr @__sycl_offload_entry_name, i64 0, i64 0, ptr null }]
5956
// CHECK-DAG: @.sycl_offloading.0.info = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint (ptr @.sycl_offloading.0.data to i64), i64 772], section ".tgtimg", align 16
6057
// CHECK-DAG: @llvm.used = appending global [1 x ptr] [ptr @.sycl_offloading.0.info], section "llvm.metadata"
61-
// CHECK-DAG: @.sycl_offloading.device_images = internal unnamed_addr constant [1 x %__sycl.tgt_device_image] [%__sycl.tgt_device_image { i16 3, i8 4, i8 0, ptr @.sycl_offloading.target.0, ptr @.sycl_offloading.opts.compile.0, ptr @.sycl_offloading.opts.link.0, ptr @.sycl_offloading.0.data, ptr getelementptr ([[[SIZE2:.*]] x i8], ptr @.sycl_offloading.0.data, i64 0, i64 [[SIZE2]]), ptr @__sycl_offload_entries_arr, ptr getelementptr ([1 x %struct.__tgt_offload_entry], ptr @__sycl_offload_entries_arr, i64 0, i64 1), ptr @__sycl_offload_prop_sets_arr.5, ptr getelementptr ([3 x %_pi_device_binary_property_set_struct], ptr @__sycl_offload_prop_sets_arr.5, i64 0, i64 3) }]
58+
59+
// CHECK-DAG: @.sycl_offloading.device_images = internal unnamed_addr constant [1 x %__sycl.tgt_device_image] [%__sycl.tgt_device_image { i16 3, i8 4, i8 0, ptr @.sycl_offloading.target.0, ptr @.sycl_offloading.opts.compile.0, ptr @.sycl_offloading.opts.link.0, ptr @.sycl_offloading.0.data, ptr getelementptr ([[[SIZE2:.*]] x i8], ptr @.sycl_offloading.0.data, i64 0, i64 [[SIZE2]]), ptr @__sycl_offload_entries_arr, ptr getelementptr ([1 x %struct.__tgt_offload_entry], ptr @__sycl_offload_entries_arr, i64 0, i64 1), ptr @__sycl_offload_prop_sets_arr.2, ptr getelementptr ([2 x %_pi_device_binary_property_set_struct], ptr @__sycl_offload_prop_sets_arr.2, i64 0, i64 2) }]
6260
// CHECK-DAG: @.sycl_offloading.descriptor = internal constant %__sycl.tgt_bin_desc { i16 1, i16 1, ptr @.sycl_offloading.device_images, ptr null, ptr null }
6361
// CHECK-DAG: @llvm.global_ctors = {{.*}} { i32 1, ptr @sycl.descriptor_reg, ptr null }]
6462
// CHECK-DAG: @llvm.global_dtors = {{.*}} { i32 1, ptr @sycl.descriptor_unreg, ptr null }]

llvm/docs/requirements-hashed.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ sphinxcontrib-serializinghtml==2.0.0 \
367367
--hash=sha256:6e2cb0eef194e10c27ec0023bfeb25badbbb5868244cf5bc5bdc04e4464bf331 \
368368
--hash=sha256:e9d912827f872c029017a53f0ef2180b327c3f7fd23c87229f7a8e8b70031d4d
369369
# via sphinx
370-
urllib3==2.5.0 \
371-
--hash=sha256:3fc47733c7e419d4bc3f6b3dc2b4f890bb743906a30d56ba4a5bfa4bbff92760 \
372-
--hash=sha256:e6b01673c0fa6a13e374b50871808eb3bf7046c4b125b216f6bf1cc604cff0dc
370+
urllib3==2.6.0 \
371+
--hash=sha256:c90f7a39f716c572c4e3e58509581ebd83f9b59cced005b7db7ad2d22b0db99f \
372+
--hash=sha256:cb9bcef5a4b345d5da5d145dc3e30834f58e8018828cbc724d30b4cb7d4d49f1
373373
# via requests
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//===----- SYCLDeviceLibBF16.h - get SYCL devicelib required Info -----=-==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#pragma once
10+
11+
namespace llvm {
12+
class Function;
13+
class Module;
14+
bool isSYCLDeviceLibBF16Used(const Module &M);
15+
bool isBF16DeviceLibFuncDecl(const Function &F);
16+
} // namespace llvm

llvm/include/llvm/SYCLLowerIR/SYCLDeviceLibReqMask.h

Lines changed: 0 additions & 47 deletions
This file was deleted.

llvm/include/llvm/SYCLPostLink/ComputeModuleRuntimeInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#pragma once
1212

1313
#include "llvm/ADT/SetVector.h"
14-
#include "llvm/SYCLLowerIR/SYCLDeviceLibReqMask.h"
1514
#include "llvm/Support/PropertySetIO.h"
1615
#include <string>
1716
namespace llvm {

llvm/include/llvm/Support/PropertySetIO.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,6 @@ class PropertySetRegistry {
209209
"SYCL/specialization constants";
210210
static constexpr char SYCL_SPEC_CONSTANTS_DEFAULT_VALUES[] =
211211
"SYCL/specialization constants default values";
212-
// TODO: remove SYCL_DEVICELIB_REQ_MASK when devicelib online linking path
213-
// is totally removed.
214-
static constexpr char SYCL_DEVICELIB_REQ_MASK[] = "SYCL/devicelib req mask";
215212
static constexpr char SYCL_DEVICELIB_METADATA[] = "SYCL/devicelib metadata";
216213
static constexpr char SYCL_KERNEL_PARAM_OPT_INFO[] = "SYCL/kernel param opt";
217214
static constexpr char SYCL_PROGRAM_METADATA[] = "SYCL/program metadata";

llvm/lib/SYCLLowerIR/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ add_llvm_component_library(LLVMSYCLLowerIR
4848
SYCLAddOptLevelAttribute.cpp
4949
SYCLConditionalCallOnDevice.cpp
5050
SYCLCreateNVVMAnnotations.cpp
51-
SYCLDeviceLibReqMask.cpp
51+
SYCLDeviceLibBF16.cpp
5252
SYCLDeviceRequirements.cpp
5353
SYCLKernelParamOptInfo.cpp
5454
SYCLJointMatrixTransform.cpp
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//==----- SYCLDeviceLibBF16.cpp - get SYCL BF16 devicelib required Info ----==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// This file provides some utils to analyze whether user's device image does
9+
// depend on sycl bfloat16 device library functions.
10+
//===----------------------------------------------------------------------===//
11+
12+
#include "llvm/SYCLLowerIR/SYCLDeviceLibBF16.h"
13+
#include "llvm/ADT/SmallVector.h"
14+
#include "llvm/IR/Function.h"
15+
#include "llvm/IR/Module.h"
16+
#include "llvm/TargetParser/Triple.h"
17+
18+
static constexpr char DEVICELIB_FUNC_PREFIX[] = "__devicelib_";
19+
20+
using namespace llvm;
21+
22+
static llvm::SmallVector<StringRef, 14> BF16DeviceLibFuncs = {
23+
"__devicelib_ConvertFToBF16INTEL",
24+
"__devicelib_ConvertBF16ToFINTEL",
25+
"__devicelib_ConvertFToBF16INTELVec1",
26+
"__devicelib_ConvertBF16ToFINTELVec1",
27+
"__devicelib_ConvertFToBF16INTELVec2",
28+
"__devicelib_ConvertBF16ToFINTELVec2",
29+
"__devicelib_ConvertFToBF16INTELVec3",
30+
"__devicelib_ConvertBF16ToFINTELVec3",
31+
"__devicelib_ConvertFToBF16INTELVec4",
32+
"__devicelib_ConvertBF16ToFINTELVec4",
33+
"__devicelib_ConvertFToBF16INTELVec8",
34+
"__devicelib_ConvertBF16ToFINTELVec8",
35+
"__devicelib_ConvertFToBF16INTELVec16",
36+
"__devicelib_ConvertBF16ToFINTELVec16",
37+
};
38+
39+
bool llvm::isSYCLDeviceLibBF16Used(const Module &M) {
40+
if (!Triple(M.getTargetTriple()).isSPIROrSPIRV())
41+
return false;
42+
43+
for (auto Fn : BF16DeviceLibFuncs) {
44+
Function *BF16Func = M.getFunction(Fn);
45+
if (BF16Func && BF16Func->isDeclaration())
46+
return true;
47+
}
48+
49+
return false;
50+
}
51+
52+
bool llvm::isBF16DeviceLibFuncDecl(const Function &F) {
53+
if (!F.isDeclaration() || !F.getName().starts_with(DEVICELIB_FUNC_PREFIX))
54+
return false;
55+
for (auto BFunc : BF16DeviceLibFuncs) {
56+
if (!F.getName().compare(BFunc))
57+
return true;
58+
}
59+
60+
return false;
61+
}

0 commit comments

Comments
 (0)