Repository navigation
Conversation
It seems to make sense to allow a property with a runtime-supplied value to be constexpr when the property value is a constant, at least for those properties whose values could potentially be constants. This is not the same as a compile-time constant property, though, because the type of the property still does not convey the value of the property. Likewise, it seems to make sense to add `constexpr` to the `properties` constructor, so that a `properties` can be declared as a constant when all of its properties are constant expressions.
Minimal C++20 header-only implementation of the compile-time properties extension: properties class with CTAD, 6 traits, support for runtime, compile-time and hybrid property kinds, plus queue properties and tests. My question was: I would like to create a minimal C++20 implementation for KhronosGroup/SYCL-Docs#980. You can start by gathering the C++ pieces found in the AsciiDoctor document and summarize it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I have made an implementation of this with 5 variations with the help of Claude Code CLI Opus 4.6 1M tokens: https://github.com/SYCL/properties So it looks like using |
|
Some other ideas on clean interface https://github.com/qlibs/mp |
|
I love the idea of compile-time properties, but does Intel have a killer use-case for them right now? As I understand it, all the existing SYCL properties would remain "runtime properties" as described by this KHR. Also, in the "free function commands KHR", which now depends on this KHR, I can't immediately see a property that would be implemented as a compile-time property, unless I missed it? |
The reason we proposed this KHR now is because we want to use it in #922. We'd like to replace the |
auto p1 = sycl::property_list{ p1, p2 }; static_assert { p1 == p2 }; |
…ons; raise kernel-bundle and USM-tag Issues
…23064) This is in preparation of implementing: KhronosGroup/SYCL-Docs#980
…23075) This is partial implementation of KhronosGroup/SYCL-Docs#980
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
Adds the `sycl_khr_properties` overloads for the `usm_allocator`
constructors and the USM allocation functions: device, host,
shared and parameterized malloc/aligned_alloc. Also adds
the `khr::property::tag::{usm_device, usm_host, usm_shared}` tag types.
Depends on: #23466
KHR Link: KhronosGroup/SYCL-Docs#980
---------
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Since the keys are now specified as incomplete types, it makes no sense to say they are trivially copyable.
To make it consistent with the other sections.
We do want to define new overloads for the kernel bundle APIs that take the new-style properties, so remove that open issue. Add two new open issues.
* Remove sycl:: qualifier from USM declarations * Fix constructor name in prop3 example * Replace std::true with std::true_type * Use std::size_t for span Extent template parameter * Clarify property definitions in boolean properties counter-example * Make runtime get_property overload const
Think through more interactions if KHR properties get adopted into the core spec. If that happens, we will have both a KHR version of the properties and a core spec version. This analyzes how we will handle the interaction between them.
After an internal discussion, we think the namespace for these functions should remain `sycl` (not `sycl::khr`). The motivation for putting these functions in the `sycl::khr` namespace was to make it clear to people who read or write the source code that these functions are an extension vs. part of the core spec. However, this should be clear despite the namespace because these functions all take new-style properties, and the properties themselves are in the `syc::khr` namespace. Our plan is to adopt these new-style properties into the next version of the SYCL specification (SYCL-Next), and these functions will be in the `sycl` namespace once that happens. By defining them in the `sycl` namespace now, we avoid some API thrash while still making it clear that they are (currently) an extension.
|
|
||
| [source,role=synopsis] | ||
| ---- | ||
| namespace sycl { |
There was a problem hiding this comment.
Adding a comment here about the namespace.
We considered adding these new overloads to sycl::khr instead, but decided on the sycl namespace. My commit message (adab485) explains the reasoning:
After an internal discussion, we think the namespace for these functions should remain
sycl(notsycl::khr).The motivation for putting these functions in the
sycl::khrnamespace was to make it clear to people who read or write the source code that these functions are an extension vs. part of the core spec. However, this should be clear despite the namespace because these functions all take new-style properties, and the properties themselves are in thesyc::khrnamespace.Our plan is to adopt these new-style properties into the next version of the SYCL specification (SYCL-Next), and these functions will be in the
syclnamespace once that happens. By defining them in thesyclnamespace now, we avoid some API thrash while still making it clear that they are (currently) an extension.
I'll leave this comment open for a while, though, to see if others agree.
|
Hi everyone, I'm finished making changes and consider this ready for final review now. During the F2F, we decided that we wanted to concentrate on getting KHR's ratified between now and the spring, and this one was on our priority list. It would be great to get some conditional approvals on the specification text. Then, once KhronosGroup/SYCL-CTS#1251 is ready, we can finalize and send it out for ratification. |
| [[sec:khr-properties-queue-member-funcs]] | ||
| === New and modified queue member functions | ||
|
|
||
| This extension adds a new member function and modifies an existing one. |
There was a problem hiding this comment.
It's not clear to me which functions this is referring to. is_in_order and khr_is_profiling_enabled? But which one is added and which one is modified? How is it modified? And how is it legal for an extension to modify an existing function?
There was a problem hiding this comment.
I reworded this in db82a01. Does that seem better?
I think it is OK for an extension to expand an existing API so long as it doesn't break any existing code that is already using that API. The previous definition returned true whenever the queue was constructed with the old-style in_order property. The new definition returns true whenever the queue is in order. Therefore, the intent of the query is the same. It just got expanded to cover both the old-style and the new-style in_order properties.
There was a problem hiding this comment.
The wording is much better, thanks.
I see what you're saying about is_in_order(), and it makes sense, but I think it would be clearer if the description read something like Returns: true only if this queue was constructed with either the property::queue::in_order or khr::property::in_order property.
There was a problem hiding this comment.
That still wouldn't be correct, though, because constructing the queue with khr::property::in_order{false} would not create an in-order queue.
In the future, we plan to adopt the new-style properties into the core spec (e.g. as part of SYCL-Next). At that point, an in-order queue could be constructed in any of the following ways:
- with the
sycl::property::queue::in_orderproperty - with the
sycl::khr::property::in_order{true}property - with the
sycl::property::in_order{true}property
Listing them all will get very unwieldy.
There was a problem hiding this comment.
I see your point. Could we then add something more descriptive in the intro, like "This extension modifies the queue::is_in_order function to additionally enable querying of the in_order property or the queue if it was constructed with khr::property::in_order..."?
I just feel it's confusing as it stands, because it feels like the description should always have been like that. In fact, you could probably argue that you could make that change to the SYCL 2020 spec right now, because it doesn't make any semantic change, does it?
There was a problem hiding this comment.
In fact, you could probably argue that you could make that change to the SYCL 2020 spec right now, because it doesn't make any semantic change, does it?
I like this idea! I created #1076 to make this generalization. If the WG approves that change, I'll simplify this KHR because it will no longer be necessary for it to expand the definition of is_in_order.
If we like this style, I'll change the others.
Fix the link in the previous commit and add links for the remaining `context` and `queue` constructor overloads.
Proposed KHR for a new property mechanism that conveys more information at compilation time. These new style properties allow better error checking at compilation time, and they support properties that can influence the code generated by the compiler (because some properties can have values that are known at compilation time).