dynamic tracing compiler result buffer#295
Open
AdvaitNaik wants to merge 3 commits into
Open
Conversation
Signed-off-by: advanaik <AdvaitHemant.Naik@amd.com>
Signed-off-by: advanaik <AdvaitHemant.Naik@amd.com>
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the dynamic tracing (dtrace) compiler/runtime to (1) support probe declarations by either basename or full path, and (2) enable buffered JSON result collection to reduce per-iteration filesystem I/O in multi-run scenarios.
Changes:
- Emit and accept
jprobe:keys for both basename and full file path variants (line + annotation probes). - Add a new public API
update_dtrace_result_buffer(...)to serialize results into an in-memorynlohmann::ordered_jsonobject (JSON mode) instead of writing a file per iteration. - Refactor result serialization ordering by precomputing the action execution order once (
m_result_actions) and reusing it for file and buffer outputs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/dtrace_test/dtrace_test.cpp | Switches test include to dtrace/dtrace.h to match new include-root usage. |
| test/dtrace_test/CMakeLists.txt | Updates include directory to ${AIEBU_SOURCE_DIR}/src/cpp to support dtrace/... includes. |
| src/cpp/tools/trace_probe.cpp | Emits both basename and full-path jprobe: probe lines. |
| src/cpp/dtrace/parser/parser.cpp | Populates map entries for both basename and full-path probe keys. |
| src/cpp/dtrace/dtrace.h | Exposes new buffered JSON result API and includes nlohmann JSON in the public header. |
| src/cpp/dtrace/dtrace.cpp | Implements update_dtrace_result_buffer(...) to generate results without file I/O. |
| src/cpp/dtrace/control/control.h | Adds create_result_buffer(...) and stores precomputed result-action ordering. |
| src/cpp/dtrace/control/control.cpp | Refactors result generation to reuse m_result_actions and adds JSON buffer serialization. |
Comments suppressed due to low confidence (1)
src/cpp/dtrace/control/control.h:20
- This header now uses
std::shared_ptrandstd::pairin the newm_result_actionsmember but doesn’t include<memory>/<utility>directly. It currently compiles only via transitive includes, which is brittle for a public header.
#include "json/nlohmann/json.hpp"
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Advait Hemant Naik <advanaik@amd.com>
690404c to
40d864d
Compare
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
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
Every XRT
run.dump_dtrace_buffer()performs file I/O to dump dtrace results — once per iteration. In multi-run scenarios (runlists or latency benchmarks with 100+ iterations on the same run), this creates N files with N file system round-trips.Enhanced compiler to accept both bare filenames and full paths in probe declarations
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
This is a performance enhancement with dtrace JSON output support; eliminating per-run file I/O when opted in.
Dtrace probe declarations now support both file names and file paths, fixing conflicts when multiple files with the same basename are included from different directories
How problem was solved, alternative solutions (if any) and why they were rejected
Accumulate dtrace JSON results in an in-memory nlohmann::ordered_json buffer. Each
run.dump_dtrace_buffer()appends to this buffer. A single file is dumped when the hw context is destroyed. Only applies forDebug.dtrace_output_json_format = true(JSON mode). Python output path is unchanged.Risks (if any) associated the changes in the commit
NA
What has been tested and how, request additional testing if necessary
Tested on windows medusa board and the feature works as expected
Documentation impact (if any)
https://amd.atlassian.net/wiki/spaces/AIE/pages/779183759/cert+dynamic+tracing+dtrace+compiler+APIs