Repository navigation
KHR for properties - #980
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
Fix the link in the previous commit and add links for the remaining `context` and `queue` constructor overloads.
|
KhronosGroup/SYCL-CTS#1251 is ready for review. |
| In this example, [code]#enable_thing1# and [code]#enable_thing2# are instead | ||
| defined as presence-only properties with no boolean value. | ||
|
|
||
| [source,,linenums] |
There was a problem hiding this comment.
I would avoid giving an anti-pattern example. Perhaps a less able AI or an inattentive engineer could copy-paste this code. I think the description in the paragraph above is sufficient anyway.
But this is only a preference.
There was a problem hiding this comment.
In an earlier draft, I tried to explain the problem without an example, and I found that readers were confused. Therefore, I have a slight preference to keep the example. I added a comment, which I hope clarifies that it is an anti-pattern in 4b8f242.
That said, I'm happy to remove this example if you (or others) think it's still confusing.
There was a problem hiding this comment.
That's fine by me. But perhaps we can get more feedback in the WG call.
There was a problem hiding this comment.
In yesterday's WG call we decided that it would be better to move all of the "examples for implementors" out of the formal KHR specification. We think examples should be directed to users of SYCL, not implementors. Therefore, I moved this to the existing "future plans" document and renamed that document to an "ancillary document" for the KHR. See f083c7e and ec6e575.
Co-authored-by: Verena Beckham <vbeckham@qti.qualcomm.com>
Change the definition of `queue::is_in_order` to be more general by returning `true` whenever the queue is in-order. This is exactly identical to its current definition in the core SYCL 2020 language because the only way to create an in-order queue is via the `in_order` property. However, this helps with the proposed KHR in #980 because that KHR will add a new property that also makes the queue in-order.
We decided that the KHR specification should not contain examples that are aimed at implementors of the SYCL language. Therefore, move the "examples for implementors" to an ancillary document. Member of the Khronos working group (and other implementors) can access this ancillary document when designing patterns for the new-style properties.
|
Our recent direction has been to de-emphasize the buffer / accessor model, and new KHR extensions are not adding this support. For example, the khr_properties extension (KhronosGroup#980) does not add support for buffers or accessors.
Change the `is_property_list_for` trait to include *both* the case when `T` is a bare property for `Class` *and* the case when `T` is a property list of properties for `Class`. This simplifies many of the constraints because our design pattern always allows a single property to be passed in place of a property list. (The semantics are the same as passing a property list with one property.) I think the trait name `is_property_list_for` still makes sense because we can think of a bare property as a degenerate case of a property list with one property.
|
I added one more commit (6d90270) since this PR was approved. I realized while working on #922 that the constraints for functions that take a property list are unnecessarily complex. The reason is that our design pattern always allows the user to pass a single bare property in place of a property list. (The semantics are the same as passing a list with one property.) This caused all the constraints to be like
I think it is better to simply redefine what The change allows us to simplify the constraints to look like this instead:
I think this change will also improve the error message users get if they pass an incorrect property. @VerenaBeckham and @0x12CC: if you agree with this late modification, can you indicate your approval by re-approving this PR? |
Nice, that is much neater! |
After sleeping on it, I'm thinking that we should rename the trait to Any objections to that? |
|
The proposed changes are in : intel/llvm#23864 |
After further reflection, I think this trait should be named `is_property_or_list_for` because that seems a bit more descriptive. I think this will result in a more meaningful error message if someone passes an invalid property that violates a constraint.
Done in 1a0c004 |
|
…23864) There has been a last minute change on the specification, this implements that change. KhronosGroup/SYCL-Docs#980 commit: 6d90270a59c479dcae9a51f838e29ffc56368ab1
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).