Skip to content
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] Align usm_allocator ctor and operators with SYCL2020 #6867

Merged
merged 1 commit into from
Sep 27, 2022

Conversation

KseniyaTikhomirova
Copy link
Contributor

Signed-off-by: Tikhomirova, Kseniya kseniya.tikhomirova@intel.com

Signed-off-by: Tikhomirova, Kseniya <kseniya.tikhomirova@intel.com>
@KseniyaTikhomirova KseniyaTikhomirova changed the title [SYCL] Align usm_allocator ctor and operators with SYCCL2020 [SYCL] Align usm_allocator ctor and operators with SYCL2020 Sep 23, 2022
@KseniyaTikhomirova
Copy link
Contributor Author

I found that I am not able to build simple piece of code with SYCL RT by gcc 9.3.0 but able to build using clang.

The error I receive using gcc is because CLassA constructor and operators are declared as noexcept default while constructors and operators for some class members of classA are not declared as no except explicitly. And according to https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1778 gcc generates error.
I also found that this behavior with deletion should be reverted in c++20 and this proposal was accepted https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1286r2.html

The classes I am pointing to are:
usm_allocator with copy constructor which explicitly declared as noexcept
https://github.com/intel/llvm/blob/sycl/sycl/include/sycl/usm/usm_allocator.hpp#L42
which has device as field and device's copy constructor is not explicitly specified as noexcept:
https://github.com/intel/llvm/blob/sycl/sycl/include/sycl/device.hpp#L83

I clarified with front end engineer if our usage could be ill-formed and it shouldn't:
device class has single field which is shared_ptr and it is copy constructor is explicitly noexcept. So device could be also noexcept but implicitly.

Nevertheless I suggest to align constructors and operators declaration with spec and nested objects. Because extra noexcept adds extra limitation to constructor and makes not possible to build some valid code with gcc 9.3.0 (as example).

@KseniyaTikhomirova KseniyaTikhomirova marked this pull request as ready for review September 26, 2022 08:22
@KseniyaTikhomirova KseniyaTikhomirova requested a review from a team as a code owner September 26, 2022 08:22
@pvchupin pvchupin merged commit 7b02697 into intel:sycl Sep 27, 2022
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.

3 participants