-
Notifications
You must be signed in to change notification settings - Fork 738
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] Implement reduction properties extension #15804
[SYCL] Implement reduction properties extension #15804
Conversation
Adds support for initialize_to_identity and deterministic properties. Since this extension is only experimental, the implementation here avoids making significant changes to reduction-related classes (e.g, reducer). A more straightforward implementation that attaches a compile-time property list to these classes is possible, but may be considered an ABI break. Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Also fixes a few typos in the specification that were uncovered during implementation of the extension. Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Any chance we can be "smart" and change
to
instead of adding a bunch of new overloads? |
sycl/include/sycl/ext/oneapi/experimental/reduction_properties.hpp
Outdated
Show resolved
Hide resolved
sycl/include/sycl/ext/oneapi/experimental/reduction_properties.hpp
Outdated
Show resolved
Hide resolved
Bug was hidden during development due to testing on the CPU. Signed-off-by: John Pennycook <[email protected]>
I'd rather keep the overloads for now, if that's okay. Because this extension is only experimental, I don't want us to make changes to the "real" reduction interface if we don't have to. Plus, if we're successful with getting compile-time properties into a future version of the SYCL specification, I expect we'll want to generate a deprecation notice for the |
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
@gmlueck - Could you please take a quick look at the extension specification changes here? They're just typo fixes so it hopefully shouldn't take too long to review. |
sycl/doc/extensions/experimental/sycl_ext_oneapi_reduction_properties.asciidoc
Show resolved
Hide resolved
sycl/doc/extensions/experimental/sycl_ext_oneapi_reduction_properties.asciidoc
Show resolved
Hide resolved
sycl/doc/extensions/experimental/sycl_ext_oneapi_reduction_properties.asciidoc
Show resolved
Hide resolved
sycl/doc/extensions/experimental/sycl_ext_oneapi_reduction_properties.asciidoc
Outdated
Show resolved
Hide resolved
Fixes conflicts in PropKind enum.
sycl/doc/extensions/experimental/sycl_ext_oneapi_reduction_properties.asciidoc
Outdated
Show resolved
Hide resolved
@intel/llvm-gatekeepers, I think this can be merged now. |
Adds support for initialize_to_identity and deterministic properties. Since this extension is only experimental, the implementation here avoids making significant changes to reduction-related classes (e.g, reducer). A more straightforward implementation that attaches a compile-time property list to these classes is possible, but may be considered an ABI break. --- A note to reviewers: it occurred to me that `IsDeterministicOperator<BinaryOperation>` might actually be better as `IsDeterministicOperator<T, BinaryOperation>`, so that the implementation can infer that it's safe to use the faster reductions for certain types (e.g., `int` and `sycl::plus<>()` can safely use atomics) but I wanted to get your feedback on the proposed approach before going any further. **EDIT**: To clarify, I think such changes to `IsDeterministicOperator` could be left until a future PR, since the behavior of the `deterministic` property as implemented here should match the legacy `SYCL_DETERMINISTIC_REDUCTION` macro. We could implement optimizations later. --------- Signed-off-by: John Pennycook <[email protected]>
Adds support for initialize_to_identity and deterministic properties.
Since this extension is only experimental, the implementation here avoids making significant changes to reduction-related classes (e.g, reducer).
A more straightforward implementation that attaches a compile-time property list to these classes is possible, but may be considered an ABI break.
A note to reviewers: it occurred to me that
IsDeterministicOperator<BinaryOperation>
might actually be better asIsDeterministicOperator<T, BinaryOperation>
, so that the implementation can infer that it's safe to use the faster reductions for certain types (e.g.,int
andsycl::plus<>()
can safely use atomics) but I wanted to get your feedback on the proposed approach before going any further.EDIT: To clarify, I think such changes to
IsDeterministicOperator
could be left until a future PR, since the behavior of thedeterministic
property as implemented here should match the legacySYCL_DETERMINISTIC_REDUCTION
macro. We could implement optimizations later.