Skip to content

Commit

Permalink
Merge pull request oneapi-src#1814 from nrspruit/fix_l0_queue_cts
Browse files Browse the repository at this point in the history
[L0] Fix Queue get info and fix Queue release decrement
  • Loading branch information
kbenzie committed Jul 9, 2024
2 parents 5be5aa4 + 649c5f0 commit 658393f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions source/adapters/level_zero/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,10 @@ ur_result_t ur_queue_handle_legacy_t_::queueGetInfo(
case UR_QUEUE_INFO_REFERENCE_COUNT:
return ReturnValue(uint32_t{Queue->RefCount.load()});
case UR_QUEUE_INFO_FLAGS:
die("UR_QUEUE_INFO_FLAGS in urQueueGetInfo not implemented\n");
break;
return ReturnValue(Queue->Properties);
case UR_QUEUE_INFO_SIZE:
die("UR_QUEUE_INFO_SIZE in urQueueGetInfo not implemented\n");
break;
case UR_QUEUE_INFO_DEVICE_DEFAULT:
die("UR_QUEUE_INFO_DEVICE_DEFAULT in urQueueGetInfo not implemented\n");
break;
return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION;
case UR_QUEUE_INFO_EMPTY: {
// We can exit early if we have in-order queue.
if (Queue->isInOrderQueue()) {
Expand Down Expand Up @@ -606,8 +602,14 @@ ur_result_t ur_queue_handle_legacy_t_::queueRelease() {
{
std::scoped_lock<ur_shared_mutex> Lock(Queue->Mutex);

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

// When external reference count goes to zero it is still possible
// that internal references still exists, e.g. command-lists that
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/queue/queue_adapter_level_zero.match
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{Segmentation fault|Aborted}}

0 comments on commit 658393f

Please sign in to comment.