Skip to content

Commit d2178e0

Browse files
committed
Distinction between compilation ID and prefix is no longer necessary.
Signed-off-by: Julian Oppermann <[email protected]>
1 parent a365b7f commit d2178e0

File tree

5 files changed

+19
-20
lines changed

5 files changed

+19
-20
lines changed

sycl/source/detail/jit_compiler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ sycl_device_binaries jit_compiler::createPIDeviceBinary(
11421142

11431143
sycl_device_binaries jit_compiler::createDeviceBinaryImage(
11441144
const ::jit_compiler::RTCBundleInfo &BundleInfo,
1145-
const std::string &OffloadEntryPrefix) {
1145+
const std::string &Prefix) {
11461146
DeviceBinariesCollection Collection;
11471147

11481148
for (const auto &DevImgInfo : BundleInfo) {
@@ -1153,7 +1153,7 @@ sycl_device_binaries jit_compiler::createDeviceBinaryImage(
11531153
// entrypoints remain unchanged.
11541154
// It seems to be OK to set zero for most of the information here, at
11551155
// least that is the case for compiled SPIR-V binaries.
1156-
std::string PrefixedName = OffloadEntryPrefix + Symbol.c_str();
1156+
std::string PrefixedName = Prefix + Symbol.c_str();
11571157
OffloadEntryContainer Entry{PrefixedName, /*Addr=*/nullptr, /*Size=*/0,
11581158
/*Flags=*/0, /*Reserved=*/0};
11591159
Binary.addOffloadEntry(std::move(Entry));
@@ -1236,10 +1236,11 @@ std::vector<uint8_t> jit_compiler::encodeReqdWorkGroupSize(
12361236
}
12371237

12381238
sycl_device_binaries jit_compiler::compileSYCL(
1239-
const std::string &CompilationID, const std::string &SYCLSource,
1239+
const std::string &SYCLSource,
12401240
const std::vector<std::pair<std::string, std::string>> &IncludePairs,
12411241
const std::vector<std::string> &UserArgs, std::string *LogPtr,
1242-
const std::vector<std::string> &RegisteredKernelNames) {
1242+
const std::vector<std::string> &RegisteredKernelNames,
1243+
const std::string &Prefix) {
12431244
auto appendToLog = [LogPtr](const char *Msg) {
12441245
if (LogPtr) {
12451246
LogPtr->append(Msg);
@@ -1309,8 +1310,7 @@ sycl_device_binaries jit_compiler::compileSYCL(
13091310
PersistentDeviceCodeCache::putDeviceCodeIRToDisc(CacheKey, SavedIR);
13101311
}
13111312

1312-
return createDeviceBinaryImage(Result.getBundleInfo(),
1313-
/*OffloadEntryPrefix=*/CompilationID + '$');
1313+
return createDeviceBinaryImage(Result.getBundleInfo(), Prefix);
13141314
}
13151315

13161316
} // namespace detail

sycl/source/detail/jit_compiler.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ class jit_compiler {
4848
const std::vector<unsigned char> &SpecConstBlob);
4949

5050
sycl_device_binaries compileSYCL(
51-
const std::string &CompilationID, const std::string &SYCLSource,
51+
const std::string &SYCLSource,
5252
const std::vector<std::pair<std::string, std::string>> &IncludePairs,
5353
const std::vector<std::string> &UserArgs, std::string *LogPtr,
54-
const std::vector<std::string> &RegisteredKernelNames);
54+
const std::vector<std::string> &RegisteredKernelNames,
55+
const std::string &Prefix);
5556

5657
bool isAvailable() { return Available; }
5758

@@ -74,7 +75,7 @@ class jit_compiler {
7475

7576
sycl_device_binaries
7677
createDeviceBinaryImage(const ::jit_compiler::RTCBundleInfo &BundleInfo,
77-
const std::string &OffloadEntryPrefix);
78+
const std::string &Prefix);
7879

7980
std::vector<uint8_t>
8081
encodeArgUsageMask(const ::jit_compiler::ArgUsageMask &Mask) const;

sycl/source/detail/kernel_bundle_impl.hpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ class kernel_bundle_impl {
497497
if (MLanguage == syclex::source_language::sycl_jit) {
498498
// Build device images via the program manager.
499499
const std::string &SourceStr = std::get<std::string>(MSource);
500-
auto [Binaries, CompilationID] = syclex::detail::SYCL_JIT_to_SPIRV(
500+
auto [Binaries, Prefix] = syclex::detail::SYCL_JIT_to_SPIRV(
501501
SourceStr, MIncludePairs, BuildOptions, LogPtr,
502502
RegisteredKernelNames);
503503

@@ -506,9 +506,6 @@ class kernel_bundle_impl {
506506

507507
std::vector<kernel_id> KernelIDs;
508508
std::vector<std::string> KernelNames;
509-
// `jit_compiler::compileSYCL(..)` uses `CompilationID + '$'` as prefix
510-
// for offload entry names.
511-
std::string Prefix = CompilationID + '$';
512509
for (const auto &KernelID : PM.getAllSYCLKernelIDs()) {
513510
std::string_view KernelName{KernelID.get_name()};
514511
if (KernelName.find(Prefix) == 0) {

sycl/source/detail/kernel_compiler/kernel_compiler_sycl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,18 +305,18 @@ bool SYCL_JIT_Compilation_Available() {
305305

306306
std::pair<sycl_device_binaries, std::string> SYCL_JIT_to_SPIRV(
307307
[[maybe_unused]] const std::string &SYCLSource,
308-
[[maybe_unused]] include_pairs_t IncludePairs,
308+
[[maybe_unused]] const include_pairs_t& IncludePairs,
309309
[[maybe_unused]] const std::vector<std::string> &UserArgs,
310310
[[maybe_unused]] std::string *LogPtr,
311311
[[maybe_unused]] const std::vector<std::string> &RegisteredKernelNames) {
312312
#if SYCL_EXT_JIT_ENABLE
313-
static std::atomic_uintptr_t CompilationCounter;
314-
std::string CompilationID = "rtc_" + std::to_string(CompilationCounter++);
313+
static std::atomic_uintptr_t CompilationID;
314+
std::string Prefix = "rtc_" + std::to_string(CompilationID++) + "$";
315315
sycl_device_binaries Binaries =
316316
sycl::detail::jit_compiler::get_instance().compileSYCL(
317-
CompilationID, SYCLSource, IncludePairs, UserArgs, LogPtr,
318-
RegisteredKernelNames);
319-
return std::make_pair(Binaries, std::move(CompilationID));
317+
SYCLSource, IncludePairs, UserArgs, LogPtr,
318+
RegisteredKernelNames, Prefix);
319+
return std::make_pair(Binaries, std::move(Prefix));
320320
#else
321321
throw sycl::exception(sycl::errc::build,
322322
"kernel_compiler via sycl-jit is not available");

sycl/source/detail/kernel_compiler/kernel_compiler_sycl.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ std::string userArgsAsString(const std::vector<std::string> &UserArguments);
4141
// Returns a pointer to the image (owned by the `jit_compiler` class), and the
4242
// bundle-specific prefix used for loading the kernels.
4343
std::pair<sycl_device_binaries, std::string>
44-
SYCL_JIT_to_SPIRV(const std::string &Source, include_pairs_t IncludePairs,
44+
SYCL_JIT_to_SPIRV(const std::string &Source,
45+
const include_pairs_t &IncludePairs,
4546
const std::vector<std::string> &UserArgs, std::string *LogPtr,
4647
const std::vector<std::string> &RegisteredKernelNames);
4748

0 commit comments

Comments
 (0)