Skip to content

Add Debug.profiling_runtime_config consumer for aie_dtrace#55

Open
jyothees99 wants to merge 3 commits intoXilinx:masterfrom
jyothees99:aie-dtrace-profiling-runtime-config
Open

Add Debug.profiling_runtime_config consumer for aie_dtrace#55
jyothees99 wants to merge 3 commits intoXilinx:masterfrom
jyothees99:aie-dtrace-profiling-runtime-config

Conversation

@jyothees99
Copy link
Copy Markdown
Collaborator

Introduce a shared XDP utility under plugin/vp_base/profiling_runtime_config.{h,cpp} that parses the inline JSON blob carried by the new xrt.ini option Debug.profiling_runtime_config exactly once and exposes its control_instrumentation section. The schema currently recognized is control_instrumentation = { aie_tile, mem_tile, interface_tile }; any other top-level keys (e.g. event_trace) are accepted but ignored and can be wired up in a follow-up. Parse failures and unknown keys produce one-shot warnings; recognized keys produce one info line each.

The aie_dtrace plugin (aie_dtrace_plugin.cpp, aie_dtrace_ve2.cpp) now guards its hooks on profiling_runtime_config::aie_dtrace_enabled(), which returns true when either Debug.aie_dtrace is set in xrt.ini or the blob carries control_instrumentation. The corresponding load gate in xrt_coreutil (core/common/xdp/profile.cpp, in the XRT repo) uses the same auto-enable rule.

AieProfileMetadata's aie_dtrace_ini_metadata_tag constructor now prefers the blob: control_instrumentation.interface_tile is synthesized into "all:" and forwarded to getConfigMetricsForInterfaceTiles (unblocks the ddr_bandwidth use case today). aie_tile and mem_tile entries are logged for a follow-up. When the blob is empty, missing or malformed, behavior is identical to before (legacy AIE_dtrace_settings.* xrt.ini reads).

aie_trace, aie_profile, and ml_timeline are intentionally untouched and keep using their existing xrt.ini settings.

Made-with: Cursor

xrt_core::message::send(severity_level::info, "XRT", "AIE dtrace: update device.");

if (!xrt_core::config::get_aie_dtrace())
if (!profiling_runtime_config::aie_dtrace_enabled())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@jyothees99 We want to keep supporting enabling dtrace with xrt.ini for non-VAIML flow. So, we need to include the xrt ini config check too.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@IshitaGhosh I am using xrt.ini value also to determine aie_dtrace_enabled. It's OR of xrt.ini and profile_runtime_config.

Comment thread profile/plugin/vp_base/profiling_runtime_config.cpp Outdated
@jyothees99 jyothees99 force-pushed the aie-dtrace-profiling-runtime-config branch from a290d71 to c63602d Compare May 6, 2026 04:59
jyothees99 and others added 3 commits May 6, 2026 00:45
Introduce a shared XDP utility under plugin/vp_base/profiling_runtime_config.{h,cpp}
that parses the inline JSON blob carried by the new xrt.ini option
Debug.profiling_runtime_config exactly once and exposes its
control_instrumentation section. The schema currently recognized is
control_instrumentation = { aie_tile, mem_tile, interface_tile }; any
other top-level keys (e.g. event_trace) are accepted but ignored and
can be wired up in a follow-up. Parse failures and unknown keys produce
one-shot warnings; recognized keys produce one info line each.

The aie_dtrace plugin (aie_dtrace_plugin.cpp, aie_dtrace_ve2.cpp) now
guards its hooks on profiling_runtime_config::aie_dtrace_enabled(),
which returns true when either Debug.aie_dtrace is set in xrt.ini or
the blob carries control_instrumentation. The corresponding load gate
in xrt_coreutil (core/common/xdp/profile.cpp, in the XRT repo) uses
the same auto-enable rule.

AieProfileMetadata's aie_dtrace_ini_metadata_tag constructor now
prefers the blob: control_instrumentation.interface_tile is synthesized
into "all:<metric>" and forwarded to getConfigMetricsForInterfaceTiles
(unblocks the ddr_bandwidth use case today). aie_tile and mem_tile
entries are logged for a follow-up. When the blob is empty, missing or
malformed, behavior is identical to before (legacy
AIE_dtrace_settings.* xrt.ini reads).

aie_trace, aie_profile, and ml_timeline are intentionally untouched and
keep using their existing xrt.ini settings.

Made-with: Cursor
Add xdp::profiling_runtime_config::xdp_mode_effective() that derives
the effective Debug.xdp_mode value with the following precedence:

  1. Explicit [Debug] xdp_mode in xrt.ini (or set via xrt::ini::set
     before the first read) wins, whatever its value.
  2. Otherwise, when has_control_instrumentation() is true, promote
     to "xdna" so the XDNA loader/device gates pick the right variant
     without the user also having to set xdp_mode explicitly.
  3. Otherwise fall through to xrt_core::config::get_xdp_mode().

The probe for "did the user explicitly set xdp_mode" reads the [Debug]
section ptree directly via detail::get_ptree_value("Debug") so we can
distinguish "key was not in xrt.ini" from "user set the same string
as the default", matching the existing usage pattern in
aie_profile_metadata.cpp / aie_trace_metadata.cpp.

Route both per-device gates in aie_dtrace_plugin.cpp through the new
helper so the dtrace plugin attaches to the right device when the
runtime config blob alone is supplied. Other plugins still call
xrt_core::config::get_xdp_mode() directly because they are not
gated by profiling_runtime_config today; they can migrate when they
start consuming the blob.

Made-with: Cursor
…time_config

The latest VAIML profiling_runtime_config plan keeps FlexmlRT responsible
for setting Debug.aie_dtrace / Debug.aie_trace and Debug.xdp_mode in
xrt.ini via its existing enhancedProfilingXrtSettings presets ("trace"
and "ddr_bandwidth"). The blob's only role is to override the per-plugin
metric settings the legacy AIE_*_settings.* xrt.ini sections normally
carry.

That makes the blob-driven helpers added earlier on this branch redundant:

- aie_dtrace_enabled() auto-loaded the plugin when the blob carried
  control_instrumentation, even with Debug.aie_dtrace unset.
- xdp_mode_effective() promoted Debug.xdp_mode to "xdna" under the same
  condition.

FlexmlRT (or any user setting the blob) is expected to set the legacy
ini keys explicitly, so both helpers and their callers are reverted to
direct xrt_core::config::get_aie_dtrace() / get_xdp_mode() calls. The
profiling_runtime_config.h include is dropped from the dtrace plugin
and ve2 sources where it is no longer needed.

What stays: the blob parser (is_set / has_control_instrumentation /
control_instrumentation()) and the AieProfileMetadata
aie_dtrace_ini_metadata_tag constructor's blob-driven interface_tile
metric override -- this is the path through which the blob actually
drives aie_dtrace metric settings today.

Signed-off-by: Jyotheeswar Ganne <Jyotheeswar.Ganne@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@jyothees99 jyothees99 force-pushed the aie-dtrace-profiling-runtime-config branch from c63602d to 27d8364 Compare May 6, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants