Skip to content

[SYCL] Add sycl_khr_properties container and classification traits - #23075

Merged
KornevNikita merged 4 commits into
intel:syclfrom
koparasy:khr/properties/container-and-traits
Sep 9, 2026
Merged

KornevNikita merged 4 commits into
intel:syclfrom
koparasy:khr/properties/container-and-traits

Conversation

@koparasy

@koparasy koparasy commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

This is partial implementation of KhronosGroup/SYCL-Docs#980

@koparasy
koparasy requested a review from a team as a code owner September 1, 2026 21:18
@KseniyaTikhomirova

KseniyaTikhomirova commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

@koparasy the khr extension you are referring to is in draft state. Do you expect it to be reviewed and merged in advance? @dm-vodopyanov, @gmlueck I am not aware about process for this case, could you please clarify?

@koparasy

koparasy commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

@koparasy the khr extension you are referring to is in draft state. Do you expect it to be reviewed and merged in advance? @dm-vodopyanov, @gmlueck I am not aware about process for this case, could you please clarify?

@KseniyaTikhomirova the KHR is expected to be updated and be undrafted (soonish). I don't know the process, but the code is guarded with the __DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS, and I have used that in the split-headers KHR as well. So, there is precedent. @dm-vodopyanov do you think we need to wait?

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have found that we have a process for this https://github.com/intel/llvm/blob/sycl/sycl/doc/developer/KHRExtensions.md
To me it looks like draft/unmerged PRs against main are not intended to be merged in advance. Although I don't work with extensions so may be wrong here. @dm-vodopyanov kindly ping for your opinion.

changes itself LGTM, just a few comments


// is_property_key_for / is_property_for / is_property_list_for.
static_assert(is_property_key_for_v<enable_profiling_key, MyClass>);
static_assert(!is_property_key_for_v<enable_profiling_key, OtherClass>);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would be nice to have this check for all types of properties

Cover is_property_key_v for the compile-time-type key, check
is_property_key_for/is_property_for for every property kind, and add a
mixed-class property list to verify is_property_list_for is false when
properties target different classes.
@koparasy

koparasy commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

I have found that we have a process for this https://github.com/intel/llvm/blob/sycl/sycl/doc/developer/KHRExtensions.md To me it looks like draft/unmerged PRs against main are not intended to be merged in advance. Although I don't work with extensions so may be wrong here. @dm-vodopyanov kindly ping for your opinion.

changes itself LGTM, just a few comments

Requested changes are done in d53a64d

@dm-vodopyanov any opinions about the "khr process"?

@dm-vodopyanov dm-vodopyanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In accordance with https://github.com/intel/llvm/blob/sycl/sycl/doc/developer/KHRExtensions.md, we can merge this patch right now with enabled __DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS macro.

A few notes from this doc why it's crucial to merge such PRs:

So, we can have a PR but can't merge it. Keeping PRs opened for a long time is a
bad practice, because they tend to get stale: there are merge conflicts,
potential functional issues due to the codebase changes, etc.

In order for us to avoid stale PRs, all functionality which is a public
interface of an "in-progress" KHR extension, must be hidden under
`__DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS` macro. That way we can merge a PR to
avoid constantly maintaining it in a good shape, start automatically testing it
but at the same time avoid exposing incomplete and/or undocumented feature to
end users just yet.

And the docs says that even if the extension proposal PR is merged into main, __DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS macro must be kept. It includes situation when the extension proposal PR is not merged yet. And we will remove this macro only after the spec reaches sycl-2020 branch.

But we have a problem. The process says that

The macro is **not** intended to be used by end users and its purpose is to
simplify our development process by allowing us to merge implementation (full
or partial) of the aforementioned extensions earlier to simplify maintenance and
enable automated testing.

So our end-users cannot and must not use this KHR extension if __DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS still here. That could be a problem for our end users.
So this extension should be finalized in Khronos first.

Comment thread sycl/include/sycl/khr/properties.hpp Outdated

#include <type_traits>

#define SYCL_KHR_PROPERTIES 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please move that to sycl/source/feature_test.hpp.in under #ifdef __DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS macro?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@koparasy
koparasy force-pushed the khr/properties/container-and-traits branch from b68563c to 32bffad Compare September 8, 2026 20:19
Exact property-list sizes are ABI-specific (MSVC pads multiple bases
sharing a common empty base differently), so restrict the size checks to
the Itanium ABI (REQUIRES: linux) and move the portable trivial-copyability
checks into properties.cpp.
@koparasy
koparasy force-pushed the khr/properties/container-and-traits branch from a0a5e0d to c9bdcca Compare September 8, 2026 22:03

@KseniyaTikhomirova KseniyaTikhomirova left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@koparasy

koparasy commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@intel/llvm-gatekeepers can you merge this in.

@KornevNikita
KornevNikita merged commit f769c34 into intel:sycl Sep 9, 2026
31 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.

4 participants