Skip to content

Add new formatted metadata ITT API #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 5, 2025
Merged

Conversation

alexey-kireev
Copy link
Contributor

With this we can add formatted metadata support for ITT task API.
At first we need to declare __itt_string_handle* format in a printf format style, for example "Running [%s] task iteration %llu". Format specifiers in square brackets create additional grouping options in VTune analysis views
Then we call function __itt_formatted_metadata_add with arguments (domain, format, arg1, arg2), where domain is associated __itt_domain, format is printf-style string, arg1 and arg2 are arguments for this specific format.
The new function should be called between __itt_task_begin and __itt_task_end calls.

Also there's a support for overlapped ITT tasks:
__itt_formatted_metadata_add_overlapped(const __itt_domain *domain, __itt_id taskid, __itt_string_handle *format, ...)
where we add taskid from the relevant overlapped ITT task.

Signed-off-by: Alexey Kireev alexey.kireev@intel.com

Signed-off-by: Alexey Kireev <alexey.kireev@intel.com>

Signed-off-by: Kireev, Alexey <alexey.kireev@intel.com>
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds formatted metadata support for the ITT task API, enabling formatted strings for task metadata and introducing support for overlapping ITT tasks.

  • Added new functions (__itt_formatted_metadata_add and __itt_formatted_metadata_add_overlapped) and their macro definitions in ittnotify_static.h and ittnotify.h
  • Introduced a new metadata type (__itt_metadata_string) in the metadata type enumeration

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/ittnotify/ittnotify_static.h Added macro stubs for formatted metadata functions to support the new API
include/ittnotify.h Added function declarations and documentation for the new formatted metadata API, and introduced a new metadata type (__itt_metadata_string)
Comments suppressed due to low confidence (1)

src/ittnotify/ittnotify_static.h:213

  • [nitpick] The parameter name 'id' in the formatted_metadata_add_overlapped function is inconsistent with the documentation, which refers to it as 'taskid'. Consider renaming it to 'taskid' for clarity and consistency.
ITT_STUBV(ITTAPI, void, formatted_metadata_add_overlapped, (const __itt_domain *domain, __itt_id id, __itt_string_handle *format, ...), \

Signed-off-by: Kireev, Alexey <alexey.kireev@intel.com>
@alexey-kireev alexey-kireev requested a review from Copilot April 25, 2025 21:58
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for formatted metadata in the ITT task API, enabling additional grouping options in VTune analysis views.

  • Added two new functions (__itt_formatted_metadata_add and __itt_formatted_metadata_add_overlapped) to allow formatted metadata insertion between task begin and end calls.
  • Updated header files and auto-generated Rust bindings (for Windows, macOS, and Linux) by upgrading the rust-bindgen version.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ittnotify/ittnotify_static.h Added new function definitions for formatted metadata support
rust/ittapi-sys/src/windows/jitprofiling_bindings.rs Updated version notice for rust-bindgen
rust/ittapi-sys/src/windows/ittnotify_bindings.rs Added new function pointer definitions for formatted metadata
rust/ittapi-sys/src/macos/jitprofiling_bindings.rs Updated version notice for rust-bindgen
rust/ittapi-sys/src/macos/ittnotify_bindings.rs Added new function pointer definitions for formatted metadata
rust/ittapi-sys/src/linux/jitprofiling_bindings.rs Updated version notice for rust-bindgen
rust/ittapi-sys/src/linux/ittnotify_bindings.rs Added new function pointer definitions for formatted metadata
include/ittnotify.h Introduced formatted metadata API declarations and corresponding macros
Comments suppressed due to low confidence (2)

src/ittnotify/ittnotify_static.h:210

  • Consider adding tests for the new __itt_formatted_metadata_add and __itt_formatted_metadata_add_overlapped functions to ensure they integrate correctly with __itt_task_begin and __itt_task_end.
ITT_STUBV(ITTAPI, void, formatted_metadata_add, (const __itt_domain *domain, __itt_string_handle *format, ...), \

include/ittnotify.h:2461

  • It is recommended to include usage examples or tests in the header documentation to validate the proper functionality of the formatted metadata API in both standard and overlapped contexts.
/* New formatted metadata API declarations */

Copy link
Contributor

@eparshut eparshut left a comment

Choose a reason for hiding this comment

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

@abrown
Copy link
Contributor

abrown commented Apr 28, 2025

The Rust side looks good to me!

@eparshut eparshut changed the title add support of formatted metadata Add new formatted metadata ITT API May 5, 2025
@eparshut eparshut merged commit 93bc622 into intel:master May 5, 2025
16 checks passed
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.

3 participants