Skip to content

[XPTI][INFRA] Refactored API implementations to improve performance #19160

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

Open
wants to merge 8 commits into
base: sycl
Choose a base branch
from

Conversation

tovinkere
Copy link
Contributor

As a part of the performance study to improve SYCL runtime performance, it was documented that XPTI when enabled by a tool or collector was having higher than usual performance impact. This is the second PR to address the specific xptiMakeEvent* API and current implementation is ~30% faster than previous implementation. The last PR in this series will change the instrumentation in SYCL to address the large performance impact caused by mixing debug and performance streams in the runtime today.

  • Also fixes issues in XPTI samples due to changes in PR#18786

Refactors XPTI API calls to improve performance of event creation
and string look up.

Signed-off-by: Vasanth Tovinkere <[email protected]>
@tovinkere tovinkere requested a review from a team as a code owner June 25, 2025 23:56
Signed-off-by: Vasanth Tovinkere <[email protected]>
Copy link
Contributor

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Choose a reason for hiding this comment

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

LGTM, just a few comments

@@ -515,12 +565,26 @@ struct payload_t {
stack_trace = caller_callee;
flags |= (uint64_t)payload_flag_t::StackTraceAvailable;
}
line_no = invalid_id<>; ///< Invalid line number
column_no = invalid_id<>; ///< Invalid column number
Copy link
Contributor

Choose a reason for hiding this comment

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

should we set source_file to invalid too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initialization of the structure will set source_file = nullptr and "flags" = 0. So, it is safe. However, lines 568-569 can go as they are a part of initialization as well.

Payload->line_no != xpti::invalid_id<uint32_t>;
// We ignore checking for column info as it may not always be available
isValid = ((hasSourceFile && hasLineInfo) || hasName || hasCodePtrVa) &&
(Payload->flags != 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

check (hasSourceFile && hasLineInfo) || hasName || hasCodePtrVa) implies Payload->flags != 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed that the last test can go.

LineNo = Payload->line_no;
ColNo = Payload->column_no;
// If the payload's source file is available, add it to the string table
// and get its id Also, get the line number and column number from the
Copy link
Contributor

Choose a reason for hiding this comment

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

we are not getting column and line number any more here. is it expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

}

// If the payload's source file is available, add it to the string table
// and get its id Also, get the line number and column number from the
Copy link
Contributor

Choose a reason for hiding this comment

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

same question here

Copy link
Contributor

Choose a reason for hiding this comment

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

I do see we assign them below. then we should update comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the comments

Copy link
Contributor

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Choose a reason for hiding this comment

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

BTW, I believe you broke xpti ABI here, it is allowed?

@KseniyaTikhomirova KseniyaTikhomirova dismissed their stale review June 27, 2025 15:41

ABI concerns

@tovinkere
Copy link
Contributor Author

Regarding ABI - it should be backward compatible as the function that did change its signature is never used in SYCL instrumentation. So, no one is affected. Instrumentation in SYCL will incorporate the new API moving forward.

@KseniyaTikhomirova
Copy link
Contributor

Regarding ABI - it should be backward compatible as the function that did change its signature is never used in SYCL instrumentation. So, no one is affected. Instrumentation in SYCL will incorporate the new API moving forward.

can anyone else use these functions?

@tovinkere
Copy link
Contributor Author

No one is using the 128-bit ID queries as they chose to retain the 64-bit backward compatibility modes, hence ABI breakage will not affect anyone. Once SYCL transitions to the newer API, the tool chains can continue to use backward compatibility modes or use the new API. Ideally we may want to deprecate some functions, however, with there not being a significant performance impact anymore, they should co-exist nicely.

Copy link
Contributor

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Choose a reason for hiding this comment

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

I trust @tovinkere with ABI assessment as xptifw owner.
Other comments are fixed.

LGTM.

@tovinkere
Copy link
Contributor Author

tovinkere commented Jun 27, 2025

@intel/llvm-gatekeepers This can be merged after the checks are complete..

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