Skip to content

Commit 3b227b1

Browse files
[SYCL] Drop kernel name type backward compatibility (#20713)
1 parent 306a781 commit 3b227b1

33 files changed

+88
-150
lines changed

sycl/include/sycl/detail/kernel_name_str_t.hpp

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

sycl/include/sycl/handler.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <sycl/detail/impl_utils.hpp>
2020
#include <sycl/detail/kernel_desc.hpp>
2121
#include <sycl/detail/kernel_launch_helper.hpp>
22-
#include <sycl/detail/kernel_name_str_t.hpp>
2322
#include <sycl/detail/reduction_forward.hpp>
2423
#include <sycl/detail/string.hpp>
2524
#include <sycl/detail/string_view.hpp>
@@ -2795,7 +2794,9 @@ class __SYCL_EXPORT handler {
27952794
detail::handler_impl *impl;
27962795
std::vector<detail::LocalAccessorImplPtr> MLocalAccStorage;
27972796
std::vector<std::shared_ptr<detail::stream_impl>> MStreamStorage;
2798-
detail::ABINeutralKernelNameStrT MKernelName;
2797+
// std::string_view ABI differs under `-D_GLIBCXX_USE_CXX11_ABI=0`,
2798+
// use our implementation instead.
2799+
detail::string_view MKernelName;
27992800
/// Storage for a sycl::kernel object.
28002801
std::shared_ptr<detail::kernel_impl> MKernel;
28012802
/// Pointer to the source host memory or accessor(depending on command type).

sycl/source/detail/device_global_map.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
#pragma once
1010

1111
#include <mutex>
12+
#include <string_view>
1213
#include <unordered_map>
1314

1415
#include <detail/compiler.hpp>
1516
#include <detail/device_binary_image.hpp>
1617
#include <detail/device_global_map_entry.hpp>
1718
#include <sycl/detail/defines_elementary.hpp>
18-
#include <sycl/detail/kernel_name_str_t.hpp>
1919
#include <sycl/kernel_bundle.hpp>
2020

2121
namespace sycl {
@@ -161,7 +161,7 @@ class DeviceGlobalMap {
161161

162162
size_t size() const { return MDeviceGlobals.size(); }
163163

164-
size_t count(const KernelNameStrT &UniqueId) const {
164+
size_t count(std::string_view UniqueId) const {
165165
return MDeviceGlobals.count(UniqueId);
166166
}
167167

@@ -173,7 +173,7 @@ class DeviceGlobalMap {
173173
bool MOwnerControlledCleanup = true;
174174

175175
// Maps between device_global identifiers and associated information.
176-
std::unordered_map<KernelNameStrT, std::unique_ptr<DeviceGlobalMapEntry>>
176+
std::unordered_map<std::string_view, std::unique_ptr<DeviceGlobalMapEntry>>
177177
MDeviceGlobals;
178178
std::unordered_map<const void *, DeviceGlobalMapEntry *> MPtr2DeviceGlobal;
179179

sycl/source/detail/device_image_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ std::shared_ptr<kernel_impl> device_image_impl::tryGetExtensionKernel(
3232

3333
auto UrProgram = get_ur_program();
3434
auto [UrKernel, CacheMutex, ArgMask] =
35-
PM.getOrCreateKernel(Context, KernelNameStrT(AdjustedName),
35+
PM.getOrCreateKernel(Context, AdjustedName,
3636
/*PropList=*/{}, UrProgram);
3737
return std::make_shared<kernel_impl>(
3838
std::move(UrKernel), *getSyclObjImpl(Context), shared_from_this(),

sycl/source/detail/device_kernel_info.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,11 @@ inline namespace _V1 {
1313
namespace detail {
1414

1515
DeviceKernelInfo::DeviceKernelInfo(const CompileTimeKernelInfoTy &Info)
16-
: CompileTimeKernelInfoTy(Info)
17-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
18-
,
19-
Name(Info.Name.data())
20-
#endif
21-
{
16+
: CompileTimeKernelInfoTy(Info) {
2217
init(Name.data());
2318
}
2419

25-
void DeviceKernelInfo::init(KernelNameStrRefT KernelName) {
20+
void DeviceKernelInfo::init(std::string_view KernelName) {
2621
auto &PM = detail::ProgramManager::getInstance();
2722
MImplicitLocalArgPos = PM.kernelImplicitLocalArgPos(KernelName);
2823
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES

sycl/source/detail/device_kernel_info.hpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
#include <detail/kernel_arg_mask.hpp>
1212
#include <hash_table8.hpp>
1313
#include <sycl/detail/compile_time_kernel_info.hpp>
14-
#include <sycl/detail/kernel_name_str_t.hpp>
1514
#include <sycl/detail/spinlock.hpp>
1615
#include <sycl/detail/ur.hpp>
1716

1817
#include <mutex>
1918
#include <optional>
19+
#include <string_view>
2020

2121
namespace sycl {
2222
inline namespace _V1 {
@@ -89,18 +89,12 @@ struct FastKernelSubcacheT {
8989
// into this structure and get rid of the other KernelName -> * maps.
9090
class DeviceKernelInfo : public CompileTimeKernelInfoTy {
9191
public:
92-
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
93-
// Needs to own the kernel name string in non-preview builds since we pass it
94-
// using a temporary string instead of a string view there.
95-
std::string Name;
96-
#endif
97-
9892
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
9993
DeviceKernelInfo() = default;
10094
#endif
10195
DeviceKernelInfo(const CompileTimeKernelInfoTy &Info);
10296

103-
void init(KernelNameStrRefT KernelName);
97+
void init(std::string_view KernelName);
10498
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
10599
// Initialize default-created entry that has no data recorded:
106100
void initIfEmpty(const CompileTimeKernelInfoTy &Info);

sycl/source/detail/handler_impl.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ class handler_impl {
6161
HandlerSubmissionState::EXPLICIT_KERNEL_BUNDLE_STATE;
6262
}
6363

64-
KernelNameStrRefT getKernelName() const {
65-
return MKernelData.getKernelName();
66-
}
64+
std::string_view getKernelName() const { return MKernelData.getKernelName(); }
6765

6866
/// Registers mutually exclusive submission states.
6967
HandlerSubmissionState MSubmissionState = HandlerSubmissionState::NO_STATE;

sycl/source/detail/helpers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ __SYCL_EXPORT void waitEvents(std::vector<sycl::event> DepEvents) {
3535
#endif
3636

3737
const RTDeviceBinaryImage *retrieveKernelBinary(queue_impl &Queue,
38-
KernelNameStrRefT KernelName,
38+
std::string_view KernelName,
3939
CGExecKernel *KernelCG) {
4040
device_impl &Dev = Queue.getDeviceImpl();
4141
bool isNvidia = Dev.getBackend() == backend::ext_oneapi_cuda;

sycl/source/detail/helpers.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#pragma once
1010

1111
#include <sycl/detail/impl_utils.hpp>
12-
#include <sycl/detail/kernel_name_str_t.hpp>
1312
#include <sycl/detail/type_traits.hpp>
1413

1514
#include <ur_api.h>
@@ -18,6 +17,7 @@
1817
#include <iterator>
1918
#include <memory>
2019
#include <queue>
20+
#include <string_view>
2121
#include <tuple>
2222
#include <variant>
2323
#include <vector>
@@ -32,7 +32,7 @@ class queue_impl;
3232
class RTDeviceBinaryImage;
3333

3434
const RTDeviceBinaryImage *
35-
retrieveKernelBinary(queue_impl &Queue, KernelNameStrRefT KernelName,
35+
retrieveKernelBinary(queue_impl &Queue, std::string_view KernelName,
3636
CGExecKernel *CGKernel = nullptr);
3737

3838
template <typename SyclTy, typename... Iterators> class variadic_iterator {

sycl/source/detail/jit_compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static ::jit_compiler::BinaryFormat getTargetFormat(queue_impl &Queue) {
144144

145145
ur_kernel_handle_t jit_compiler::materializeSpecConstants(
146146
queue_impl &Queue, const RTDeviceBinaryImage *BinImage,
147-
KernelNameStrRefT KernelName,
147+
std::string_view KernelName,
148148
const std::vector<unsigned char> &SpecConstBlob) {
149149
#ifndef _WIN32
150150
if (!BinImage) {

0 commit comments

Comments
 (0)