Skip to content

Commit 607bfb7

Browse files
authored
Merge pull request #2635 from RossBrunton/ross/v2devirtqueue
Remove virtual from L0 V2 queues
2 parents 08a3f81 + a8ff1dc commit 607bfb7

File tree

14 files changed

+138
-94
lines changed

14 files changed

+138
-94
lines changed

scripts/templates/queue_api.cpp.mako

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ from templates import helper as th
2323
// Do not edit. This file is auto generated from a template: scripts/templates/queue_api.cpp.mako
2424

2525
#include "queue_api.hpp"
26+
#include "queue_handle.hpp"
2627
#include "ur_util.hpp"
2728

28-
ur_queue_handle_t_::~ur_queue_handle_t_() {}
29+
ur_queue_t_::~ur_queue_t_() {}
2930

3031
## FUNCTION ###################################################################
3132
namespace ${x}::level_zero {
@@ -37,7 +38,7 @@ ${th.make_func_name(n, tags, obj)}(
3738
%endfor
3839
)
3940
try {
40-
return ${obj['params'][0]['name']}->${th.transform_queue_related_function_name(n, tags, obj, format=["name"])};
41+
return ${obj['params'][0]['name']}->get().${th.transform_queue_related_function_name(n, tags, obj, format=["name"])};
4142
} catch(...) {
4243
return exceptionToResult(std::current_exception());
4344
}

scripts/templates/queue_api.hpp.mako

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ from templates import helper as th
2727
#include <ur_api.h>
2828
#include <ze_api.h>
2929

30-
struct ur_queue_handle_t_ {
31-
virtual ~ur_queue_handle_t_();
30+
struct ur_queue_t_ {
31+
virtual ~ur_queue_t_();
3232

3333
virtual void deferEventFree(ur_event_handle_t hEvent) = 0;
3434

source/adapters/level_zero/v2/command_buffer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "../helpers/kernel_helpers.hpp"
1313
#include "../ur_interface_loader.hpp"
1414
#include "logger/ur_logger.hpp"
15+
#include "queue_handle.hpp"
1516

1617
namespace {
1718

@@ -141,7 +142,7 @@ ur_result_t urCommandBufferEnqueueExp(
141142
ur_exp_command_buffer_handle_t hCommandBuffer, ur_queue_handle_t hQueue,
142143
uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList,
143144
ur_event_handle_t *phEvent) try {
144-
return hQueue->enqueueCommandBuffer(
145+
return hQueue->get().enqueueCommandBuffer(
145146
hCommandBuffer->commandListManager.getZeCommandList(), phEvent,
146147
numEventsInWaitList, phEventWaitList);
147148
} catch (...) {

source/adapters/level_zero/v2/command_list_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
ur_command_list_manager::ur_command_list_manager(
1818
ur_context_handle_t context, ur_device_handle_t device,
1919
v2::raii::command_list_unique_handle &&commandList, v2::event_flags_t flags,
20-
ur_queue_handle_t queue)
20+
ur_queue_t_ *queue)
2121
: context(context), device(device),
2222
eventPool(context->eventPoolCache.borrow(device->Id.value(), flags)),
2323
zeCommandList(std::move(commandList)), queue(queue) {

source/adapters/level_zero/v2/command_list_manager.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct ur_command_list_manager : public _ur_object {
2121
ur_device_handle_t device,
2222
v2::raii::command_list_unique_handle &&commandList,
2323
v2::event_flags_t flags = v2::EVENT_FLAGS_COUNTER,
24-
ur_queue_handle_t_ *queue = nullptr);
24+
ur_queue_t_ *queue = nullptr);
2525
~ur_command_list_manager();
2626

2727
ur_result_t appendKernelLaunch(ur_kernel_handle_t hKernel, uint32_t workDim,
@@ -47,6 +47,6 @@ struct ur_command_list_manager : public _ur_object {
4747
ur_device_handle_t device;
4848
v2::raii::cache_borrowed_event_pool eventPool;
4949
v2::raii::command_list_unique_handle zeCommandList;
50-
ur_queue_handle_t queue;
50+
ur_queue_t_ *queue;
5151
std::vector<ze_event_handle_t> waitList;
5252
};

source/adapters/level_zero/v2/event.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "event_pool.hpp"
1616
#include "event_provider.hpp"
1717
#include "queue_api.hpp"
18+
#include "queue_handle.hpp"
1819

1920
#include "../ur_interface_loader.hpp"
2021

@@ -93,7 +94,7 @@ ur_event_handle_t_::ur_event_handle_t_(
9394
: hContext(hContext), event_pool(pool), hZeEvent(std::move(hZeEvent)),
9495
flags(flags), profilingData(getZeEvent()) {}
9596

96-
void ur_event_handle_t_::resetQueueAndCommand(ur_queue_handle_t hQueue,
97+
void ur_event_handle_t_::resetQueueAndCommand(ur_queue_t_ *hQueue,
9798
ur_command_t commandType) {
9899
this->hQueue = hQueue;
99100
this->commandType = commandType;
@@ -182,7 +183,7 @@ ur_event_handle_t_::getEventEndTimestampAndHandle() {
182183
return {profilingData.eventEndTimestampAddr(), getZeEvent()};
183184
}
184185

185-
ur_queue_handle_t ur_event_handle_t_::getQueue() const { return hQueue; }
186+
ur_queue_t_ *ur_event_handle_t_::getQueue() const { return hQueue; }
186187

187188
ur_context_handle_t ur_event_handle_t_::getContext() const { return hContext; }
188189

source/adapters/level_zero/v2/event.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <ur_api.h>
1616
#include <ze_api.h>
1717

18+
#include "adapters/level_zero/v2/queue_api.hpp"
1819
#include "common.hpp"
1920
#include "event_provider.hpp"
2021

@@ -61,7 +62,7 @@ struct ur_event_handle_t_ : _ur_object {
6162
const ur_event_native_properties_t *pProperties);
6263

6364
// Set the queue and command that this event is associated with
64-
void resetQueueAndCommand(ur_queue_handle_t hQueue, ur_command_t commandType);
65+
void resetQueueAndCommand(ur_queue_t_ *hQueue, ur_command_t commandType);
6566

6667
// releases event immediately
6768
ur_result_t forceRelease();
@@ -86,7 +87,7 @@ struct ur_event_handle_t_ : _ur_object {
8687
bool isProfilingEnabled() const;
8788

8889
// Queue associated with this event. Can be nullptr (for native events)
89-
ur_queue_handle_t getQueue() const;
90+
ur_queue_t_ *getQueue() const;
9091

9192
// Context associated with this event
9293
ur_context_handle_t getContext() const;
@@ -119,7 +120,7 @@ struct ur_event_handle_t_ : _ur_object {
119120

120121
// queue and commandType that this event is associated with, set by enqueue
121122
// commands
122-
ur_queue_handle_t hQueue = nullptr;
123+
ur_queue_t_ *hQueue = nullptr;
123124
ur_command_t commandType = UR_COMMAND_FORCE_UINT32;
124125

125126
v2::event_flags_t flags;

source/adapters/level_zero/v2/kernel.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "kernel.hpp"
1515
#include "memory.hpp"
1616
#include "queue_api.hpp"
17+
#include "queue_handle.hpp"
1718

1819
#include "../device.hpp"
1920
#include "../helpers/kernel_helpers.hpp"
@@ -656,8 +657,9 @@ ur_result_t urKernelGetSuggestedLocalWorkSize(
656657
std::copy(pGlobalWorkSize, pGlobalWorkSize + workDim, globalWorkSize3D);
657658

658659
ur_device_handle_t hDevice;
659-
UR_CALL(hQueue->queueGetInfo(UR_QUEUE_INFO_DEVICE, sizeof(hDevice),
660-
reinterpret_cast<void *>(&hDevice), nullptr));
660+
UR_CALL(hQueue->get().queueGetInfo(UR_QUEUE_INFO_DEVICE, sizeof(hDevice),
661+
reinterpret_cast<void *>(&hDevice),
662+
nullptr));
661663

662664
UR_CALL(getSuggestedLocalWorkSize(hDevice, hKernel->getZeHandle(hDevice),
663665
globalWorkSize3D, localWorkSize));

0 commit comments

Comments
 (0)