Skip to content

Commit cc2b985

Browse files
authored
[SYCL] [UR] [Graphs] Added missing UR_CALLs (#19143)
Small fixes flagged by static analyzer: - Added missing `UR_CALL` and `UR_CALL_NOCHECK` to `ur::level_zero` function calls in Command Buffer, - Removed one redundant copy of `shared_ptr`
1 parent e5a13e9 commit cc2b985

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

sycl/source/detail/graph/graph_impl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ graph_impl::getLastInorderNode(sycl::detail::queue_impl *Queue) {
681681

682682
void graph_impl::setLastInorderNode(sycl::detail::queue_impl &Queue,
683683
std::shared_ptr<node_impl> Node) {
684-
MInorderQueueMap[Queue.weak_from_this()] = Node;
684+
MInorderQueueMap[Queue.weak_from_this()] = std::move(Node);
685685
}
686686

687687
void graph_impl::makeEdge(std::shared_ptr<node_impl> Src,

unified-runtime/source/adapters/level_zero/command_buffer.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "helpers/kernel_helpers.hpp"
1313
#include "helpers/mutable_helpers.hpp"
1414
#include "logger/ur_logger.hpp"
15+
#include "ur/ur.hpp"
1516
#include "ur_api.h"
1617
#include "ur_interface_loader.hpp"
1718
#include "ur_level_zero.hpp"
@@ -485,16 +486,16 @@ ur_exp_command_buffer_handle_t_::ur_exp_command_buffer_handle_t_(
485486
IsUpdatable(Desc->isUpdatable), IsProfilingEnabled(Desc->enableProfiling),
486487
InOrderRequested(Desc->isInOrder), IsInOrderCmdList(IsInOrderCmdList),
487488
UseImmediateAppendPath(UseImmediateAppendPath) {
488-
ur::level_zero::urContextRetain(Context);
489-
ur::level_zero::urDeviceRetain(Device);
489+
UR_CALL_NOCHECK(ur::level_zero::urContextRetain(Context));
490+
UR_CALL_NOCHECK(ur::level_zero::urDeviceRetain(Device));
490491
}
491492

492493
void ur_exp_command_buffer_handle_t_::cleanupCommandBufferResources() {
493494
// Release the memory allocated to the Context stored in the command_buffer
494-
ur::level_zero::urContextRelease(Context);
495+
UR_CALL_NOCHECK(ur::level_zero::urContextRelease(Context));
495496

496497
// Release the device
497-
ur::level_zero::urDeviceRelease(Device);
498+
UR_CALL_NOCHECK(ur::level_zero::urDeviceRelease(Device));
498499

499500
// Release the memory allocated to the CommandList stored in the
500501
// command_buffer
@@ -586,7 +587,7 @@ void ur_exp_command_buffer_handle_t_::cleanupCommandBufferResources() {
586587

587588
for (auto &AssociatedKernel : KernelsList) {
588589
ReleaseIndirectMem(AssociatedKernel);
589-
ur::level_zero::urKernelRelease(AssociatedKernel);
590+
UR_CALL_NOCHECK(ur::level_zero::urKernelRelease(AssociatedKernel));
590591
}
591592
}
592593

@@ -1068,10 +1069,10 @@ ur_result_t urCommandBufferAppendKernelLaunchExp(
10681069
CommandBuffer->KernelsList.push_back(KernelAlternatives[i]);
10691070
}
10701071

1071-
ur::level_zero::urKernelRetain(Kernel);
1072+
UR_CALL(ur::level_zero::urKernelRetain(Kernel));
10721073
// Retain alternative kernels if provided
10731074
for (size_t i = 0; i < NumKernelAlternatives; i++) {
1074-
ur::level_zero::urKernelRetain(KernelAlternatives[i]);
1075+
UR_CALL(ur::level_zero::urKernelRetain(KernelAlternatives[i]));
10751076
}
10761077

10771078
if (Command) {
@@ -1509,8 +1510,8 @@ ur_result_t waitForDependencies(ur_exp_command_buffer_handle_t CommandBuffer,
15091510
(WaitCommandList->first, CommandBuffer->WaitEvent->ZeEvent,
15101511
CommandBuffer->WaitEvent->WaitList.Length,
15111512
CommandBuffer->WaitEvent->WaitList.ZeEventList));
1512-
Queue->executeCommandList(WaitCommandList, false /*IsBlocking*/,
1513-
false /*OKToBatchCommand*/);
1513+
UR_CALL(Queue->executeCommandList(WaitCommandList, false /*IsBlocking*/,
1514+
false /*OKToBatchCommand*/));
15141515
MustSignalWaitEvent = false;
15151516
}
15161517
// Given WaitEvent was created without specifying Counting Events, then this

0 commit comments

Comments
 (0)