@@ -64,16 +64,6 @@ ProgramManager &ProgramManager::getInstance() {
64
64
return GlobalHandler::instance ().getProgramManager ();
65
65
}
66
66
67
- // This function allows for identifying "service" kernels. A SYCL service kernel
68
- // is a kernel that has not been defined by the user but is instead generated by
69
- // the SYCL runtime. Service kernel name types must be declared in the
70
- // sycl::detail::__sycl_service_kernel__ namespace which is exclusively used for
71
- // this purpose. As such service kernels can be identified by
72
- // __sycl_service_kernel__ appearing in the mangled kernel name.
73
- static bool isServiceKernel (const std::string &KernelName) {
74
- return KernelName.find (" __sycl_service_kernel__" ) != std::string::npos;
75
- }
76
-
77
67
static RT::PiProgram
78
68
createBinaryProgram (const ContextImplPtr Context, const device &Device,
79
69
const unsigned char *Data, size_t DataLen,
@@ -1055,9 +1045,14 @@ void ProgramManager::addImages(pi_device_binaries DeviceBinary) {
1055
1045
(void )Result;
1056
1046
assert (Result.second && " Kernel sets are not disjoint" );
1057
1047
1058
- // Skip creating unique kernel ID if it is a service kernel
1059
- if (isServiceKernel (EntriesIt->name ))
1048
+ // Skip creating unique kernel ID if it is a service kernel.
1049
+ // SYCL service kernels are identified by having
1050
+ // __sycl_service_kernel__ in the mangled name, primarily as part of
1051
+ // the namespace of the name type.
1052
+ if (std::strstr (EntriesIt->name , " __sycl_service_kernel__" )) {
1053
+ m_ServiceKernels.insert (EntriesIt->name );
1060
1054
continue ;
1055
+ }
1061
1056
1062
1057
// ... and create a unique kernel ID for the entry
1063
1058
std::shared_ptr<detail::kernel_id_impl> KernelIDImpl =
@@ -1351,7 +1346,8 @@ ProgramManager::getSYCLDeviceImagesWithCompatibleState(
1351
1346
1352
1347
if (KernelID == m_KernelIDs.end ()) {
1353
1348
// Service kernels do not have kernel IDs
1354
- assert (isServiceKernel (EntriesIt->name ) &&
1349
+ assert (m_ServiceKernels.find (EntriesIt->name ) !=
1350
+ m_ServiceKernels.end () &&
1355
1351
" Kernel ID in device binary missing from cache" );
1356
1352
continue ;
1357
1353
}
0 commit comments