XDP: skip run-lifecycle hooks for XDP_KERNEL* internal runs#9841
Open
jyothees99 wants to merge 1 commit into
Open
XDP: skip run-lifecycle hooks for XDP_KERNEL* internal runs#9841jyothees99 wants to merge 1 commit into
jyothees99 wants to merge 1 commit into
Conversation
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
XDP plugins that submit their own ELF (e.g. aie_halt/ve2, aie_nop_util,
and future plugin configurations) create an xrt::run with the kernel
name "XDP_KERNEL:{IPUV1CNN}". The run-lifecycle XDP hooks
(run_constructor / run_start / run_wait) would then attempt to
instrument these internal runs through whatever plugin currently
registers the callbacks (today aie_dtrace), which is incorrect and
order-dependent on plugin load.
Add a tiny file-local is_xdp_internal_kernel() helper that does a
prefix match on the (already colon-stripped) kernel name, and skip
the dispatch at the top of each of the three top-level xrt_core::xdp
run dispatchers. The check runs first so any future XDP plugin
consumer added below the config gate inherits the same skip rule.
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Jyotheeswar Ganne <Jyotheeswar.Ganne@amd.com>
1e07fd4 to
f5a829f
Compare
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
jvillarre
approved these changes
May 29, 2026
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.
XDP plugins that submit their own ELF (e.g. aie_halt/ve2, aie_nop_util, and future plugin configurations) create an xrt::run with the kernel name "XDP_KERNEL:{IPUV1CNN}". The run-lifecycle XDP hooks (run_constructor / run_start / run_wait) would then attempt to instrument these internal runs through whatever plugin currently registers the callbacks (today aie_dtrace), which is incorrect and order-dependent on plugin load.
Add a tiny file-local is_xdp_internal_kernel() helper that does a prefix match on the (already colon-stripped) kernel name, and skip the dispatch at the top of each of the three top-level xrt_core::xdp run dispatchers. The check runs first so any future XDP plugin consumer added below the config gate inherits the same skip rule.
Problem solved by the commit
XDP run-lifecycle hooks (run_constructor / run_start / run_wait) fire on every xrt::run, including those created inside XDP plugins themselves (e.g. aie_halt/ve2 and aie_nop_util use xrt::ext::kernel{..., "XDP_KERNEL:{IPUV1CNN}"} to submit control-code ELFs). This makes XDP self-instrument its own internal runs. Skip the hooks for any run whose kernel name starts with XDP_KERNEL.
Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered
PR #9721 (commit 751273f) added the three run-lifecycle XDP hooks but did not filter out XDP-internal runs. Today the issue is masked by load order — aie_trace::updateAIEDevice calls submitNopElf before aie_dtrace is loaded, so the callback is still null. We caught the latent bug while planning to extend the ELF-submission pattern to all XDP plugin configurations, and confirmed it by temporarily calling submitNopElf at the end of AieDtracePlugin::updateAIEDtraceDevice (after dtrace is registered): without the fix, dtrace's hook fires on the nop ELF.
How problem was solved, alternative solutions (if any) and why they were rejected
Added a file-local is_xdp_internal_kernel() helper in src/runtime_src/core/common/xdp/profile.cpp that prefix-matches the kernel name against "XDP_KERNEL", called as the first check in each top-level dispatcher (run_constructor / run_start / run_wait). One file, one helper, three early-returns.
Alternatives rejected:
Risks (if any) associated the changes in the commit
No
What has been tested and how, request additional testing if necessary
Tested a vaiml design