Skip to content

Commit a675fa2

Browse files
authored
Merge branch 'intel:sycl' into int-buffers
2 parents a76d860 + 9ebbd0a commit a675fa2

36 files changed

+228
-10057
lines changed

.github/workflows/sycl-linux-build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ jobs:
204204
--ci-defaults --use-zstd ${{ inputs.build_configure_extra_args }} \
205205
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
206206
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
207-
-DLLVM_INSTALL_UTILS=ON
207+
-DLLVM_INSTALL_UTILS=ON \
208+
-DSYCL_UR_FORCE_FETCH_LEVEL_ZERO=ON
208209
- name: Compile
209210
id: build
210211
# Emulate default value for manual dispatch as we've run out of available arguments.

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13425,8 +13425,9 @@ def err_sycl_add_ir_attribute_invalid_filter : Error<
1342513425
"initializer list in the first argument of %0 must contain only string "
1342613426
"literals">;
1342713427
def warn_sycl_old_and_new_kernel_attributes : Warning<
13428-
"kernel has both attribute %0 and kernel properties; conflicting properties "
13429-
"are ignored">, InGroup<IgnoredAttributes>;
13428+
"kernel has both attribute %0 and kernel properties; if the kernel "
13429+
"properties contains the property \"%1\" it will be ignored">,
13430+
InGroup<IgnoredAttributes>;
1343013431
def err_attribute_argument_is_not_valid : Error<
1343113432
"%0 attribute requires integer constant value 0 or 1">;
1343213433

clang/lib/Sema/SemaSYCLDeclAttr.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,14 +3256,19 @@ void SemaSYCL::checkSYCLAddIRAttributesFunctionAttrConflicts(Decl *D) {
32563256
}
32573257

32583258
// If there are potentially conflicting attributes, we issue a warning.
3259-
for (const auto *Attr : std::vector<AttributeCommonInfo *>{
3260-
D->getAttr<SYCLReqdWorkGroupSizeAttr>(),
3261-
D->getAttr<IntelReqdSubGroupSizeAttr>(),
3262-
D->getAttr<SYCLWorkGroupSizeHintAttr>(),
3263-
D->getAttr<SYCLDeviceHasAttr>()})
3259+
for (const auto [Attr, PotentialConflictProp] :
3260+
std::vector<std::pair<AttributeCommonInfo *, StringRef>>{
3261+
{D->getAttr<SYCLReqdWorkGroupSizeAttr>(),
3262+
"sycl::ext::oneapi::experimental::work_group_size"},
3263+
{D->getAttr<IntelReqdSubGroupSizeAttr>(),
3264+
"sycl::ext::oneapi::experimental::sub_group_size"},
3265+
{D->getAttr<SYCLWorkGroupSizeHintAttr>(),
3266+
"sycl::ext::oneapi::experimental::work_group_size_hint"},
3267+
{D->getAttr<SYCLDeviceHasAttr>(),
3268+
"sycl::ext::oneapi::experimental::device_has"}})
32643269
if (Attr)
32653270
Diag(Attr->getLoc(), diag::warn_sycl_old_and_new_kernel_attributes)
3266-
<< Attr;
3271+
<< Attr << PotentialConflictProp;
32673272
}
32683273

