Skip to content
Merged
2 changes: 1 addition & 1 deletion sycl/cmake/modules/FetchUnifiedRuntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ if(SYCL_UR_USE_FETCH_CONTENT)
CACHE PATH "Path to external '${name}' adapter source dir" FORCE)
endfunction()

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
set(UNIFIED_RUNTIME_REPO "https://github.com/aarongreig/unified-runtime.git")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/UnifiedRuntimeTag.cmake)

set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
Expand Down
8 changes: 1 addition & 7 deletions sycl/cmake/modules/UnifiedRuntimeTag.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
# commit 08d36b76a5b1c4f080e3301507a39525ab5ab365
# Merge: 4c504dbc e6b61c67
# Author: Kenneth Benzie (Benie) <[email protected]>
# Date: Tue Feb 4 13:14:19 2025 +0000
# Merge pull request #2614 from kurapov-peter/spills
# Add UR_KERNEL_INFO_SPILL_MEM_SIZE kernel info prop
set(UNIFIED_RUNTIME_TAG 08d36b76a5b1c4f080e3301507a39525ab5ab365)
set(UNIFIED_RUNTIME_TAG aaron/mergeAdapterPlatformBackend)
14 changes: 7 additions & 7 deletions sycl/source/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ static const AdapterPtr &getAdapter(backend Backend) {
}
}

backend convertUrBackend(ur_platform_backend_t UrBackend) {
backend convertUrBackend(ur_backend_t UrBackend) {
switch (UrBackend) {
case UR_PLATFORM_BACKEND_UNKNOWN:
case UR_BACKEND_UNKNOWN:
return backend::all; // No specific backend
case UR_PLATFORM_BACKEND_LEVEL_ZERO:
case UR_BACKEND_LEVEL_ZERO:
return backend::ext_oneapi_level_zero;
case UR_PLATFORM_BACKEND_OPENCL:
case UR_BACKEND_OPENCL:
return backend::opencl;
case UR_PLATFORM_BACKEND_CUDA:
case UR_BACKEND_CUDA:
return backend::ext_oneapi_cuda;
case UR_PLATFORM_BACKEND_HIP:
case UR_BACKEND_HIP:
return backend::ext_oneapi_hip;
case UR_PLATFORM_BACKEND_NATIVE_CPU:
case UR_BACKEND_NATIVE_CPU:
return backend::ext_oneapi_native_cpu;
default:
throw exception(make_error_code(errc::runtime),
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/platform_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ platform_impl::filterDeviceFilter(std::vector<ur_device_handle_t> &UrDevices,
std::vector<int> original_indices;

// Find out backend of the platform
ur_platform_backend_t UrBackend = UR_PLATFORM_BACKEND_UNKNOWN;
ur_backend_t UrBackend = UR_BACKEND_UNKNOWN;
MAdapter->call<UrApiKind::urPlatformGetInfo>(
MPlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_platform_backend_t),
&UrBackend, nullptr);
MPlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_backend_t), &UrBackend,
nullptr);
backend Backend = convertUrBackend(UrBackend);

int InsertIDx = 0;
Expand Down
6 changes: 3 additions & 3 deletions sycl/source/detail/platform_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class platform_impl {
const std::shared_ptr<Adapter> &AAdapter)
: MPlatform(APlatform), MAdapter(AAdapter) {
// Find out backend of the platform
ur_platform_backend_t UrBackend = UR_PLATFORM_BACKEND_UNKNOWN;
ur_backend_t UrBackend = UR_BACKEND_UNKNOWN;
AAdapter->call_nocheck<UrApiKind::urPlatformGetInfo>(
APlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_platform_backend_t),
&UrBackend, nullptr);
APlatform, UR_PLATFORM_INFO_BACKEND, sizeof(ur_backend_t), &UrBackend,
nullptr);
MBackend = convertUrBackend(UrBackend);
}

