Unified tracing API: merge ITT/Tracy instrumentation#7250
Unified tracing API: merge ITT/Tracy instrumentation#7250v4xsh wants to merge 10 commits intoTheHPXProject:masterfrom
Conversation
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
|
Can one of the admins verify this patch? |
Up to standards ✅🟢 Issues
|
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a unified hpx::tracing entry point that consolidates Tracy and ITT instrumentation, and refactors the scheduling loop to use the new abstractions instead of inline ITT calls. It also adds helpers to derive ITT task metadata from thread_data descriptions.
Changes:
- Added ITT backend support to
hpx::tracing(compile-time selected when Tracy is not enabled). - Replaced inline ITT instrumentation in the scheduling loop with
hpx::tracing::{itt_loop_context, itt_task_region}. - Added
threads::get_thread_region_init_datato translatethread_datadescriptions into unified ITT task metadata.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/core/tracing/include/hpx/tracing/tracing.hpp | Adds unified tracing API types plus ITT-specific RAII types (and no-op fallbacks). |
| libs/core/tracing/src/tracing.cpp | Implements ITT backend for unified tracing (loop context + task regions). |
| libs/core/tracing/CMakeLists.txt | Links tracing module with hpx_itt_notify when ITTNotify is enabled. |
| libs/core/threading_base/include/hpx/threading_base/thread_data.hpp | Declares get_thread_region_init_data (real vs. no-op depending on ITT support). |
| libs/core/threading_base/src/thread_data.cpp | Implements get_thread_region_init_data using thread_description (string handle vs. address). |
| libs/core/thread_pools/include/hpx/thread_pools/scheduling_loop.hpp | Replaces inline ITT code with unified tracing RAII objects in the scheduler hot path. |
There was a problem hiding this comment.
I think we can make sure (on the build system level) that there is at most one of the tracing backends enabled at any particular time. This should allow us to modify the needed data types as needed (no separate init-data type names for the different backends may be needed this way).
|
Thanks for the review @hkaiser! Both suggestions make sense. Here’s what I’m planning to do. I’ll rename I’ll merge I’ll also merge I’ll drop the pimpl. Since backend-specific headers can be included inside the relevant With these changes, the scheduling loop becomes: hpx::tracing::loop_context ctx;
// ...
hpx::tracing::region rctx(ctx, threads::get_region_init_data(thrdptr), num_thread);I’ll update the PR accordingly. Let me know if this aligns with what you had in mind. |
| return {desc.get_description(), thrdptr->get_thread_phase(), | ||
| thrdptr, thrdptr->is_stackless(), 0, false, | ||
| desc.get_description_itt().handle_}; |
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
|
Kindly have a look. Also I noticed a possible pre-existing edge case: the Tracy path calls |
hkaiser
left a comment
There was a problem hiding this comment.
It might be a good idea to have a dedicated CI for testing the ITTNotify support. That is more involved however, as we can't install VTune in that CI environment. Installing a 'fake' ITTNotify consumer may be viable, though (https://github.com/intel/ittapi).
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
Agreed I'll add ITTNotify CI coverage using the intel/ittapi fake consumer in a follow-up PR. |
Signed-off-by: v4xsh <vanshdobhal11@gmail.com>
| hpx_error( | ||
| "HPX_TRACY_WITH_TRACY=ON and HPX_WITH_ITTNOTIFY=ON are mutually exclusive. Only one tracing backend can be active." | ||
| ) | ||
| endif() |
There was a problem hiding this comment.
Could you please unify the error messages generated if more than one tracing backend is active? Also, your testing doesn't check for HPX_TRACY_WITH_TRACY and HPX_WITH_APEX being enabled at the same time (there might be other combinations we would like to avoid).
Proposed Changes
hpx::tracingabstractions.Any background context you want to provide?
This intentionally enforces a single active backend at compile time (Tracy > ITT > none). Previously, ITT and Tracy instrumentation were separate and uncoordinated, so “both on” was incidental rather than a supported dual-profiler feature. The unified tracing layer is designed as a single entry point with compile-time dispatch, avoiding double instrumentation overhead and aligning with typical workflows where only one profiler is used at a time. Is this decision appropriate?
Checklist
Not all points below apply to all pull requests.