dynamic tracing compiler performance optimization#305
Open
AdvaitNaik wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes dynamic tracing (dtrace) result serialization by removing intermediate host-side buffer copies and operating directly on device-mapped buffer addresses during result generation.
Changes:
- Refactored
get_dtrace_result_file()andupdate_dtrace_result_buffer()to pass per-uC device buffer metadata directly into the control-layer serialization APIs. - Updated
dtrace::control::create_result_file()/create_result_buffer()and allaction::serialize()implementations to use rawuint32_t*buffer pointers (result + mem) instead ofstd::vector<uint32_t>&. - Moved
dtrace_buffer_infointodtracenamespace (incontrol.h) and updated call sites accordingly.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/cpp/dtrace/dtrace.cpp | Removes result buffer copy/split/recombine; passes buffer info map directly to control serialization. |
| src/cpp/dtrace/control/control.h | Introduces dtrace::dtrace_buffer_info and updates result serialization API signatures. |
| src/cpp/dtrace/control/control.cpp | Serializes actions directly from device-mapped buffers via pointer-based action::serialize(). |
| src/cpp/dtrace/action/action_control.h | Changes action::serialize() virtual interface to accept uint32_t* buffers. |
| src/cpp/dtrace/action/break.cpp | Updates serialize signatures to pointer-based interface. |
| src/cpp/dtrace/action/count.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/host_timestamp.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/host_timestamps.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/mask_write_register.cpp | Updates mem-buffer serialization to write via uint32_t*. |
| src/cpp/dtrace/action/operation.cpp | Updates serialize signatures to pointer-based interface. |
| src/cpp/dtrace/action/print.cpp | Updates serialize signatures to pointer-based interface. |
| src/cpp/dtrace/action/printa.cpp | Updates helper/signatures to pointer-based interface for profile printing. |
| src/cpp/dtrace/action/profile.cpp | Updates serialize signatures to pointer-based interface. |
| src/cpp/dtrace/action/read_handshake.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/read_mem.cpp | Updates serialize helper/signatures to pointer-based interface (reads/resets mem buffer in-place). |
| src/cpp/dtrace/action/read_register.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/sleep.cpp | Updates serialize signatures to pointer-based interface. |
| src/cpp/dtrace/action/timestamp.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/timestamp32.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/timestamps.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/timestamps32.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/write_handshake.cpp | Updates serialize helper/signatures to pointer-based interface. |
| src/cpp/dtrace/action/write_mem.cpp | Updates serialize signatures to pointer-based interface. |
| src/cpp/dtrace/action/write_register.cpp | Updates serialize signatures to pointer-based interface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
5f60820 to
5f127f7
Compare
Signed-off-by: Advait Hemant Naik <advanaik@amd.com>
Signed-off-by: Advait Hemant Naik <advanaik@amd.com>
Signed-off-by: Advait Hemant Naik <advanaik@amd.com>
Signed-off-by: advanaik <AdvaitHemant.Naik@amd.com>
16fd8fb to
7df88f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem solved by the commit
Eliminated unnecessary buffer copies in dtrace result serialization APIs (
get_dtrace_result_fileandupdate_dtrace_result_buffer). Previously, these functions performed multiple memory copies: reading device memory into temporary vectors, splitting into control/mem buffers, passing to internal APIs, then copying modified buffers back to device memory.Fixed read actions input format (decimal/hexadecimal) bug
Skip empty result file creation when no probes fire and defer file creation until first probe fires
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
No bug fix. Performance optimization identified during code review of PR #295.
How problem was solved, alternative solutions (if any) and why they were rejected
Changed
action::serialize()andcontrol::create_result_file/create_result_bufferto operate directly on device buffer addressesChanged
action::serialize()methods to return bool to indicate probe fire status, result- zero empty files in scenarios like capturing intermediate multi run hangsRisks (if any) associated the changes in the commit
Low
What has been tested and how, request additional testing if necessary
Simnow baremetal environment testcase
Tested on windows medusa board and the features work as expected
cmake testcase for python and json result output
Documentation impact (if any)
NA