Skip to content

Commit d76b71a

Browse files
authored
[SYCL][NATIVECPU] added initial urQueueGetInfo implementation (#18646)
An initial implementation of urQueueGetInfo to help pass more e2e tests. Note that this PR does not yet address thread safety of the Queue API - this will be done in a subsequent PR. Fixes at least `Basic/in_order_queue_status_khr_empty.cpp` on NativeCPU.
1 parent 1dbfc10 commit d76b71a

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

unified-runtime/source/adapters/native_cpu/queue.cpp

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,26 @@
1414
#include "ur/ur.hpp"
1515
#include "ur_api.h"
1616

17-
UR_APIEXPORT ur_result_t UR_APICALL urQueueGetInfo(ur_queue_handle_t /*hQueue*/,
18-
ur_queue_info_t /*propName*/,
19-
size_t /*propSize*/,
20-
void * /*pPropValue*/,
21-
size_t * /*pPropSizeRet*/) {
22-
23-
DIE_NO_IMPLEMENTATION;
17+
UR_APIEXPORT ur_result_t UR_APICALL urQueueGetInfo(ur_queue_handle_t hQueue,
18+
ur_queue_info_t propName,
19+
size_t propSize,
20+
void *pPropValue,
21+
size_t *pPropSizeRet) {
22+
23+
UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet);
24+
25+
switch (propName) {
26+
case UR_QUEUE_INFO_CONTEXT:
27+
return ReturnValue(hQueue->getContext());
28+
case UR_QUEUE_INFO_DEVICE:
29+
return ReturnValue(hQueue->getDevice());
30+
case UR_QUEUE_INFO_REFERENCE_COUNT:
31+
return ReturnValue(hQueue->getReferenceCount());
32+
case UR_QUEUE_INFO_EMPTY:
33+
return ReturnValue(hQueue->isEmpty());
34+
default:
35+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
36+
}
2437
}
2538

2639
UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate(

unified-runtime/source/adapters/native_cpu/queue.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ struct ur_queue_handle_t_ : RefCounted {
4747

4848
bool isProfiling() const { return profilingEnabled; }
4949

50+
bool isEmpty() const {
51+
// TODO: check that events are done if there were any
52+
return events.size() == 0;
53+
}
54+
5055
private:
5156
ur_device_handle_t device;
5257
ur_context_handle_t context;

0 commit comments

Comments
 (0)