32693274
void SemaSYCL::handleSYCLRegisteredKernels(Decl *D, const ParsedAttr &A) {

clang/test/SemaSYCL/attr-add-ir-attributes-function-conflict.cpp

Lines changed: 56 additions & 56 deletions
Large diffs are not rendered by default.

llvm/include/llvm/Support/PropertySetIO.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ class PropertySetRegistry {
216216
static constexpr char SYCL_KERNEL_PARAM_OPT_INFO[] = "SYCL/kernel param opt";
217217
static constexpr char SYCL_PROGRAM_METADATA[] = "SYCL/program metadata";
218218
static constexpr char SYCL_MISC_PROP[] = "SYCL/misc properties";
219-
static constexpr char SYCL_ASSERT_USED[] = "SYCL/assert used";
220219
static constexpr char SYCL_KERNEL_NAMES[] = "SYCL/kernel names";
221220
static constexpr char SYCL_EXPORTED_SYMBOLS[] = "SYCL/exported symbols";
222221
static constexpr char SYCL_IMPORTED_SYMBOLS[] = "SYCL/imported symbols";

llvm/lib/SYCLPostLink/ComputeModuleRuntimeInfo.cpp

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -57,85 +57,6 @@ bool isModuleUsingTsan(const Module &M) {
5757
return M.getNamedGlobal("__TsanKernelMetadata");
5858
}
5959

60-
// This function traverses over reversed call graph by BFS algorithm.
61-
// It means that an edge links some function @func with functions
62-
// which contain call of function @func. It starts from
63-
// @StartingFunction and lifts up until it reach all reachable functions,
64-
// or it reaches some function containing "referenced-indirectly" attribute.
65-
// If it reaches "referenced-indirectly" attribute than it returns an empty
66-
// Optional.
67-
// Otherwise, it returns an Optional containing a list of reached
68-
// SPIR kernel function's names.
69-
static std::optional<std::vector<StringRef>> traverseCGToFindSPIRKernels(
70-
const std::vector<Function *> &StartingFunctionVec) {
71-
std::queue<const Function *> FunctionsToVisit;
72-
std::unordered_set<const Function *> VisitedFunctions;
73-
for (const Function *FPtr : StartingFunctionVec)
74-
FunctionsToVisit.push(FPtr);
75-
std::vector<StringRef> KernelNames;
76-
77-
while (!FunctionsToVisit.empty()) {
78-
const Function *F = FunctionsToVisit.front();
79-
FunctionsToVisit.pop();
80-
81-
auto InsertionResult = VisitedFunctions.insert(F);
82-
// It is possible that we insert some particular function several
83-
// times in functionsToVisit queue.
84-
if (!InsertionResult.second)
85-
continue;
86-
87-
for (const auto *U : F->users()) {
88-
const CallInst *CI = dyn_cast<const CallInst>(U);
89-
if (!CI)
90-
continue;
91-
92-
const Function *ParentF = CI->getFunction();
93-
94-
if (VisitedFunctions.count(ParentF))
95-
continue;
96-
97-
if (ParentF->hasFnAttribute("referenced-indirectly"))
98-
return {};
99-
100-
if (ParentF->getCallingConv() == CallingConv::SPIR_KERNEL)
101-
KernelNames.push_back(ParentF->getName());
102-
103-
FunctionsToVisit.push(ParentF);
104-
}
105-
}
106-
107-
return {std::move(KernelNames)};
108-
}
109-
110-
static std::vector<StringRef>
111-
getKernelNamesUsingSpecialFunctions(const Module &M,
112-
const std::vector<StringRef> &FNames) {
113-
std::vector<Function *> SpecialFunctionVec;
114-
for (const auto Fn : FNames) {
115-
Function *FPtr = M.getFunction(Fn);
116-
if (FPtr)
117-
SpecialFunctionVec.push_back(FPtr);
118-
}
119-
120-
if (SpecialFunctionVec.size() == 0)
121-
return {};
122-
123-
auto TraverseResult = traverseCGToFindSPIRKernels(SpecialFunctionVec);
124-
125-
if (TraverseResult.has_value())
126-
return std::move(*TraverseResult);
127-
128-
// Here we reached "referenced-indirectly", so we need to find all kernels and
129-
// return them.
130-
std::vector<StringRef> SPIRKernelNames;
131-
for (const Function &F : M) {
132-
if (F.getCallingConv() == CallingConv::SPIR_KERNEL)
133-
SPIRKernelNames.push_back(F.getName());
134-
}
135-
136-
return SPIRKernelNames;
137-
}
138-
13960
// Gets 1- to 3-dimension work-group related information for function Func.
14061
// Returns an empty vector if not present.
14162
template <typename T>
@@ -449,13 +370,6 @@ PropSetRegTy computeModuleProperties(const Module &M,
449370
if (OptLevel != -1)
450371
PropSet.add(PropSetRegTy::SYCL_MISC_PROP, "optLevel", OptLevel);
451372
}
452-
{
453-
std::vector<StringRef> AssertFuncNames{"__devicelib_assert_fail"};
454-
std::vector<StringRef> FuncNames =
455-
getKernelNamesUsingSpecialFunctions(M, AssertFuncNames);
456-
for (const StringRef &FName : FuncNames)
457-
PropSet.add(PropSetRegTy::SYCL_ASSERT_USED, FName, true);
458-
}
459373
{
460374
std::vector<std::pair<StringRef, int>> ArgPos =
461375
getKernelNamesUsingImplicitLocalMem(M);

llvm/lib/Support/PropertySetIO.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ constexpr char PropertySetRegistry::SYCL_SPEC_CONSTANTS_DEFAULT_VALUES[];
200200
constexpr char PropertySetRegistry::SYCL_KERNEL_PARAM_OPT_INFO[];
201201
constexpr char PropertySetRegistry::SYCL_PROGRAM_METADATA[];
202202
constexpr char PropertySetRegistry::SYCL_MISC_PROP[];
203-
constexpr char PropertySetRegistry::SYCL_ASSERT_USED[];
204203
constexpr char PropertySetRegistry::SYCL_KERNEL_NAMES[];
205204
constexpr char PropertySetRegistry::SYCL_EXPORTED_SYMBOLS[];
206205
constexpr char PropertySetRegistry::SYCL_IMPORTED_SYMBOLS[];

llvm/test/tools/sycl-post-link/assert/indirect-with-split-2.ll

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

0 commit comments

Comments
 (0)