Skip to content

Commit 9deaabc

Browse files
Merge pull request #1929 from oneapi-src/revert-1880-l0-native-enqueue
Revert "[L0] L0 impl for enqueue native command"
2 parents 84f5e70 + ca2916e commit 9deaabc

File tree

8 files changed

+5
-250
lines changed

8 files changed

+5
-250
lines changed

source/adapters/level_zero/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(
877877
}
878878
case UR_DEVICE_INFO_ENQUEUE_NATIVE_COMMAND_SUPPORT_EXP: {
879879
// L0 doesn't support enqueueing native work through the urNativeEnqueueExp
880-
return ReturnValue(static_cast<ur_bool_t>(true));
880+
return ReturnValue(static_cast<ur_bool_t>(false));
881881
}
882882

883883
case UR_DEVICE_INFO_ESIMD_SUPPORT: {

source/adapters/level_zero/enqueue_native.cpp

Lines changed: 4 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -10,72 +10,11 @@
1010

1111
#include <ur_api.h>
1212

13-
#include "logger/ur_logger.hpp"
1413
#include "queue.hpp"
15-
#include "ur_level_zero.hpp"
1614

1715
ur_result_t ur_queue_handle_legacy_t_::enqueueNativeCommandExp(
18-
ur_exp_enqueue_native_command_function_t pfnNativeEnqueue, void *data,
19-
uint32_t, const ur_mem_handle_t *,
20-
const ur_exp_enqueue_native_command_properties_t *,
21-
uint32_t NumEventsInWaitList, const ur_event_handle_t *phEventList,
22-
ur_event_handle_t *phEvent) {
23-
auto Queue = this;
24-
std::scoped_lock<ur_shared_mutex> lock(Queue->Mutex);
25-
26-
bool UseCopyEngine = false;
27-
28-
// Please note that the following code should be run before the
29-
// subsequent getAvailableCommandList() call so that there is no
30-
// dead-lock from waiting unsubmitted events in an open batch.
31-
// The createAndRetainUrZeEventList() has the proper side-effect
32-
// of submitting batches with dependent events.
33-
//
34-
_ur_ze_event_list_t TmpWaitList;
35-
UR_CALL(TmpWaitList.createAndRetainUrZeEventList(
36-
NumEventsInWaitList, phEventList, Queue, UseCopyEngine));
37-
38-
// Get a new command list to be used on this call
39-
ur_command_list_ptr_t CommandList{};
40-
// TODO: Change UseCopyEngine argument to 'true' once L0 backend
41-
// support is added
42-
UR_CALL(Queue->Context->getAvailableCommandList(
43-
Queue, CommandList, UseCopyEngine, NumEventsInWaitList, phEventList));
44-
45-
// TODO: do we need to create a unique command type for this?
46-
ze_event_handle_t ZeEvent = nullptr;
47-
ur_event_handle_t InternalEvent;
48-
bool IsInternal = phEvent == nullptr;
49-
ur_event_handle_t *Event = phEvent ? phEvent : &InternalEvent;
50-
UR_CALL(createEventAndAssociateQueue(Queue, Event,
51-
UR_COMMAND_ENQUEUE_NATIVE_EXP,
52-
CommandList, IsInternal, false));
53-
ZeEvent = (*Event)->ZeEvent;
54-
(*Event)->WaitList = TmpWaitList;
55-
56-
const auto &WaitList = (*Event)->WaitList;
57-
if (WaitList.Length) {
58-
ZE2UR_CALL(zeCommandListAppendWaitOnEvents,
59-
(CommandList->first, WaitList.Length, WaitList.ZeEventList));
60-
}
61-
62-
UR_CALL(Queue->executeCommandList(CommandList, false, false));
63-
UR_CALL(Queue->Context->getAvailableCommandList(Queue, CommandList,
64-
UseCopyEngine, 0, nullptr));
65-
66-
{
67-
ScopedCommandList Active{Queue, CommandList->first};
68-
69-
// Call interop func which enqueues native async work
70-
pfnNativeEnqueue(Queue, data);
71-
}
72-
73-
UR_CALL(Queue->executeCommandList(CommandList, false, false));
74-
UR_CALL(Queue->Context->getAvailableCommandList(Queue, CommandList,
75-
UseCopyEngine, 0, nullptr));
76-
77-
ZE2UR_CALL(zeCommandListAppendSignalEvent, (CommandList->first, ZeEvent));
78-
79-
UR_CALL(Queue->executeCommandList(CommandList, false));
80-
return UR_RESULT_SUCCESS;
16+
ur_exp_enqueue_native_command_function_t, void *, uint32_t,
17+
const ur_mem_handle_t *, const ur_exp_enqueue_native_command_properties_t *,
18+
uint32_t, const ur_event_handle_t *, ur_event_handle_t *) {
19+
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE;
8120
}

source/adapters/level_zero/queue.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -705,15 +705,6 @@ ur_result_t ur_queue_handle_legacy_t_::queueGetNativeHandle(
705705
) {
706706
auto Queue = this;
707707

708-
// Needed for EnqueueNativeCommandExp, so that the native queue 'got' in the
709-
// interop func is the as the native queue used to manage dependencies
710-
// before the interop func invocation
711-
if (Queue->getThreadLocalCommandList() != ze_command_list_handle_t{0}) {
712-
auto ZeCmdList = ur_cast<ze_command_list_handle_t *>(NativeQueue);
713-
*ZeCmdList = Queue->getThreadLocalCommandList();
714-
return UR_RESULT_SUCCESS;
715-
}
716-
717708
// Lock automatically releases when this goes out of scope.
718709
std::shared_lock<ur_shared_mutex> lock(Queue->Mutex);
719710

source/adapters/level_zero/queue.hpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,6 @@ struct ur_queue_handle_legacy_t_ : _ur_object, public ur_queue_handle_t_ {
423423
uint32_t, const ur_event_handle_t *,
424424
ur_event_handle_t *) override;
425425

426-
// Thread local stream will be used if ScopedStream is active
427-
static ze_command_list_handle_t &getThreadLocalCommandList() {
428-
static thread_local ze_command_list_handle_t CommandList{0};
429-
return CommandList;
430-
}
431-
432426
using queue_type = ur_device_handle_t_::queue_group_info_t::type;
433427
// PI queue is in general a one to many mapping to L0 native queues.
434428
struct ur_queue_group_t {
@@ -947,23 +941,3 @@ ur_result_t setSignalEvent(ur_queue_handle_legacy_t Queue, bool UseCopyEngine,
947941
ur_result_t CleanupEventListFromResetCmdList(
948942
std::vector<ur_event_handle_t> &EventListToCleanup,
949943
bool QueueLocked = false);
950-
951-
// RAII object to make hQueue command list getter methods all return the same
952-
// command list within the lifetime of this object.
953-
//
954-
// This is useful for urEnqueueNativeCommandExp where we want guarantees that
955-
// the user submitted native calls will be dispatched to a known command list,
956-
// which must be "got" within the user submitted fuction.
957-
class ScopedCommandList {
958-
ur_queue_handle_legacy_t hQueue;
959-
960-
public:
961-
ScopedCommandList(ur_queue_handle_legacy_t hQueue,
962-
ze_command_list_handle_t CommandList)
963-
: hQueue{hQueue} {
964-
hQueue->getThreadLocalCommandList() = CommandList;
965-
}
966-
~ScopedCommandList() {
967-
hQueue->getThreadLocalCommandList() = ze_command_list_handle_t{0};
968-
}
969-
};

test/conformance/exp_enqueue_native/CMakeLists.txt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,4 @@ if (UR_BUILD_ADAPTER_CUDA)
1515
target_link_libraries(test-exp_enqueue_native PRIVATE cudadrv)
1616
endif()
1717

18-
if (UR_BUILD_ADAPTER_L0)
19-
add_conformance_test_with_kernels_environment(
20-
exp_enqueue_native
21-
enqueue_native_level_zero.cpp
22-
)
23-
target_link_libraries(test-exp_enqueue_native PRIVATE
24-
LevelZeroLoader
25-
LevelZeroLoader-Headers
26-
)
27-
28-
target_include_directories(test-exp_enqueue_native PRIVATE
29-
${PROJECT_SOURCE_DIR}/source
30-
${PROJECT_SOURCE_DIR}/source/adapters/level_zero
31-
LevelZeroLoader-Headers
32-
)
33-
endif()
34-
3518
# TODO: Add more tests for different triples

test/conformance/exp_enqueue_native/enqueue_native_level_zero.cpp

Lines changed: 0 additions & 128 deletions
This file was deleted.

test/conformance/exp_enqueue_native/exp_enqueue_native_adapter_level_zero-v2.match

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/conformance/exp_enqueue_native/exp_enqueue_native_adapter_level_zero.match

Whitespace-only changes.

0 commit comments

Comments
 (0)