Skip to content

[SYCL] Add sycl_khr_properties queue properties - #23133

Merged
uditagarwal97 merged 4 commits into
intel:syclfrom
koparasy:khr/properties/queue
Sep 15, 2026
Merged

uditagarwal97 merged 4 commits into
intel:syclfrom
koparasy:khr/properties/queue

Conversation

@koparasy

@koparasy koparasy commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Implements the queue portion of sycl_khr_properties: the properties
khr::property::enable_profiling and khr::property::in_order, the queue
constructor overloads accepting a khr property or property list, and
queue::khr_is_profiling_enabled() (is_in_order() already existed). The
new-style properties are translated to the existing property::queue::*.

KHR Link: KhronosGroup/SYCL-Docs#980

khr/properties.hpp defined its internals in sycl::khr::detail. Because sibling
headers under namespace sycl::khr (e.g. free_function_commands.hpp) use bare
detail::Foo intending sycl::detail::Foo, unqualified lookup finds sycl::khr::detail
first and fails -- so <sycl/sycl.hpp> under __DPCPP_ENABLE_UNFINISHED_KHR_EXTENSIONS
did not compile.

Move the property-definition infrastructure to sycl::khr::property::detail so no
sycl::khr::detail exists. Also fix is_property to exclude the properties list
itself (it privately inherits its properties, so is_base_of would report it as a
property and is_property_for would probe an ambiguous __detail_key_t).

Add a regression test that includes <sycl/sycl.hpp> with the unfinished KHR
extensions enabled.
Add the queue properties khr::property::{enable_profiling,in_order} (runtime
bool, separate keys) to the single khr/properties.hpp, and the queue
constructor overloads accepting a khr property or property list plus
queue::khr_is_profiling_enabled(). The constructors translate the runtime-valued
khr properties into an old-style property_list via a new befriended
detail::PropertyListBuilder (property_list's runtime bitset constructor).
is_in_order() already existed.
@koparasy
koparasy requested a review from a team as a code owner September 9, 2026 23:43
MSVC rejects the static (compile-time key) and non-static const (runtime key)
get_property overloads as differing only in return type during class definition,
before the enable_if SFINAE applies. Give the runtime overload a defaulted dummy
int parameter so the two have distinct parameter lists (as the experimental
properties container does).
@KseniyaTikhomirova

Copy link
Copy Markdown
Contributor

please don't forget to add link to the spec for these changes.

@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 in general


namespace sycl {
inline namespace _V1 {
// Forward declarations of the SYCL classes that the named properties below

@KseniyaTikhomirova KseniyaTikhomirova Sep 14, 2026 •

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.

please consider removal of AI generated comments that doesn't bring value to the code. applicable to many comments

// True if T is a khr::properties list. Used to exclude the list itself from
// is_property (the list privately inherits its properties, so is_base_of would
// otherwise report it as a property).
template <typename> struct is_properties_list : std::false_type {};

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.

this file has sections splitted up comments like "Property tags" and "Property traits". this struct is added to the wrong one. I suppose it is done due to namespace scope. Probably then consider removal of sections/comments that you can't keep relevant

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.

I cleaned it up.

Comment thread sycl/include/sycl/khr/properties.hpp Resolved
Comment thread sycl/include/sycl/queue.hpp Outdated
// it to the corresponding old-style property_list. PropertyOrList is not
// defaulted: the property_list constructors already cover the no-property
// case, and defaulting here would make e.g. `queue q{}` ambiguous.
private:

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.

could you move it to the private section below please? this approach brings a mess to the class declaration

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.

this is not done, I still think it would be nice to keep public API methods first - aligned with other classes. No need to start class declaration with helpers.

@koparasy

Copy link
Copy Markdown
Contributor Author

LGTM in general

I fixed and restructured the code to make it cleaner, and trimmed comments.

// (C2686) during class definition, before the enable_if SFINAE applies.
template <typename PropertyKey>
constexpr auto get_property() const -> std::enable_if_t<
constexpr auto get_property(int = 0) const -> std::enable_if_t<

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.

@gmlueck we have 2 functions in the spec with the same name + signature. Do you think we should rename one of them in the spec?

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 think the oneapi extension is the same way -- we have two overloads of the same member function with mutually exclusive constraints. Do we have the same problem with MSVC in the current extension?

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.

Yes, the oneapi extension has the same static/non-static pair and already carries the workaround. The runtime overload is get_property(int = 0) const. That dummy int is the mitigation; without it MSVC rejects it the same way.

The trigger isn't the mutually-exclusive constraints. SFINAE overloads are fine. It's that one overload is static and the other non-static with an otherwise-identical parameter-type-list.

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.

Using the same function name for both compile-time properties and runtime properties seems nice from a user standpoint, so I think that outweighs the ugly implementation on MSVC. @rolandschulz do you have an opinion here?

@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

Copy link
Copy Markdown
Contributor Author

@intel/llvm-gatekeepers This is ready to be merged.

  1. The failure looks unrelated
  2. The discussion about the spec will be resolved once the spec is fully clarified.

@uditagarwal97
uditagarwal97 merged commit f79867f into intel:sycl Sep 15, 2026
30 of 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