Skip to content

[SYCL][NFC] Rename Adapter to adapter_impl #19184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sycl/source/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include "detail/adapter.hpp"
#include "detail/adapter_impl.hpp"
#include "detail/context_impl.hpp"
#include "detail/event_impl.hpp"
#include "detail/kernel_bundle_impl.hpp"
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/backend/level_zero.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/platform_impl.hpp>
#include <detail/queue_impl.hpp>
#include <detail/ur.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/backend/opencl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/kernel_impl.hpp>
#include <detail/platform_impl.hpp>
#include <detail/queue_impl.hpp>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//==- adapter.hpp ----------------------------------------------------------==//
//==- adapter_impl.hpp ----------------------------------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand Down Expand Up @@ -42,11 +42,11 @@ namespace detail {
/// runtimes for the device-agnostic SYCL runtime.
///
/// \ingroup sycl_ur
class Adapter {
class adapter_impl {
public:
Adapter() = delete;
adapter_impl() = delete;

Adapter(ur_adapter_handle_t adapter, backend UseBackend)
adapter_impl(ur_adapter_handle_t adapter, backend UseBackend)
: MAdapter(adapter), MBackend(UseBackend),
MAdapterMutex(std::make_shared<std::mutex>()) {

Expand All @@ -57,12 +57,12 @@ class Adapter {
}

// Disallow accidental copies of adapters
Adapter &operator=(const Adapter &) = delete;
Adapter(const Adapter &) = delete;
Adapter &operator=(Adapter &&other) noexcept = delete;
Adapter(Adapter &&other) noexcept = delete;
adapter_impl &operator=(const adapter_impl &) = delete;
adapter_impl(const adapter_impl &) = delete;
adapter_impl &operator=(adapter_impl &&other) noexcept = delete;
adapter_impl(adapter_impl &&other) noexcept = delete;

~Adapter() = default;
~adapter_impl() = default;

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

} // namespace detail
} // namespace _V1
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/allowlist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/ur.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/device_image_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/compiler.hpp>
#include <detail/context_impl.hpp>
#include <detail/device_impl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/error_handling/error_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "error_handling.hpp"
#include "sycl/detail/common.hpp"

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <sycl/backend_types.hpp>
#include <sycl/detail/ur.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/event_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/event_impl.hpp>
#include <detail/event_info.hpp>
#include <detail/queue_impl.hpp>
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/event_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <sycl/detail/cl.h>
#include <sycl/detail/common.hpp>
#include <sycl/detail/host_profiling_info.hpp>
Expand All @@ -27,7 +27,7 @@ class graph_impl;
}
class context;
namespace detail {
class Adapter;
class adapter_impl;
class context_impl;
using ContextImplPtr = std::shared_ptr<sycl::detail::context_impl>;
class queue_impl;
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/event_info.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/event_impl.hpp>
#include <detail/ur_info_code.hpp>
#include <sycl/detail/common.hpp>
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/global_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "llvm/Support/Signals.h"
#endif

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/config.hpp>
#include <detail/global_handler.hpp>
#include <detail/kernel_name_based_cache_t.hpp>
Expand Down Expand Up @@ -230,8 +230,8 @@ std::mutex &GlobalHandler::getFilterMutex() {
return FilterMutex;
}

std::vector<Adapter *> &GlobalHandler::getAdapters() {
static std::vector<Adapter *> &adapters = getOrCreate(MAdapters);
std::vector<adapter_impl *> &GlobalHandler::getAdapters() {
static std::vector<adapter_impl *> &adapters = getOrCreate(MAdapters);
enableOnCrashStackPrinting();
return adapters;
}
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/global_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class context_impl;
class Scheduler;
class ProgramManager;
class Sync;
class Adapter;
class adapter_impl;
class ods_target_list;
class XPTIRegistry;
class ThreadPool;
Expand Down Expand Up @@ -70,7 +70,7 @@ class GlobalHandler {
std::mutex &getPlatformToDefaultContextCacheMutex();
std::mutex &getPlatformMapMutex();
std::mutex &getFilterMutex();
std::vector<Adapter *> &getAdapters();
std::vector<adapter_impl *> &getAdapters();
ods_target_list &getOneapiDeviceSelectorTargets(const std::string &InitValue);
XPTIRegistry &getXPTIRegistry();
ThreadPool &getHostTaskThreadPool();
Expand Down Expand Up @@ -125,7 +125,7 @@ class GlobalHandler {
InstWithLock<std::mutex> MPlatformToDefaultContextCacheMutex;
InstWithLock<std::mutex> MPlatformMapMutex;
InstWithLock<std::mutex> MFilterMutex;
InstWithLock<std::vector<Adapter *>> MAdapters;
InstWithLock<std::vector<adapter_impl *>> MAdapters;
InstWithLock<ods_target_list> MOneapiDeviceSelectorTargets;
InstWithLock<XPTIRegistry> MXPTIRegistry;
// Thread pool for host task and event callbacks execution
Expand Down
10 changes: 5 additions & 5 deletions sycl/source/detail/kernel_name_based_cache_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ struct FastKernelCacheVal {
const KernelArgMask *MKernelArgMask; /* Eliminated kernel argument mask. */
ur_program_handle_t MProgramHandle; /* UR program handle corresponding to
this kernel. */
const Adapter &MAdapterPtr; /* We can keep reference to the adapter
because during 2-stage shutdown the kernel
cache is destroyed deliberately before the
adapter. */
const adapter_impl &MAdapterPtr; /* We can keep reference to the adapter
because during 2-stage shutdown the kernel
cache is destroyed deliberately before the
adapter. */

FastKernelCacheVal(ur_kernel_handle_t KernelHandle, std::mutex *Mutex,
const KernelArgMask *KernelArgMask,
ur_program_handle_t ProgramHandle,
const Adapter &AdapterPtr)
const adapter_impl &AdapterPtr)
: MKernelHandle(KernelHandle), MMutex(Mutex),
MKernelArgMask(KernelArgMask), MProgramHandle(ProgramHandle),
MAdapterPtr(AdapterPtr) {}
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/kernel_program_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/context_impl.hpp>
#include <detail/kernel_program_cache.hpp>

Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/persistent_device_code_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/device_impl.hpp>
#include <detail/persistent_device_code_cache.hpp>
#include <detail/program_manager/program_manager.hpp>
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/platform_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/split_string.hpp>
#include <detail/ur.hpp>
#include <detail/ur_info_code.hpp>
Expand Down Expand Up @@ -39,7 +39,7 @@ class platform_impl : public std::enable_shared_from_this<platform_impl> {
//
// Platforms can only be created under `GlobalHandler`'s ownership via
// `platform_impl::getOrMakePlatformImpl` method.
explicit platform_impl(ur_platform_handle_t APlatform, Adapter *AAdapter)
explicit platform_impl(ur_platform_handle_t APlatform, adapter_impl *AAdapter)
: MPlatform(APlatform), MAdapter(AAdapter) {
// Find out backend of the platform
ur_backend_t UrBackend = UR_BACKEND_UNKNOWN;
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/queue_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/config.hpp>
#include <detail/context_impl.hpp>
#include <detail/device_impl.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/sycl_mem_obj_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/context_impl.hpp>
#include <detail/event_impl.hpp>
#include <detail/memory_manager.hpp>
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/sycl_mem_obj_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ namespace detail {
// Forward declarations
class context_impl;
class event_impl;
class Adapter;
using AdapterPtr = Adapter *;
class adapter_impl;
using AdapterPtr = adapter_impl *;

using EventImplPtr = std::shared_ptr<event_impl>;

Expand Down
8 changes: 4 additions & 4 deletions sycl/source/detail/ur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/// \ingroup sycl_ur

#include "ur.hpp"
#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/config.hpp>
#include <detail/context_impl.hpp>
#include <detail/global_handler.hpp>
Expand Down Expand Up @@ -90,7 +90,7 @@ bool trace(TraceLevel Level) {
return (TraceLevelMask & Level) == Level;
}

static void initializeAdapters(std::vector<Adapter *> &Adapters,
static void initializeAdapters(std::vector<adapter_impl *> &Adapters,
ur_loader_config_handle_t LoaderConfig);

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

static void initializeAdapters(std::vector<Adapter *> &Adapters,
static void initializeAdapters(std::vector<adapter_impl *> &Adapters,
ur_loader_config_handle_t LoaderConfig) {
#define CHECK_UR_SUCCESS(Call) \
{ \
Expand Down Expand Up @@ -238,7 +238,7 @@ static void initializeAdapters(std::vector<Adapter *> &Adapters,
sizeof(adapterBackend), &adapterBackend,
nullptr));
auto syclBackend = UrToSyclBackend(adapterBackend);
Adapters.emplace_back(new Adapter(UrAdapter, syclBackend));
Adapters.emplace_back(new adapter_impl(UrAdapter, syclBackend));

const char *env_value = std::getenv("UR_LOG_CALLBACK");
if (env_value == nullptr || std::string(env_value) != "disabled") {
Expand Down
4 changes: 2 additions & 2 deletions sycl/source/detail/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ namespace sycl {
inline namespace _V1 {
enum class backend : char;
namespace detail {
class Adapter;
using AdapterPtr = Adapter *;
class adapter_impl;
using AdapterPtr = adapter_impl *;

namespace ur {
void *getURLoaderLibrary();
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/ur_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/compiler.hpp>
#include <sycl/detail/defines_elementary.hpp>
#include <sycl/detail/ur.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sycl/unittests/helpers/UrMock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#pragma once

#include <detail/adapter.hpp>
#include <detail/adapter_impl.hpp>
#include <detail/global_handler.hpp>
#include <detail/platform_impl.hpp>
#include <detail/ur.hpp>
Expand Down