Skip to content

Commit 649c5f0

Browse files
committed
[L0] Fix Queue get info and fix Queue release decrement
Signed-off-by: Neil R. Spruit <neil.r.spruit@intel.com>
1 parent 00ca0da commit 649c5f0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

source/adapters/level_zero/queue.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueGetInfo(
364364
case UR_QUEUE_INFO_REFERENCE_COUNT:
365365
return ReturnValue(uint32_t{Queue->RefCount.load()});
366366
case UR_QUEUE_INFO_FLAGS:
367-
die("UR_QUEUE_INFO_FLAGS in urQueueGetInfo not implemented\n");
368-
break;
367+
return ReturnValue(Queue->Properties);
369368
case UR_QUEUE_INFO_SIZE:
370-
die("UR_QUEUE_INFO_SIZE in urQueueGetInfo not implemented\n");
371-
break;
372369
case UR_QUEUE_INFO_DEVICE_DEFAULT:
373-
die("UR_QUEUE_INFO_DEVICE_DEFAULT in urQueueGetInfo not implemented\n");
374-
break;
370+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
375371
case UR_QUEUE_INFO_EMPTY: {
376372
// We can exit early if we have in-order queue.
377373
if (Queue->isInOrderQueue()) {
@@ -602,8 +598,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueRelease(
602598
{
603599
std::scoped_lock<ur_shared_mutex> Lock(Queue->Mutex);
604600

605-
if ((--Queue->RefCountExternal) != 0)
601+
if ((--Queue->RefCountExternal) != 0) {
602+
// When an External Reference exists one still needs to decrement the
603+
// internal reference count. When the External Reference count == 0, then
604+
// cleanup of the queue begins and the final decrement of the internal
605+
// reference count is completed.
606+
Queue->RefCount.decrementAndTest();
606607
return UR_RESULT_SUCCESS;
608+
}
607609

608610
// When external reference count goes to zero it is still possible
609611
// that internal references still exists, e.g. command-lists that
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{Segmentation fault|Aborted}}
1+

0 commit comments

Comments
 (0)