Skip to content

Commit be622e7

Browse files
committed
[HIP][CMD-BUF] HIP coverity fixes
* Don't throw from constructor * Move rather than copy nodes during sync-point registration * Initalize `NextSyncPoint`
1 parent 273ac6b commit be622e7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

source/adapters/hip/command_buffer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ ur_exp_command_buffer_handle_t_::ur_exp_command_buffer_handle_t_(
5050
ur_context_handle_t hContext, ur_device_handle_t hDevice, bool IsUpdatable)
5151
: Context(hContext), Device(hDevice),
5252
IsUpdatable(IsUpdatable), HIPGraph{nullptr}, HIPGraphExec{nullptr},
53-
RefCountInternal{1}, RefCountExternal{1} {
53+
RefCountInternal{1}, RefCountExternal{1}, NextSyncPoint{0} {
5454
urContextRetain(hContext);
5555
urDeviceRetain(hDevice);
5656
}
@@ -65,11 +65,11 @@ ur_exp_command_buffer_handle_t_::~ur_exp_command_buffer_handle_t_() {
6565
UR_TRACE(urDeviceRelease(Device));
6666

6767
// Release the memory allocated to the HIPGraph
68-
UR_CHECK_ERROR(hipGraphDestroy(HIPGraph));
68+
(void)hipGraphDestroy(HIPGraph);
6969

7070
// Release the memory allocated to the HIPGraphExec
7171
if (HIPGraphExec) {
72-
UR_CHECK_ERROR(hipGraphExecDestroy(HIPGraphExec));
72+
(void)hipGraphExecDestroy(HIPGraphExec);
7373
}
7474
}
7575

source/adapters/hip/command_buffer.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ struct ur_exp_command_buffer_handle_t_ {
254254
~ur_exp_command_buffer_handle_t_();
255255

256256
void registerSyncPoint(ur_exp_command_buffer_sync_point_t SyncPoint,
257-
std::shared_ptr<hipGraphNode_t> HIPNode) {
258-
SyncPoints[SyncPoint] = HIPNode;
257+
std::shared_ptr<hipGraphNode_t> &&HIPNode) {
258+
SyncPoints[SyncPoint] = std::move(HIPNode);
259259
NextSyncPoint++;
260260
}
261261

@@ -269,7 +269,7 @@ struct ur_exp_command_buffer_handle_t_ {
269269
ur_exp_command_buffer_sync_point_t
270270
addSyncPoint(std::shared_ptr<hipGraphNode_t> HIPNode) {
271271
ur_exp_command_buffer_sync_point_t SyncPoint = NextSyncPoint;
272-
registerSyncPoint(SyncPoint, HIPNode);
272+
registerSyncPoint(SyncPoint, std::move(HIPNode));
273273
return SyncPoint;
274274
}
275275
uint32_t incrementInternalReferenceCount() noexcept {

0 commit comments

Comments
 (0)