Expand Down
14 changes: 7 additions & 7 deletions sycl/source/detail/ur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@ static void initializeAdapters(std::vector<AdapterPtr> &Adapters,
std::vector<ur_adapter_handle_t> adapters(adapterCount);
CHECK_UR_SUCCESS(adapterGet(adapterCount, adapters.data(), nullptr));

auto UrToSyclBackend = [](ur_adapter_backend_t backend) -> sycl::backend {
auto UrToSyclBackend = [](ur_backend_t backend) -> sycl::backend {
switch (backend) {
case UR_ADAPTER_BACKEND_LEVEL_ZERO:
case UR_BACKEND_LEVEL_ZERO:
return backend::ext_oneapi_level_zero;
case UR_ADAPTER_BACKEND_OPENCL:
case UR_BACKEND_OPENCL:
return backend::opencl;
case UR_ADAPTER_BACKEND_CUDA:
case UR_BACKEND_CUDA:
return backend::ext_oneapi_cuda;
case UR_ADAPTER_BACKEND_HIP:
case UR_BACKEND_HIP:
return backend::ext_oneapi_hip;
case UR_ADAPTER_BACKEND_NATIVE_CPU:
case UR_BACKEND_NATIVE_CPU:
return backend::ext_oneapi_native_cpu;
default:
// Throw an exception, this should be unreachable.
Expand All @@ -213,7 +213,7 @@ static void initializeAdapters(std::vector<AdapterPtr> &Adapters,
};

for (const auto &UrAdapter : adapters) {
ur_adapter_backend_t adapterBackend = UR_ADAPTER_BACKEND_UNKNOWN;
ur_backend_t adapterBackend = UR_BACKEND_UNKNOWN;
CHECK_UR_SUCCESS(adapterGetInfo(UrAdapter, UR_ADAPTER_INFO_BACKEND,
sizeof(adapterBackend), &adapterBackend,
nullptr));
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/ur.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template <backend BE> const AdapterPtr &getAdapter();
} // namespace ur

// Convert from UR backend to SYCL backend enum
backend convertUrBackend(ur_platform_backend_t UrBackend);
backend convertUrBackend(ur_backend_t UrBackend);

} // namespace detail
} // namespace _V1
Expand Down
2 changes: 1 addition & 1 deletion sycl/unittests/Extensions/FPGADeviceSelectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ template <const char PlatformName[]> struct RedefTemplatedWrapper {
return UR_RESULT_SUCCESS;
}
case UR_PLATFORM_INFO_BACKEND: {
constexpr auto MockPlatformBackend = UR_PLATFORM_BACKEND_UNKNOWN;
constexpr auto MockPlatformBackend = UR_BACKEND_UNKNOWN;
if (*params.ppPropValue) {
std::memcpy(*params.ppPropValue, &MockPlatformBackend,
sizeof(MockPlatformBackend));
Expand Down
48 changes: 14 additions & 34 deletions sycl/unittests/helpers/UrMock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ inline ur_result_t mock_urDeviceGet(void *pParams) {
inline ur_result_t mock_urDeviceRetain(void *) { return UR_RESULT_SUCCESS; }
inline ur_result_t mock_urDeviceRelease(void *) { return UR_RESULT_SUCCESS; }

template <ur_adapter_backend_t Backend>
template <ur_backend_t Backend>
inline ur_result_t mock_urAdapterGetInfo(void *pParams) {
auto params = reinterpret_cast<ur_adapter_get_info_params_t *>(pParams);

Expand All @@ -100,7 +100,7 @@ inline ur_result_t mock_urAdapterGetInfo(void *pParams) {
return UR_RESULT_SUCCESS;
}

template <ur_platform_backend_t Backend>
template <ur_backend_t Backend>
inline ur_result_t mock_urPlatformGetInfo(void *pParams) {
auto params = reinterpret_cast<ur_platform_get_info_params_t *>(pParams);
constexpr char MockPlatformName[] = "Mock platform";
Expand Down Expand Up @@ -518,16 +518,14 @@ template <sycl::backend Backend = backend::opencl> class UrMock {
#define ADD_DEFAULT_OVERRIDE(func_name, func_override) \
mock::getCallbacks().set_replace_callback(#func_name, \
&MockAdapter::func_override);
ADD_DEFAULT_OVERRIDE(
urAdapterGetInfo,
mock_urAdapterGetInfo<convertToUrAdapterBackend(Backend)>)
ADD_DEFAULT_OVERRIDE(urAdapterGetInfo,
mock_urAdapterGetInfo<convertToUrBackend(Backend)>)
ADD_DEFAULT_OVERRIDE(urPlatformGet, mock_urPlatformGet)
ADD_DEFAULT_OVERRIDE(urDeviceGet, mock_urDeviceGet)
ADD_DEFAULT_OVERRIDE(urDeviceRetain, mock_urDeviceRetain)
ADD_DEFAULT_OVERRIDE(urDeviceRelease, mock_urDeviceRelease)
ADD_DEFAULT_OVERRIDE(
urPlatformGetInfo,
mock_urPlatformGetInfo<convertToUrPlatformBackend(Backend)>)
ADD_DEFAULT_OVERRIDE(urPlatformGetInfo,
mock_urPlatformGetInfo<convertToUrBackend(Backend)>)
ADD_DEFAULT_OVERRIDE(urDeviceGetInfo, mock_urDeviceGetInfo)
ADD_DEFAULT_OVERRIDE(urProgramGetInfo, mock_urProgramGetInfo)
ADD_DEFAULT_OVERRIDE(urContextGetInfo, mock_urContextGetInfo)
Expand Down Expand Up @@ -580,39 +578,21 @@ template <sycl::backend Backend = backend::opencl> class UrMock {
private:
// These two helpers are needed to enable arbitrary backend selection
// at compile time.
static constexpr ur_platform_backend_t
convertToUrPlatformBackend(const sycl::backend SyclBackend) {
static constexpr ur_backend_t
convertToUrBackend(const sycl::backend SyclBackend) {
switch (SyclBackend) {
case sycl::backend::opencl:
return UR_PLATFORM_BACKEND_OPENCL;
return UR_BACKEND_OPENCL;
case sycl::backend::ext_oneapi_level_zero:
return UR_PLATFORM_BACKEND_LEVEL_ZERO;
return UR_BACKEND_LEVEL_ZERO;
case sycl::backend::ext_oneapi_cuda:
return UR_PLATFORM_BACKEND_CUDA;
return UR_BACKEND_CUDA;
case sycl::backend::ext_oneapi_hip:
return UR_PLATFORM_BACKEND_HIP;
return UR_BACKEND_HIP;
case sycl::backend::ext_oneapi_native_cpu:
return UR_PLATFORM_BACKEND_NATIVE_CPU;
return UR_BACKEND_NATIVE_CPU;
default:
return UR_PLATFORM_BACKEND_UNKNOWN;
}
}

static constexpr ur_adapter_backend_t
convertToUrAdapterBackend(sycl::backend SyclBackend) {
switch (SyclBackend) {
case sycl::backend::opencl:
return UR_ADAPTER_BACKEND_OPENCL;
case sycl::backend::ext_oneapi_level_zero:
return UR_ADAPTER_BACKEND_LEVEL_ZERO;
case sycl::backend::ext_oneapi_cuda:
return UR_ADAPTER_BACKEND_CUDA;
case sycl::backend::ext_oneapi_hip:
return UR_ADAPTER_BACKEND_HIP;
case sycl::backend::ext_oneapi_native_cpu:
return UR_ADAPTER_BACKEND_NATIVE_CPU;
default:
return UR_ADAPTER_BACKEND_UNKNOWN;
return UR_BACKEND_UNKNOWN;
}
}
};
Expand Down