Skip to content

Enable dtrace for npu3#9888

Open
garimadhaked wants to merge 3 commits into
Xilinx:masterfrom
garimadhaked:enable_dtrace_for_npu3
Open

Enable dtrace for npu3#9888
garimadhaked wants to merge 3 commits into
Xilinx:masterfrom
garimadhaked:enable_dtrace_for_npu3

Conversation

@garimadhaked

Copy link
Copy Markdown
Collaborator
  • Enable dtrace plugin for NPU3
  • Fix dtrace run hooks polling an unsubmitted command
    • get_xdp_kernel_data() called run_impl->state(), which polls the hwqueue. The XDP dtrace run_constructor/run_start hooks fire from the run_impl constructor and immediately before submit, when the command has no fence id yet. Polling it threw 'Cannot poll a command that has not been submitted', breaking HW-context/runner creation (e.g. FlexMLRT) when aie_dtrace was enabled.

Wire up the AIE dtrace plugin in the client build path so it is loaded
when Debug.aie_dtrace is enabled. dtrace::load() now selects the loader
based on build type (sdk_loader on client Windows, module_loader
otherwise) and picks the NPU3-specific plugin name via AMD_XDP_NPU3,
matching the existing aie_profile/aie_trace/aie_halt plugins.
get_xdp_kernel_data() called run_impl->state(), which polls the hwqueue. The XDP dtrace run_constructor/run_start hooks fire from the run_impl constructor and immediately before submit, when the command has no fence id yet. Polling it threw 'Cannot poll a command that has not been submitted', breaking HW-context/runner creation (e.g. FlexMLRT) when aie_dtrace was enabled. Read the cached ERT packet state directly instead of polling.

@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 src/runtime_src/core/common/xdp/profile.cpp Outdated
Comment thread src/runtime_src/core/common/xdp/profile.cpp Outdated
Address review feedback: std::getenv is not permitted; switch to the
xrt_core::utils env helpers (is_env for boolean checks, getenv for value
comparison) and drop the now-unneeded cstring/cstdlib includes and the
getenv MSVC warning suppression.

Signed-off-by: Garima Dhaked <garima.dhaked@amd.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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

@garimadhaked garimadhaked requested a review from stsoe July 6, 2026 11:44
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