Skip to content

Commit 0084ac5

Browse files
[SYCL] Revert m_ExportedSymbolImages key type back to a string (#19478)
It was changed to a string view in preview builds of the library under the assumption that such strings are always owned by one of the loaded images. Bfloat16 device library images are an exception to that rule, where the dynamic device binary image ends up using a reference to the string from another binary. If that binary is unloaded, the string view keys will be invalidated. Since this particular map lies outside of the kernel submission hotpath (and it's the only one with a string view key type that gets filled out for bfloat16 device binary images), this patch just reverts the key type back to a string.
1 parent bd13f18 commit 0084ac5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

sycl/source/detail/program_manager/program_manager.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,9 +464,11 @@ class ProgramManager {
464464
m_ServiceKernels;
465465

466466
/// Caches all exported symbols to allow faster lookup when excluding these
467-
// from kernel bundles.
467+
/// from kernel bundles.
468468
/// Access must be guarded by the m_KernelIDsMutex mutex.
469-
std::unordered_multimap<KernelNameStrT, const RTDeviceBinaryImage *>
469+
/// Owns its keys to support the bfloat16 use case with dynamic images,
470+
/// where the symbol is taken from another image (that might be unloaded).
471+
std::unordered_multimap<std::string, const RTDeviceBinaryImage *>
470472
m_ExportedSymbolImages;
471473

472474
/// Keeps all device images we are refering to during program lifetime. Used

sycl/unittests/program_manager/Cleanup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ProgramManagerExposed : public sycl::detail::ProgramManager {
3535
return m_ServiceKernels;
3636
}
3737

38-
std::unordered_multimap<sycl::detail::KernelNameStrT,
38+
std::unordered_multimap<std::string,
3939
const sycl::detail::RTDeviceBinaryImage *> &
4040
getExportedSymbolImages() {
4141
return m_ExportedSymbolImages;

0 commit comments

Comments
 (0)