-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL][Docs] Add proposed event mode extension #15704
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
[SYCL][Docs] Add proposed event mode extension #15704
Conversation
This commit adds the sycl_ext_intel_low_power_event extension as proposed. To support this extension, the barriers in the sycl_ext_oneapi_enqueue_functions extension are given property arguments without any current consumers. Signed-off-by: Larsen, Steffen <[email protected]>
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
Signed-off-by: Larsen, Steffen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I spotted a typo, but otherwise LGTM.
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
…ciidoc Co-authored-by: John Pennycook <[email protected]>
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
| oneapi::experimental::property_value<low_power_event_key>; | ||
| }; | ||
|
|
||
| inline constexpr low_power_event_key::value_t low_power_event; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a runtime property that takes a bool parameter. This will allow usage like:
bool low_power = /* check some option */;
oneapiex::properties props{intelex::low_power_event{low_power}});
Code like this is difficult with the API as you have it now because the existence of the low_power_event property affects the type of the props variable. As a result, you can not do this:
bool low_power = /* check some option */;
oneapiex::properties props;
if (low_power)
/* no way to add 'low_power_event' property now */
If you make it a runtime property, the property's default constructor can set the property's value to true.
Alternatively, the property could take an enum instead of a bool. I think someone suggested in one of our meetings that there could be other types of low-power events in the future? I can't remember whether we decided that was realistic, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. Would it make sense to change the property to an event_mode property and have the value as:
enum event_mode_enum {
default_mode,
low_power_mode
};
If we think future modes might overlap, we can also do it as a bitmap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in thinking that we can define it as an enum now, and convert it to a bitmask later just by defining the relevant operators?
Either way, I like this direction. I'd be tempted to change the names, though, to avoid some redundancy:
enum class event_mode {
none, // we can't use"default" because it's a keyword
low_power,
};There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in thinking that we can define it as an
enumnow, and convert it to a bitmask later just by defining the relevant operators?
Absolutely. As long as it doesn't cross the library boundary, we can change it later if we want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the enum direction makes sense, but I'm not sure what names you are proposing. It seems like the name event_mode has been proposed as both the name of the property and the name of the enumeration. Can you write out an example usage to illustrate the naming that you propose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm definitely not married to the name of the enum, but I just took inspiration from the naming of the compile-time property enums.
Adjusting the example in the text, the property would be used as
oneapiex::properties Props{intelex::event_mode{intelex::event_mode_enum::low_power}};Note, I agree with @Pennycook in that it should be an enum class, mainly so it doesn't bleed its contents.
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
sycl/doc/extensions/proposed/sycl_ext_intel_low_power_event.asciidoc
Outdated
Show resolved
Hide resolved
Signed-off-by: Larsen, Steffen <[email protected]>
| ``` | ||
| namespace sycl::ext::intel::experimental { | ||
|
|
||
| enum class event_modes { none, low_power }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pennycook: Do you like this naming convention where the enum name is plural and the property name is singular?
The other alternative we discussed is to name the property event_mode and name the enum event_mode_enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick search of the ISO C++ specification suggests that their convention is to use a plural when the enum is a bitmask (e.g., std::filesystem::copy_options) but a singular when it is not (e.g., std::filesystem::file_type).
If we want to keep the plural here, then I think we should define this as a bitmask. But that also suggests that the property name should also be a plural. Didn't we recently discuss reintroducing a nested namespace for properties? That would allow sycl::event_modes to be a bitmask of event modes, and sycl::property::event_modes to be a property for setting an event's modes.
I don't really like the idea of encoding _enum in a name, because of the redundancy there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should make this a bitmask.
We have already used the _enum suffix for some other properties, so we have a precedent.
If we did add the namespace, why wouldn't we put the property and the enum in the same namespace? The enum is only used in conjunction with the property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steffenlarsen, I saw that you re-requested my review. I think the naming issue in this thread is not yet resolved.
If we can't think of a better solution, I suggest we go with the name event_mode_enum, which is consistent with existing properties that take an enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, apologies. I glanced over this one. event_mode_enum is fine with me. 👍
sycl/doc/extensions/proposed/sycl_ext_intel_event_mode.asciidoc
Outdated
Show resolved
Hide resolved
Signed-off-by: Larsen, Steffen <[email protected]>
This commit adds the sycl_ext_intel_event_mode extension as proposed. To support this extension, the submission functions in the sycl_ext_oneapi_enqueue_functions extension are given property arguments without any current consumers.