Skip to content

Commit 0c212e3

Browse files
authored
Revert "[SYCL][UR] Link UR PI against UR Loader" (#8781)
Reverts #8637 It caused at least 3 known regressions. 1. #8637 (comment) 2. \sycl\plugins\unified_runtime\ur\adapters\level_zero\ur_level_zero_common.hpp(10): fatal error C1083: Cannot open include file: 'sycl/detail/pi.h': No such file or directory 3. ld: error: undefined symbol: pthread_rwlock_wrlock (with GCC 7.5)
1 parent 6bbe331 commit 0c212e3

File tree

5 files changed

+24
-329
lines changed

5 files changed

+24
-329
lines changed

sycl/plugins/unified_runtime/CMakeLists.txt

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D
44
include(FetchContent)
55

66
set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
7-
set(UNIFIED_RUNTIME_TAG d6af758779db6eebdc419fd5e249302f566eb5de)
7+
set(UNIFIED_RUNTIME_TAG 6fb8e2620f1474428a539ef46d6dd47043c7d59b)
88

99
message(STATUS "Will fetch Unified Runtime from ${UNIFIED_RUNTIME_REPO}")
1010
FetchContent_Declare(unified-runtime
@@ -37,23 +37,28 @@ if (NOT DEFINED UNIFIED_RUNTIME_LIBRARY OR NOT DEFINED UNIFIED_RUNTIME_INCLUDE_D
3737
# Restore original flags
3838
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_BAK}")
3939

40-
add_library(UnifiedRuntimeLoader ALIAS loader)
40+
add_library(${PROJECT_NAME}::ur_loader ALIAS loader)
41+
42+
set(UNIFIED_RUNTIME_LIBRARY ${PROJECT_NAME}::ur_loader)
4143

4244
set(UNIFIED_RUNTIME_SOURCE_DIR
4345
${unified-runtime_SOURCE_DIR} CACHE PATH "Path to Unified Runtime Headers")
4446
set(UNIFIED_RUNTIME_INCLUDE_DIR "${UNIFIED_RUNTIME_SOURCE_DIR}/include")
4547
endif()
4648

47-
4849
add_library (UnifiedRuntime-Headers INTERFACE)
49-
5050
target_include_directories(UnifiedRuntime-Headers
5151
INTERFACE
5252
"${UNIFIED_RUNTIME_INCLUDE_DIR}"
5353
)
5454

5555
find_package(Threads REQUIRED)
5656

57+
#
58+
# NOTE: the Unified Runtime doesn't have the loader [yet].
59+
# So what we really build is the Unified Runtime with Level Zero Adapter
60+
# together.
61+
#
5762
add_sycl_plugin(unified_runtime
5863
SOURCES
5964
# These are short-term shared with Unified Runtime
@@ -64,25 +69,9 @@ add_sycl_plugin(unified_runtime
6469
"ur_bindings.hpp"
6570
"pi2ur.hpp"
6671
"pi2ur.cpp"
67-
# These below belong to Unified Runtime PI Plugin only
68-
"pi_unified_runtime.hpp"
69-
"pi_unified_runtime.cpp"
70-
LIBRARIES
71-
Threads::Threads
72-
UnifiedRuntimeLoader
73-
UnifiedRuntime-Headers
74-
)
75-
76-
# Build level zero adapter
77-
add_sycl_library("ur_adapter_level_zero" SHARED
78-
SOURCES
7972
"ur/ur.hpp"
8073
"ur/ur.cpp"
81-
"ur/usm_allocator.hpp"
82-
"ur/usm_allocator.cpp"
8374
"ur/adapters/level_zero/ur_level_zero.hpp"
84-
"ur/adapters/level_zero/ur_level_zero.cpp"
85-
"ur/adapters/level_zero/ur_loader_interface.cpp"
8675
"ur/adapters/level_zero/ur_level_zero_common.hpp"
8776
"ur/adapters/level_zero/ur_level_zero_context.hpp"
8877
"ur/adapters/level_zero/ur_level_zero_device.hpp"
@@ -104,19 +93,18 @@ add_sycl_library("ur_adapter_level_zero" SHARED
10493
"ur/adapters/level_zero/ur_level_zero_program.cpp"
10594
"ur/adapters/level_zero/ur_level_zero_queue.cpp"
10695
"ur/adapters/level_zero/ur_level_zero_sampler.cpp"
107-
INCLUDE_DIRS
108-
LIBRARIES
96+
"ur/usm_allocator.hpp"
97+
"ur/usm_allocator.cpp"
98+
# These below belong to Unified Runtime PI Plugin only
99+
"pi_unified_runtime.hpp"
100+
"pi_unified_runtime.cpp"
101+
LIBRARIES
102+
Threads::Threads
109103
UnifiedRuntime-Headers
110104
LevelZeroLoader-Headers
111105
LevelZeroLoader
112106
)
113107

114-
set_target_properties("ur_adapter_level_zero" PROPERTIES
115-
VERSION "0.0.0"
116-
SOVERSION "0"
117-
)
118-
119-
120-
if (TARGET UnifiedRuntimeLoader)
108+
if (TARGET ${PROJECT_NAME}::ur_loader)
121109
set_target_properties(hello_world PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
122110
endif()

sycl/plugins/unified_runtime/pi2ur.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static pi_result ur2piResult(ur_result_t urResult) {
2929
{UR_RESULT_ERROR_INVALID_FUNCTION_NAME, PI_ERROR_BUILD_PROGRAM_FAILURE},
3030
{UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE,
3131
PI_ERROR_INVALID_WORK_GROUP_SIZE},
32-
{UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE, PI_ERROR_BUILD_PROGRAM_FAILURE},
32+
{UR_RESULT_ERROR_MODULE_BUILD_FAILURE, PI_ERROR_BUILD_PROGRAM_FAILURE},
3333
{UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY, PI_ERROR_OUT_OF_RESOURCES},
3434
{UR_RESULT_ERROR_OUT_OF_HOST_MEMORY, PI_ERROR_OUT_OF_HOST_MEMORY}};
3535

@@ -252,7 +252,6 @@ namespace pi2ur {
252252
inline pi_result piPlatformsGet(pi_uint32 num_entries, pi_platform *platforms,
253253
pi_uint32 *num_platforms) {
254254

255-
urInit(0);
256255
uint32_t Count = num_entries;
257256
auto phPlatforms = reinterpret_cast<ur_platform_handle_t *>(platforms);
258257
HANDLE_ERRORS(urPlatformGet(Count, phPlatforms, num_platforms));

sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ ur_result_t _ur_platform_handle_t::initialize() {
286286
return UR_RESULT_SUCCESS;
287287
}
288288

289-
ur_result_t urPlatformGet(
289+
UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(
290290
uint32_t NumEntries, ///< [in] the number of platforms to be added to
291291
///< phPlatforms. If phPlatforms is not NULL, then
292292
///< NumEntries should be greater than zero, otherwise
@@ -403,7 +403,7 @@ ur_result_t urPlatformGet(
403403
return UR_RESULT_SUCCESS;
404404
}
405405

406-
ur_result_t urPlatformGetInfo(
406+
UR_APIEXPORT ur_result_t UR_APICALL urPlatformGetInfo(
407407
ur_platform_handle_t Platform, ///< [in] handle of the platform
408408
ur_platform_info_t ParamName, ///< [in] type of the info to retrieve
409409
size_t Size, ///< [in] the number of bytes pointed to by pPlatformInfo.
@@ -457,7 +457,7 @@ ur_result_t urPlatformGetInfo(
457457
return UR_RESULT_SUCCESS;
458458
}
459459

460-
ur_result_t urDeviceGet(
460+
UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet(
461461
ur_platform_handle_t Platform, ///< [in] handle of the platform instance
462462
ur_device_type_t DeviceType, ///< [in] the type of the devices.
463463
uint32_t NumEntries, ///< [in] the number of devices to be added to
@@ -534,7 +534,7 @@ ur_result_t urDeviceGet(
534534
return UR_RESULT_SUCCESS;
535535
}
536536

537-
ur_result_t urDeviceGetInfo(
537+
UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
538538
ur_device_handle_t Device, ///< [in] handle of the device instance
539539
ur_device_info_t ParamName, ///< [in] type of the info to retrieve
540540
size_t propSize, ///< [in] the number of bytes pointed to by pDeviceInfo.
@@ -1660,7 +1660,7 @@ void ZeUSMImportExtension::doZeUSMRelease(ze_driver_handle_t DriverHandle,
16601660
ZE_CALL_NOCHECK(zexDriverReleaseImportedPointer, (DriverHandle, HostPtr));
16611661
}
16621662

1663-
ur_result_t urDevicePartition(
1663+
UR_APIEXPORT ur_result_t UR_APICALL urDevicePartition(
16641664
ur_device_handle_t Device, ///< [in] handle of the device to partition.
16651665
const ur_device_partition_property_t
16661666
*Properties, ///< [in] null-terminated array of <$_device_partition_t
@@ -1741,9 +1741,3 @@ ur_result_t urDevicePartition(
17411741
}
17421742
return UR_RESULT_SUCCESS;
17431743
}
1744-
1745-
ur_result_t urInit(ur_device_init_flags_t device_flags) {
1746-
return UR_RESULT_SUCCESS;
1747-
}
1748-
1749-
ur_result_t urTearDown(void *pParams) { return UR_RESULT_SUCCESS; }

sycl/plugins/unified_runtime/ur/adapters/level_zero/ur_level_zero_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ std::unordered_map<ze_result_t, ur_result_t> Ze2UrErrorMapping = {
3333
{ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION,
3434
UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE},
3535
{ZE_RESULT_ERROR_MODULE_BUILD_FAILURE,
36-
UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE},
36+
UR_RESULT_ERROR_MODULE_BUILD_FAILURE},
3737
{ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY,
3838
UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY},
3939
{ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY, UR_RESULT_ERROR_OUT_OF_HOST_MEMORY}};

0 commit comments

Comments
 (0)