Skip to content

Commit ca2285e

Browse files
[NFC][SYCL] Remove ContextImplPtr type alias (#19179)
With most of the `context_impl` passed by raw ptr/ref it's not increasing readability anymore.
1 parent 1a26508 commit ca2285e

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

sycl/include/sycl/interop_handle.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ class interop_handle {
205205
friend class detail::DispatchHostTask;
206206
using ReqToMem = std::pair<detail::AccessorImplHost *, ur_mem_handle_t>;
207207

208+
#ifdef __INTEL_PREVIEW_BREAKING_CHANGES
209+
// Clean this up (no shared pointers). Not doing it right now because I expect
210+
// there will be several iterations of simplifications possible and it would
211+
// be hard to track which of them made their way into a minor public release
212+
// and which didn't. Let's just clean it up once during ABI breaking window.
213+
#endif
208214
interop_handle(std::vector<ReqToMem> MemObjs,
209215
const std::shared_ptr<detail::queue_impl> &Queue,
210216
const std::shared_ptr<detail::device_impl> &Device,

sycl/source/detail/event_impl.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class context;
2929
namespace detail {
3030
class adapter_impl;
3131
class context_impl;
32-
using ContextImplPtr = std::shared_ptr<sycl::detail::context_impl>;
3332
class queue_impl;
3433
class event_impl;
3534
using EventImplPtr = std::shared_ptr<sycl::detail::event_impl>;
@@ -388,7 +387,7 @@ class event_impl {
388387
std::atomic<ur_event_handle_t> MEvent = nullptr;
389388
// Stores submission time of command associated with event
390389
uint64_t MSubmitTime = 0;
391-
ContextImplPtr MContext;
390+
std::shared_ptr<context_impl> MContext;
392391
std::unique_ptr<HostProfilingInfo> MHostProfilingInfo;
393392
void *MCommand = nullptr;
394393
std::weak_ptr<queue_impl> MQueue;

sycl/source/detail/global_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ ProgramManager &GlobalHandler::getProgramManager() {
185185
return PM;
186186
}
187187

188-
std::unordered_map<platform_impl *, ContextImplPtr> &
188+
std::unordered_map<platform_impl *, std::shared_ptr<context_impl>> &
189189
GlobalHandler::getPlatformToDefaultContextCache() {
190190
// The optimization with static reference is not done because
191191
// there are public methods of the GlobalHandler

sycl/source/detail/global_handler.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ class XPTIRegistry;
2929
class ThreadPool;
3030
struct KernelNameBasedCacheT;
3131

32-
using ContextImplPtr = std::shared_ptr<context_impl>;
33-
3432
/// Wrapper class for global data structures with non-trivial destructors.
3533
///
3634
/// As user code can call SYCL Runtime functions from destructor of global
@@ -64,7 +62,7 @@ class GlobalHandler {
6462

6563
void clearPlatforms();
6664

67-
std::unordered_map<platform_impl *, ContextImplPtr> &
65+
std::unordered_map<platform_impl *, std::shared_ptr<context_impl>> &
6866
getPlatformToDefaultContextCache();
6967

7068
std::mutex &getPlatformToDefaultContextCacheMutex();
@@ -120,7 +118,8 @@ class GlobalHandler {
120118
InstWithLock<ProgramManager> MProgramManager;
121119
InstWithLock<Sync> MSync;
122120
InstWithLock<std::vector<std::shared_ptr<platform_impl>>> MPlatformCache;
123-
InstWithLock<std::unordered_map<platform_impl *, ContextImplPtr>>
121+
InstWithLock<
122+
std::unordered_map<platform_impl *, std::shared_ptr<context_impl>>>
124123
MPlatformToDefaultContextCache;
125124
InstWithLock<std::mutex> MPlatformToDefaultContextCacheMutex;
126125
InstWithLock<std::mutex> MPlatformMapMutex;

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ namespace sycl {
4949
inline namespace _V1 {
5050
namespace detail {
5151

52-
using ContextImplPtr = std::shared_ptr<sycl::detail::context_impl>;
53-
5452
static constexpr int DbgProgMgr = 0;
5553

5654
static constexpr char UseSpvEnv[]("SYCL_USE_KERNEL_SPV");

sycl/source/detail/program_manager/program_manager.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ bool doesImageTargetMatchDevice(const RTDeviceBinaryImage &Img,
7272
static constexpr uint32_t inline ITTSpecConstId = 0xFF747469;
7373

7474
class context_impl;
75-
using ContextImplPtr = std::shared_ptr<context_impl>;
7675
class device_impl;
7776
class queue_impl;
7877
class event_impl;

sycl/source/detail/queue_impl.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ class node_impl;
5151

5252
namespace detail {
5353

54-
using ContextImplPtr = std::shared_ptr<detail::context_impl>;
55-
5654
/// Sets max number of queues supported by FPGA RT.
5755
static constexpr size_t MaxNumQueues = 256;
5856

@@ -289,7 +287,11 @@ class queue_impl : public std::enable_shared_from_this<queue_impl> {
289287

290288
const AdapterPtr &getAdapter() const { return MContext->getAdapter(); }
291289

292-
const ContextImplPtr &getContextImplPtr() const { return MContext; }
290+
#ifndef __INTEL_PREVIEW_BREAKING_CHANGES
291+
const std::shared_ptr<context_impl> &getContextImplPtr() const {
292+
return MContext;
293+
}
294+
#endif
293295

294296
context_impl &getContextImpl() const { return *MContext; }
295297

0 commit comments

Comments
 (0)