Skip to content

dynamic tracing compiler performance optimization#305

Open
AdvaitNaik wants to merge 4 commits into
Xilinx:main-gefrom
AdvaitNaik:dtrace_performance_optimization
Open

dynamic tracing compiler performance optimization#305
AdvaitNaik wants to merge 4 commits into
Xilinx:main-gefrom
AdvaitNaik:dtrace_performance_optimization

Conversation

@AdvaitNaik

@AdvaitNaik AdvaitNaik commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Problem solved by the commit

  • Eliminated unnecessary buffer copies in dtrace result serialization APIs (get_dtrace_result_file and update_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() and control::create_result_file/create_result_buffer to operate directly on device buffer addresses

  • Changed action::serialize() methods to return bool to indicate probe fire status, result- zero empty files in scenarios like capturing intermediate multi run hangs

Risks (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

Copilot AI review requested due to automatic review settings June 15, 2026 23:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() and update_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 all action::serialize() implementations to use raw uint32_t* buffer pointers (result + mem) instead of std::vector<uint32_t>&.
  • Moved dtrace_buffer_info into dtrace namespace (in control.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.

Comment thread src/cpp/dtrace/control/control.cpp
Comment thread src/cpp/dtrace/control/control.cpp
Comment thread src/cpp/dtrace/control/control.cpp Outdated
Comment thread src/cpp/dtrace/action/printa.cpp
Comment thread src/cpp/dtrace/dtrace.cpp
@github-actions

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@AdvaitNaik AdvaitNaik force-pushed the dtrace_performance_optimization branch 2 times, most recently from 5f60820 to 5f127f7 Compare June 16, 2026 01:13
@AdvaitNaik AdvaitNaik requested review from sonals and xuhz June 16, 2026 01:17

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread test/dtrace_test/dtrace_test.cpp
AdvaitNaik and others added 4 commits June 29, 2026 11:38
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>
@AdvaitNaik AdvaitNaik force-pushed the dtrace_performance_optimization branch from 16fd8fb to 7df88f9 Compare June 29, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants