Skip to content

Commit 0a0483e

Browse files
authored
[hip] Add trace zones to copy/fill/update buffer commands. (#19544)
They were missing in the hip stream case. Signed-off-by: Andrew Woloszyn <[email protected]>
1 parent 47ccd93 commit 0a0483e

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

runtime/src/iree/hal/drivers/hip/stream_command_buffer.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ static iree_status_t iree_hal_hip_stream_command_buffer_fill_buffer(
328328
iree_hal_buffer_byte_offset(target_ref.buffer) + target_ref.offset;
329329
hipDeviceptr_t dst = (uint8_t*)target_device_buffer + target_offset;
330330
size_t num_elements = target_ref.length / pattern_length;
331+
IREE_HAL_STREAM_TRACE_ZONE_BEGIN(command_buffer->tracing_context,
332+
&command_buffer->tracing_event_list,
333+
IREE_HAL_STREAM_TRACING_VERBOSITY_FINE);
331334

332335
switch (pattern_length) {
333336
case 4: {
@@ -359,7 +362,9 @@ static iree_status_t iree_hal_hip_stream_command_buffer_fill_buffer(
359362
return iree_make_status(IREE_STATUS_INTERNAL,
360363
"unsupported fill pattern length");
361364
}
362-
365+
IREE_HAL_STREAM_TRACE_ZONE_END(command_buffer->tracing_context,
366+
&command_buffer->tracing_event_list,
367+
IREE_HAL_STREAM_TRACING_VERBOSITY_FINE);
363368
IREE_TRACE_ZONE_END(z0);
364369
return iree_ok_status();
365370
}
@@ -397,12 +402,17 @@ static iree_status_t iree_hal_hip_stream_command_buffer_update_buffer(
397402
hipDeviceptr_t dst = (uint8_t*)target_device_buffer +
398403
iree_hal_buffer_byte_offset(target_ref.buffer) +
399404
target_ref.offset;
405+
IREE_HAL_STREAM_TRACE_ZONE_BEGIN(command_buffer->tracing_context,
406+
&command_buffer->tracing_event_list,
407+
IREE_HAL_STREAM_TRACING_VERBOSITY_FINE);
400408
IREE_HIP_RETURN_AND_END_ZONE_IF_ERROR(
401409
z0, command_buffer->hip_symbols,
402410
hipMemcpyHtoDAsync(dst, (void*)src, target_ref.length,
403411
command_buffer->hip_stream),
404412
"hipMemcpyHtoDAsync");
405-
413+
IREE_HAL_STREAM_TRACE_ZONE_END(command_buffer->tracing_context,
414+
&command_buffer->tracing_event_list,
415+
IREE_HAL_STREAM_TRACING_VERBOSITY_FINE);
406416
IREE_TRACE_ZONE_END(z0);
407417
return iree_ok_status();
408418
}
@@ -417,6 +427,9 @@ static iree_status_t iree_hal_hip_stream_command_buffer_copy_buffer(
417427

418428
IREE_RETURN_AND_END_ZONE_IF_ERROR(
419429
z0, iree_hal_hip_stream_command_buffer_flush_collectives(command_buffer));
430+
IREE_HAL_STREAM_TRACE_ZONE_BEGIN(command_buffer->tracing_context,
431+
&command_buffer->tracing_event_list,
432+
IREE_HAL_STREAM_TRACING_VERBOSITY_FINE);
420433

421434
hipDeviceptr_t target_device_buffer = iree_hal_hip_buffer_device_pointer(
422435
iree_hal_buffer_allocated_buffer(target_ref.buffer));
@@ -435,6 +448,10 @@ static iree_status_t iree_hal_hip_stream_command_buffer_copy_buffer(
435448
command_buffer->hip_stream),
436449
"hipMemcpyAsync");
437450

451+
IREE_HAL_STREAM_TRACE_ZONE_END(command_buffer->tracing_context,
452+
&command_buffer->tracing_event_list,
453+
IREE_HAL_STREAM_TRACING_VERBOSITY_FINE);
454+
438455
IREE_TRACE_ZONE_END(z0);
439456
return iree_ok_status();
440457
}

0 commit comments

Comments
 (0)