Skip to content

Commit 658393f

Browse files
authored
Merge pull request #1814 from nrspruit/fix_l0_queue_cts
[L0] Fix Queue get info and fix Queue release decrement
2 parents 5be5aa4 + 649c5f0 commit 658393f

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
@@ -365,14 +365,10 @@ ur_result_t ur_queue_handle_legacy_t_::queueGetInfo(
365365
case UR_QUEUE_INFO_REFERENCE_COUNT:
366366
return ReturnValue(uint32_t{Queue->RefCount.load()});
367367
case UR_QUEUE_INFO_FLAGS:
368-
die("UR_QUEUE_INFO_FLAGS in urQueueGetInfo not implemented\n");
369-
break;
368+
return ReturnValue(Queue->Properties);
370369
case UR_QUEUE_INFO_SIZE:
371-
die("UR_QUEUE_INFO_SIZE in urQueueGetInfo not implemented\n");
372-
break;
373370
case UR_QUEUE_INFO_DEVICE_DEFAULT:
374-
die("UR_QUEUE_INFO_DEVICE_DEFAULT in urQueueGetInfo not implemented\n");
375-
break;
371+
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
376372
case UR_QUEUE_INFO_EMPTY: {
377373
// We can exit early if we have in-order queue.
378374
if (Queue->isInOrderQueue()) {
@@ -606,8 +602,14 @@ ur_result_t ur_queue_handle_legacy_t_::queueRelease() {
606602
{
607603
std::scoped_lock<ur_shared_mutex> Lock(Queue->Mutex);
608604

609-
if ((--Queue->RefCountExternal) != 0)
605+
if ((--Queue->RefCountExternal) != 0) {
606+
// When an External Reference exists one still needs to decrement the
607+
// internal reference count. When the External Reference count == 0, then
608+
// cleanup of the queue begins and the final decrement of the internal
609+
// reference count is completed.
610+
Queue->RefCount.decrementAndTest();
610611
return UR_RESULT_SUCCESS;
612+
}
611613

612614
// When external reference count goes to zero it is still possible
613615
// 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)