Skip to content

[SYCL][XPTI] Add XPTI notifications for SYCL 2020 images #9770

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 13 commits into from
Jul 13, 2023

Conversation

steffenlarsen
Copy link
Contributor

This commit adds XPTI notifications for SYCL 2020 image classes (sampled_image and unsampled_image) as well as for the associated accessor classes (sampled_image_accessor,
host_sampled_image_accessor, unsampled_image_accessor and host_unsampled_image_accessor).

This commit adds XPTI notifications for SYCL 2020 image classes
(`sampled_image` and `unsampled_image`) as well as for the associated
accessor classes (`sampled_image_accessor`,
`host_sampled_image_accessor`, `unsampled_image_accessor` and
`host_unsampled_image_accessor`).

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen temporarily deployed to aws June 7, 2023 15:13 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws June 7, 2023 17:09 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws June 8, 2023 10:40 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws June 8, 2023 11:18 — with GitHub Actions Inactive
@@ -65,6 +69,9 @@ class XPTIRegistry {
// SYCL buffer events
GBufferStreamID = xptiRegisterStream(SYCL_BUFFER_STREAM_NAME);
this->initializeStream(SYCL_BUFFER_STREAM_NAME, 0, 1, "0.1");
// SYCL image events
Copy link
Contributor

Choose a reason for hiding this comment

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

@steffenlarsen It is okay to have a new stream for experimental data, but once it is validated, please ensure that the data is emitted in the default "sycl" stream. Everything that is a part of SYCL spec needs to be in the "sycl" stream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to follow buffers/accessors as closely as possible. Is there some logic I missed that promotes buffers/accessors out the experimental stream or is that a TODO?

Copy link
Contributor

Choose a reason for hiding this comment

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

@steffenlarsen Having separate streams with common tracepoint types is a reasonable way to do this and limit the explosion of trace point types. When done with validating and settling on the 2020 image implementation, consider moving from "sycl.experimental.image" to "sycl.image"

@steffenlarsen steffenlarsen temporarily deployed to aws June 9, 2023 09:59 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws June 9, 2023 10:39 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen requested review from tovinkere and removed request for a team June 20, 2023 11:04
/// Used to notify that offload buffer will be destructed
offload_alloc_destruct = XPTI_TRACE_POINT_BEGIN(22),
offload_alloc_buffer_destruct = XPTI_TRACE_POINT_BEGIN(22),
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are in an ABI breakage window, can you change this to:
offload_alloc_buffer_destruct = XPTI_TRACE_POINT_END(20),

All pairs, such as [*_begin, _end], [_construct, *_destruct] etc should use XPTI_TRACE_POINT_BEGIN(X)/XPTI_TRACE_POINT_END(X) pairs where the same ID is used for the pair - in this case X.

We have 64 trace _BEGIN/_END pairs we can define here as default. We can extend it with user defined trace types (see documentation). So, we need to be careful about assigning trace_type IDs. If they are truly not scoped pair of trace types, then we may run out of IDs and may have to extend it to use more bits.

So, please consider:
offload_alloc_buffer_associate = XPTI_TRACE_POINT_BEGIN(21),
offload_alloc_buffer_release = XPTI_TRACE_POINT_END(21),

/// handle of the offload sampled image
offload_alloc_sampled_image_associate = XPTI_TRACE_POINT_BEGIN(27),
/// Used to notify that offload sampled image will be destructed
offload_alloc_sampled_image_destruct = XPTI_TRACE_POINT_BEGIN(28),
Copy link
Contributor

Choose a reason for hiding this comment

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

offload_alloc_sampled_image_destruct = XPTI_TRACE_POINT_END(26),

/// Used to notify that offload sampled image will be destructed
offload_alloc_sampled_image_destruct = XPTI_TRACE_POINT_BEGIN(28),
/// Used to notify about releasing internal handle for offload sampled image
offload_alloc_sampled_image_release = XPTI_TRACE_POINT_BEGIN(29),
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, _associate/_release should be XPTI_TRACE_POINT_BEGIN(X)/_END(X) if they are semantically efer to the begin and end of the association.
offload_alloc_sampled_image_release = XPTI_TRACE_POINT_BEGIN(27)

Comment on lines 413 to 420
offload_alloc_unsampled_image_construct = XPTI_TRACE_POINT_BEGIN(30),
/// Used to notify about association between user and internal
/// handle of the offload unsampled image
offload_alloc_unsampled_image_associate = XPTI_TRACE_POINT_BEGIN(31),
/// Used to notify that offload unsampled image will be destructed
offload_alloc_unsampled_image_destruct = XPTI_TRACE_POINT_BEGIN(32),
/// Used to notify about releasing internal handle for offload unsampled image
offload_alloc_unsampled_image_release = XPTI_TRACE_POINT_BEGIN(33),
Copy link
Contributor

Choose a reason for hiding this comment

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

Please consider making the same changes as indicated in previous comments.

Comment on lines 497 to 512
/// Indicates that the current event is an offload sampled image related
offload_sampled_image = XPTI_EVENT(11),
/// Indicates that the current event is an offload unsampled image related
offload_unsampled_image = XPTI_EVENT(12),
/// Indicates that the current event is an offload sampled image accessor
/// related
offload_sampled_image_accessor = XPTI_EVENT(13),
/// Indicates that the current event is an offload sampled image host accessor
/// related
offload_host_sampled_image_accessor = XPTI_EVENT(14),
/// Indicates that the current event is an offload unsampled image accessor
/// related
offload_unsampled_image_accessor = XPTI_EVENT(15),
/// Indicates that the current event is an offload unsampled image host
/// accessor related
offload_host_unsampled_image_accessor = XPTI_EVENT(16),
Copy link
Contributor

Choose a reason for hiding this comment

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

The Event types are primarily used to indicate if the "busy" time is attributed to the scheduler, a barrier or an algorithm. For memory operations, this would be "algorithm" as it is needed by an algorithm or we can have a new category called "memory_operation". We don't anything more fine grain than that.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen temporarily deployed to aws June 21, 2023 09:24 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws June 21, 2023 10:05 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws June 21, 2023 10:37 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws June 21, 2023 11:52 — with GitHub Actions Inactive
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen
Copy link
Contributor Author

@tovinkere - As discussed a couple weeks ago, I have tried to consolidate the memory-object and accessor enumerators as well as fix the begin and end traces. Please let me know if I missed something or misunderstood something our discussion.

@steffenlarsen steffenlarsen temporarily deployed to aws July 6, 2023 13:00 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws July 6, 2023 15:16 — with GitHub Actions Inactive
Copy link
Contributor

@tovinkere tovinkere left a comment

Choose a reason for hiding this comment

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

Everything looks good, except the one change requested in xpti_data_types.h
Need to get this in during the ABI breakage window.

@@ -385,21 +386,21 @@ enum class trace_point_type_t : uint16_t {
mem_release_begin = XPTI_TRACE_POINT_BEGIN(18),
/// Used to notify that memory has been released.
mem_release_end = XPTI_TRACE_POINT_END(19),
/// Used to notify that offload buffer will be created
offload_alloc_construct = XPTI_TRACE_POINT_BEGIN(20),
/// Used to notify that offload memory object will be created
Copy link
Contributor

Choose a reason for hiding this comment

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

@steffenlarsen Since we are consolidating the trace types and fixing issues before the ABI breakage window, can you please also change:
mem_alloc_begin = XPTI_TRACE_POINT_BEGIN(16), mem_alloc_end = XPTI_TRACE_POINT_END(16), mem_release_begin = XPTI_TRACE_POINT_BEGIN(17), mem_release_end = XPTI_TRACE_POINT_END(17),

The rest here look good.

Copy link
Contributor

Choose a reason for hiding this comment

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

@steffenlarsen Since the ABI breakage window closes today, any updates to this request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Apologies. It has been addressed now. @stdale-intel - Any chance we can get this in despite the window closing yesterday? It is an XPTI ABI break.

@@ -65,6 +69,9 @@ class XPTIRegistry {
// SYCL buffer events
GBufferStreamID = xptiRegisterStream(SYCL_BUFFER_STREAM_NAME);
this->initializeStream(SYCL_BUFFER_STREAM_NAME, 0, 1, "0.1");
// SYCL image events
Copy link
Contributor

Choose a reason for hiding this comment

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

@steffenlarsen Having separate streams with common tracepoint types is a reasonable way to do this and limit the explosion of trace point types. When done with validating and settling on the 2020 image implementation, consider moving from "sycl.experimental.image" to "sycl.image"

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen temporarily deployed to aws July 12, 2023 07:42 — with GitHub Actions Inactive
@steffenlarsen
Copy link
Contributor Author

@intel/llvm-reviewers-runtime | @KseniyaTikhomirova - Friendly ping.

@steffenlarsen steffenlarsen temporarily deployed to aws July 12, 2023 08:06 — with GitHub Actions Inactive
Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
@steffenlarsen steffenlarsen requested a review from a team as a code owner July 12, 2023 08:57
@steffenlarsen steffenlarsen temporarily deployed to aws July 12, 2023 09:11 — with GitHub Actions Inactive
Copy link
Contributor

@PietroGhg PietroGhg left a comment

Choose a reason for hiding this comment

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

Update in the Native CPU test looks good, just FYI #10282 will change the test again, removing the CHECKs that caused you errors

@steffenlarsen steffenlarsen temporarily deployed to aws July 12, 2023 10:01 — with GitHub Actions Inactive
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

@tovinkere tovinkere left a comment

Choose a reason for hiding this comment

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

LGTM

@steffenlarsen
Copy link
Contributor Author

Spoke to @stdale-intel offline and it should still be fine to merge.

Cached checkout issue for HIP in CI is a known problem.

@steffenlarsen steffenlarsen merged commit 8c53527 into intel:sycl Jul 13, 2023
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.

4 participants