Skip to content

Commit 8f6c848

Browse files
committed
[SYCL][NFC] Rename Adapter class to adapter_impl
1 parent 0df8a45 commit 8f6c848

File tree

10 files changed

+34
-32
lines changed

10 files changed

+34
-32
lines changed

sycl/source/detail/adapter.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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/event_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/global_handler.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 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
32+
const adapter_impl &MAdapterPtr; /* We can keep reference to the adapter
3333
because during 2-stage shutdown the kernel
3434
cache is destroyed deliberately before the
3535
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/platform_impl.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,23 @@ std::vector<platform> platform_impl::get_platforms() {
172172
std::vector<std::pair<platform, AdapterPtr>> PlatformsWithAdapter;
173173

174174
// Then check backend-specific adapters
175+
std::vector<platform> Platforms;
175176
for (auto &Adapter : Adapters) {
176177
const auto &AdapterPlatforms = getAdapterPlatforms(Adapter);
177178
for (const auto &P : AdapterPlatforms) {
179+
Platforms.push_back(P);
178180
PlatformsWithAdapter.push_back({P, Adapter});
179181
}
180182
}
181183

182184
// For the selected platforms register them with their adapters
183-
std::vector<platform> Platforms;
184-
for (auto &Platform : PlatformsWithAdapter) {
185-
auto &Adapter = Platform.second;
186-
std::lock_guard<std::mutex> Guard(*Adapter->getAdapterMutex());
187-
Adapter->getPlatformId(getSyclObjImpl(Platform.first)->getHandleRef());
188-
Platforms.push_back(Platform.first);
189-
}
185+
// std::vector<platform> Platforms;
186+
// for (auto &Platform : PlatformsWithAdapter) {
187+
// auto &Adapter = Platform.second;
188+
// std::lock_guard<std::mutex> Guard(*Adapter->getAdapterMutex());
189+
// Adapter->getPlatformId(getSyclObjImpl(Platform.first)->getHandleRef());
190+
// Platforms.push_back(Platform.first);
191+
// }
190192

191193
// This initializes a function-local variable whose destructor is invoked as
192194
// the SYCL shared library is first being unloaded.

sycl/source/detail/platform_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

0 commit comments

Comments
 (0)