Skip to content

Commit b7d9ea9

Browse files
[SYCL][NFC] Rename Adapter to adapter_impl (#19184)
So that we could do `adapter_impl &Adapter = getAdapter(...);` without breaking naming convention for variables. Also aligns with other `*_impl` classes, e.g. `adapter_impl/ur_adapter_handle_t` is similar to `device_impl/ur_device_handle_t`.
1 parent ec60ea6 commit b7d9ea9

23 files changed

+47
-47
lines changed

sycl/source/backend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "detail/adapter.hpp"
9+
#include "detail/adapter_impl.hpp"
1010
#include "detail/context_impl.hpp"
1111
#include "detail/event_impl.hpp"
1212
#include "detail/kernel_bundle_impl.hpp"

sycl/source/backend/level_zero.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <detail/adapter.hpp>
9+
#include <detail/adapter_impl.hpp>
1010
#include <detail/platform_impl.hpp>
1111
#include <detail/queue_impl.hpp>
1212
#include <detail/ur.hpp>

sycl/source/backend/opencl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <detail/adapter.hpp>
9+
#include <detail/adapter_impl.hpp>
1010
#include <detail/kernel_impl.hpp>
1111
#include <detail/platform_impl.hpp>
1212
#include <detail/queue_impl.hpp>

sycl/source/detail/adapter.hpp renamed to sycl/source/detail/adapter_impl.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==- adapter.hpp ----------------------------------------------------------==//
1+
//==- adapter_impl.hpp ----------------------------------------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -42,11 +42,11 @@ namespace detail {
4242
/// runtimes for the device-agnostic SYCL runtime.
4343
///
4444
/// \ingroup sycl_ur
45-
class Adapter {
45+
class adapter_impl {
4646
public:
47-
Adapter() = delete;
47+
adapter_impl() = delete;
4848

49-
Adapter(ur_adapter_handle_t adapter, backend UseBackend)
49+
adapter_impl(ur_adapter_handle_t adapter, backend UseBackend)
5050
: MAdapter(adapter), MBackend(UseBackend),
5151
MAdapterMutex(std::make_shared<std::mutex>()) {
5252

@@ -57,12 +57,12 @@ class Adapter {
5757
}
5858

5959
// Disallow accidental copies of adapters
60-
Adapter &operator=(const Adapter &) = delete;
61-
Adapter(const Adapter &) = delete;
62-
Adapter &operator=(Adapter &&other) noexcept = delete;
63-
Adapter(Adapter &&other) noexcept = delete;
60+
adapter_impl &operator=(const adapter_impl &) = delete;
61+
adapter_impl(const adapter_impl &) = delete;
62+
adapter_impl &operator=(adapter_impl &&other) noexcept = delete;
63+
adapter_impl(adapter_impl &&other) noexcept = delete;
6464

65-
~Adapter() = default;
65+
~adapter_impl() = default;
6666

6767
/// \throw SYCL 2020 exception(errc) if ur_result is not UR_RESULT_SUCCESS
6868
template <sycl::errc errc = sycl::errc::runtime>
@@ -237,7 +237,7 @@ class Adapter {
237237
void *UrLoaderHandle = nullptr;
238238
#endif
239239
UrFuncPtrMapT UrFuncPtrs;
240-
}; // class Adapter
240+
}; // class adapter_impl
241241

242242
} // namespace detail
243243
} // namespace _V1

sycl/source/detail/allowlist.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <detail/adapter.hpp>
11+
#include <detail/adapter_impl.hpp>
1212
#include <sycl/detail/defines_elementary.hpp>
1313
#include <sycl/detail/ur.hpp>
1414

sycl/source/detail/device_image_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <detail/adapter.hpp>
11+
#include <detail/adapter_impl.hpp>
1212
#include <detail/compiler.hpp>
1313
#include <detail/context_impl.hpp>
1414
#include <detail/device_impl.hpp>

sycl/source/detail/error_handling/error_handling.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "error_handling.hpp"
1414
#include "sycl/detail/common.hpp"
1515

16-
#include <detail/adapter.hpp>
16+
#include <detail/adapter_impl.hpp>
1717
#include <sycl/backend_types.hpp>
1818
#include <sycl/detail/ur.hpp>
1919

sycl/source/detail/event_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <detail/adapter.hpp>
9+
#include <detail/adapter_impl.hpp>
1010
#include <detail/event_impl.hpp>
1111
#include <detail/event_info.hpp>
1212
#include <detail/queue_impl.hpp>

sycl/source/detail/event_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <detail/adapter.hpp>
11+
#include <detail/adapter_impl.hpp>
1212
#include <sycl/detail/cl.h>
1313
#include <sycl/detail/common.hpp>
1414
#include <sycl/detail/host_profiling_info.hpp>
@@ -27,7 +27,7 @@ class graph_impl;
2727
}
2828
class context;
2929
namespace detail {
30-
class Adapter;
30+
class adapter_impl;
3131
class context_impl;
3232
using ContextImplPtr = std::shared_ptr<sycl::detail::context_impl>;
3333
class queue_impl;

sycl/source/detail/event_info.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <detail/adapter.hpp>
11+
#include <detail/adapter_impl.hpp>
1212
#include <detail/event_impl.hpp>
1313
#include <detail/ur_info_code.hpp>
1414
#include <sycl/detail/common.hpp>

sycl/source/detail/global_handler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "llvm/Support/Signals.h"
1212
#endif
1313

14-
#include <detail/adapter.hpp>
14+
#include <detail/adapter_impl.hpp>
1515
#include <detail/config.hpp>
1616
#include <detail/global_handler.hpp>
1717
#include <detail/kernel_name_based_cache_t.hpp>
@@ -230,8 +230,8 @@ std::mutex &GlobalHandler::getFilterMutex() {
230230
return FilterMutex;
231231
}
232232

233-
std::vector<Adapter *> &GlobalHandler::getAdapters() {
234-
static std::vector<Adapter *> &adapters = getOrCreate(MAdapters);
233+
std::vector<adapter_impl *> &GlobalHandler::getAdapters() {
234+
static std::vector<adapter_impl *> &adapters = getOrCreate(MAdapters);
235235
enableOnCrashStackPrinting();
236236
return adapters;
237237
}

sycl/source/detail/global_handler.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class context_impl;
2323
class Scheduler;
2424
class ProgramManager;
2525
class Sync;
26-
class Adapter;
26+
class adapter_impl;
2727
class ods_target_list;
2828
class XPTIRegistry;
2929
class ThreadPool;
@@ -70,7 +70,7 @@ class GlobalHandler {
7070
std::mutex &getPlatformToDefaultContextCacheMutex();
7171
std::mutex &getPlatformMapMutex();
7272
std::mutex &getFilterMutex();
73-
std::vector<Adapter *> &getAdapters();
73+
std::vector<adapter_impl *> &getAdapters();
7474
ods_target_list &getOneapiDeviceSelectorTargets(const std::string &InitValue);
7575
XPTIRegistry &getXPTIRegistry();
7676
ThreadPool &getHostTaskThreadPool();
@@ -125,7 +125,7 @@ class GlobalHandler {
125125
InstWithLock<std::mutex> MPlatformToDefaultContextCacheMutex;
126126
InstWithLock<std::mutex> MPlatformMapMutex;
127127
InstWithLock<std::mutex> MFilterMutex;
128-
InstWithLock<std::vector<Adapter *>> MAdapters;
128+
InstWithLock<std::vector<adapter_impl *>> MAdapters;
129129
InstWithLock<ods_target_list> MOneapiDeviceSelectorTargets;
130130
InstWithLock<XPTIRegistry> MXPTIRegistry;
131131
// Thread pool for host task and event callbacks execution

sycl/source/detail/kernel_name_based_cache_t.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ struct FastKernelCacheVal {
2929
const KernelArgMask *MKernelArgMask; /* Eliminated kernel argument mask. */
3030
ur_program_handle_t MProgramHandle; /* UR program handle corresponding to
3131
this kernel. */
32-
const Adapter &MAdapterPtr; /* We can keep reference to the adapter
33-
because during 2-stage shutdown the kernel
34-
cache is destroyed deliberately before the
35-
adapter. */
32+
const adapter_impl &MAdapterPtr; /* We can keep reference to the adapter
33+
because during 2-stage shutdown the kernel
34+
cache is destroyed deliberately before the
35+
adapter. */
3636

3737
FastKernelCacheVal(ur_kernel_handle_t KernelHandle, std::mutex *Mutex,
3838
const KernelArgMask *KernelArgMask,
3939
ur_program_handle_t ProgramHandle,
40-
const Adapter &AdapterPtr)
40+
const adapter_impl &AdapterPtr)
4141
: MKernelHandle(KernelHandle), MMutex(Mutex),
4242
MKernelArgMask(KernelArgMask), MProgramHandle(ProgramHandle),
4343
MAdapterPtr(AdapterPtr) {}

sycl/source/detail/kernel_program_cache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <detail/adapter.hpp>
9+
#include <detail/adapter_impl.hpp>
1010
#include <detail/context_impl.hpp>
1111
#include <detail/kernel_program_cache.hpp>
1212

sycl/source/detail/persistent_device_code_cache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <detail/adapter.hpp>
9+
#include <detail/adapter_impl.hpp>
1010
#include <detail/device_impl.hpp>
1111
#include <detail/persistent_device_code_cache.hpp>
1212
#include <detail/program_manager/program_manager.hpp>

sycl/source/detail/platform_impl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <detail/adapter.hpp>
11+
#include <detail/adapter_impl.hpp>
1212
#include <detail/split_string.hpp>
1313
#include <detail/ur.hpp>
1414
#include <detail/ur_info_code.hpp>
@@ -39,7 +39,7 @@ class platform_impl : public std::enable_shared_from_this<platform_impl> {
3939
//
4040
// Platforms can only be created under `GlobalHandler`'s ownership via
4141
// `platform_impl::getOrMakePlatformImpl` method.
42-
explicit platform_impl(ur_platform_handle_t APlatform, Adapter *AAdapter)
42+
explicit platform_impl(ur_platform_handle_t APlatform, adapter_impl *AAdapter)
4343
: MPlatform(APlatform), MAdapter(AAdapter) {
4444
// Find out backend of the platform
4545
ur_backend_t UrBackend = UR_BACKEND_UNKNOWN;

sycl/source/detail/queue_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <detail/adapter.hpp>
11+
#include <detail/adapter_impl.hpp>
1212
#include <detail/config.hpp>
1313
#include <detail/context_impl.hpp>
1414
#include <detail/device_impl.hpp>

sycl/source/detail/sycl_mem_obj_t.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include <detail/adapter.hpp>
9+
#include <detail/adapter_impl.hpp>
1010
#include <detail/context_impl.hpp>
1111
#include <detail/event_impl.hpp>
1212
#include <detail/memory_manager.hpp>

sycl/source/detail/sycl_mem_obj_t.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ namespace detail {
3333
// Forward declarations
3434
class context_impl;
3535
class event_impl;
36-
class Adapter;
37-
using AdapterPtr = Adapter *;
36+
class adapter_impl;
37+
using AdapterPtr = adapter_impl *;
3838

3939
using EventImplPtr = std::shared_ptr<event_impl>;
4040

sycl/source/detail/ur.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/// \ingroup sycl_ur
1414

1515
#include "ur.hpp"
16-
#include <detail/adapter.hpp>
16+
#include <detail/adapter_impl.hpp>
1717
#include <detail/config.hpp>
1818
#include <detail/context_impl.hpp>
1919
#include <detail/global_handler.hpp>
@@ -90,7 +90,7 @@ bool trace(TraceLevel Level) {
9090
return (TraceLevelMask & Level) == Level;
9191
}
9292

93-
static void initializeAdapters(std::vector<Adapter *> &Adapters,
93+
static void initializeAdapters(std::vector<adapter_impl *> &Adapters,
9494
ur_loader_config_handle_t LoaderConfig);
9595

9696
bool XPTIInitDone = false;
@@ -117,7 +117,7 @@ std::vector<AdapterPtr> &initializeUr(ur_loader_config_handle_t LoaderConfig) {
117117
return GlobalHandler::instance().getAdapters();
118118
}
119119

120-
static void initializeAdapters(std::vector<Adapter *> &Adapters,
120+
static void initializeAdapters(std::vector<adapter_impl *> &Adapters,
121121
ur_loader_config_handle_t LoaderConfig) {
122122
#define CHECK_UR_SUCCESS(Call) \
123123
{ \
@@ -238,7 +238,7 @@ static void initializeAdapters(std::vector<Adapter *> &Adapters,
238238
sizeof(adapterBackend), &adapterBackend,
239239
nullptr));
240240
auto syclBackend = UrToSyclBackend(adapterBackend);
241-
Adapters.emplace_back(new Adapter(UrAdapter, syclBackend));
241+
Adapters.emplace_back(new adapter_impl(UrAdapter, syclBackend));
242242

243243
const char *env_value = std::getenv("UR_LOG_CALLBACK");
244244
if (env_value == nullptr || std::string(env_value) != "disabled") {

sycl/source/detail/ur.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ namespace sycl {
2424
inline namespace _V1 {
2525
enum class backend : char;
2626
namespace detail {
27-
class Adapter;
28-
using AdapterPtr = Adapter *;
27+
class adapter_impl;
28+
using AdapterPtr = adapter_impl *;
2929

3030
namespace ur {
3131
void *getURLoaderLibrary();

sycl/source/detail/ur_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <detail/adapter.hpp>
11+
#include <detail/adapter_impl.hpp>
1212
#include <detail/compiler.hpp>
1313
#include <sycl/detail/defines_elementary.hpp>
1414
#include <sycl/detail/ur.hpp>

sycl/unittests/helpers/UrMock.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#pragma once
3333

34-
#include <detail/adapter.hpp>
34+
#include <detail/adapter_impl.hpp>
3535
#include <detail/global_handler.hpp>
3636
#include <detail/platform_impl.hpp>
3737
#include <detail/ur.hpp>

0 commit comments

Comments
 (0)