Skip to content

Commit 27b88f5

Browse files
committed
[SYCL] Implement review comments for PR #1454.
Signed-off-by: Konstantin S Bobrovsky <konstantin.s.bobrovsky@intel.com>
1 parent 67a5e37 commit 27b88f5

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

llvm/test/tools/sycl-post-link/sym_but_no_split.ll

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
; table and a symbol file for an input module with two kernels when no code
33
; splitting is requested.
44
;
5-
; RUN: sycl-post-link -symbols -spec-const=rt -S %s -o %T/files.table
6-
; RUN: FileCheck %s -input-file=%T/files.table --check-prefixes CHECK-TABLE
7-
; RUN: FileCheck %s -input-file=%T/files_0.sym --match-full-lines --check-prefixes CHECK-SYM
5+
; RUN: sycl-post-link -symbols -spec-const=rt -S %s -o %t.files.table
6+
; RUN: FileCheck %s -input-file=%t.files.table --check-prefixes CHECK-TABLE
7+
; RUN: FileCheck %s -input-file=%t.files_0.sym --match-full-lines --check-prefixes CHECK-SYM
88

99
define dso_local spir_kernel void @KERNEL_AAA() {
1010
; CHECK-SYM-NOT: {{[a-zA-Z0-9._@]+}}

llvm/tools/sycl-post-link/sycl-post-link.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,19 @@ static void writeToFile(std::string Filename, std::string Content) {
122122
}
123123

124124
// Describes scope covered by each entry in the module-kernel map populated by
125-
// the function below.
125+
// the collectKernelModuleMap function.
126126
enum KernelMapEntryScope {
127127
Scope_PerKernel, // one entry per kernel
128128
Scope_PerModule, // one entry per module
129129
Scope_Global // single entry in the map for all kernels
130130
};
131131

132-
// Output parameter ResKernelModuleMap is a map containing groups of kernels
133-
// with same values of the sycl-module-id attribute.
134-
// The function fills ResKernelModuleMap using input module M.
132+
// This function decides how kernels of the input module M will be distributed
133+
// ("split") into multiple modules based on the command options and IR
134+
// attributes. The desision is recorded in the output map parameter
135+
// ResKernelModuleMap which maps some key to a group of kernels. Each such group
136+
// along with IR it depends on (globals, functions from its call graph,...) will
137+
// constitute a separate module.
135138
static void collectKernelModuleMap(
136139
Module &M, std::map<StringRef, std::vector<Function *>> &ResKernelModuleMap,
137140
KernelMapEntryScope EntryScope) {
@@ -145,6 +148,9 @@ static void collectKernelModuleMap(
145148
case Scope_PerModule: {
146149
constexpr char ATTR_SYCL_MODULE_ID[] = "sycl-module-id";
147150

151+
// TODO It may make sense to group all kernels w/o the attribute into
152+
// a separate module rather than issuing an error. Should probably be
153+
// controlled by an option.
148154
if (!F.hasFnAttribute(ATTR_SYCL_MODULE_ID))
149155
error("no '" + Twine(ATTR_SYCL_MODULE_ID) +
150156
"' attribute in kernel '" + F.getName() +

0 commit comments

Comments
 (0)