Skip to content

Commit c7cc342

Browse files
authored
Add bytes_copied field to memory copy view kind (#2)
Add `bytes_copied` to specify the number of bytes copied during memcopy operation.
1 parent 9334e3b commit c7cc342

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

sdk/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
build*/
2+
venv/
3+
.vscode/
4+
.vim/
5+
.cache/
6+
compile_commands.json
7+
CMakeUserPresets.json
8+
error_diff.txt

sdk/include/pti_view.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ typedef struct pti_view_record_memory_copy {
184184
uint64_t _end_timestamp; //!< Timestamp of memory copy completion on device, ns
185185
uint64_t _submit_timestamp; //!< Timestamp of memory copy command list submission
186186
//!< to device, ns
187+
uint64_t _bytes_copied; //!< number of bytes copied
187188
} pti_view_record_memory_copy;
188189

189190
/**

sdk/src/view_handler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ inline void MemCopyEvent(void* /*data*/, const ZeKernelCommandExecutionRecord& r
639639
record._queue_handle = rec.queue_;
640640
record._device_handle = rec.device_;
641641
record._context_handle = rec.context_;
642+
record._bytes_copied = rec.bytes_xfered_;
642643

643644
GetDeviceId(record._pci_address, rec);
644645
SetMemCopyType(record, rec);

sdk/test/main_dpcgemm_fixture.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ bool kernel_has_task_begin0_record = false;
3030
bool kernel_has_enqk_begin0_record = false;
3131
bool demangled_kernel_name = false;
3232
bool kernel_launch_func_name = false;
33+
uint64_t memory_bytes_copied = 0;
3334
uint64_t memory_view_record_count = 0;
3435
uint64_t kernel_view_record_count = 0;
3536
uint64_t kernel_has_sycl_file_count = 0;
@@ -149,6 +150,7 @@ class MainFixtureTest : public ::testing::Test {
149150
kernel_has_nonmonotonic_record = false;
150151
kernel_has_task_begin0_record = false;
151152
kernel_has_enqk_begin0_record = false;
153+
memory_bytes_copied = 0;
152154
memory_view_record_count = 0;
153155
kernel_view_record_count = 0;
154156
kernel_has_sycl_file_count = 0;
@@ -253,6 +255,7 @@ class MainFixtureTest : public ::testing::Test {
253255
break;
254256
}
255257
case pti_view_kind::PTI_VIEW_DEVICE_GPU_MEM_COPY: {
258+
memory_bytes_copied = reinterpret_cast<pti_view_record_memory_copy*>(ptr)->_bytes_copied;
256259
memory_view_record_created = true;
257260
memory_view_record_count += 1;
258261
break;
@@ -410,6 +413,7 @@ TEST_F(MainFixtureTest, MemoryViewRecordCreated) {
410413
EXPECT_EQ(ptiViewSetCallbacks(BufferRequested, BufferCompleted), pti_result::PTI_SUCCESS);
411414
RunGemm();
412415
EXPECT_EQ(memory_view_record_created, true);
416+
EXPECT_GT(memory_bytes_copied, 0);
413417
}
414418

415419
TEST_F(MainFixtureTest, KernelViewRecordCreated) {

0 commit comments

Comments
 (0)