-
Notifications
You must be signed in to change notification settings - Fork 405
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
fix view constructor constraints #6950
base: develop
Are you sure you want to change the base?
Conversation
…emove is_assignable_data_type which is now not used anywhere
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 am seeing
$ git grep -n "static_assert(Mapping::is_assignable" .
containers/src/Kokkos_DynRankView.hpp:1009: static_assert(Mapping::is_assignable,
containers/src/Kokkos_DynRankView.hpp:1020: static_assert(Mapping::is_assignable,
containers/src/Kokkos_DynRankView.hpp:1036: static_assert(Mapping::is_assignable,
containers/src/Kokkos_DynRankView.hpp:1047: static_assert(Mapping::is_assignable,
containers/src/Kokkos_DynamicView.hpp:483: static_assert(Mapping::is_assignable,
containers/src/Kokkos_OffsetView.hpp:822: static_assert(Mapping::is_assignable,
containers/src/Kokkos_OffsetView.hpp:837: static_assert(Mapping::is_assignable,
containers/src/Kokkos_OffsetView.hpp:857: static_assert(Mapping::is_assignable,
containers/src/Kokkos_OffsetView.hpp:871: static_assert(Mapping::is_assignable,
core/src/Kokkos_View.hpp:1353: static_assert(Mapping::is_assignable,
core/src/Kokkos_View.hpp:1368: static_assert(Mapping::is_assignable, "Incompatible View copy assignment");
core/src/Kokkos_View.hpp:1594: static_assert(Mapping::is_assignable,
core/src/Kokkos_View.hpp:1609: static_assert(Mapping::is_assignable,
Is there a good reason that you are not addressing all of them here?
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.
What about
core/src/impl/Kokkos_ViewArray.hpp:426: is_assignable_data_type =
?
@masterleinad it seems to have been removed? |
No I can do it |
Ah, yes, needed to update my local |
@masterleinad these are "semi-private" (i.e. not actually private but people shouldn't be using these constructors since the tracker type is impl. I'm not sure we need these to be constrained. I'll add the other ones 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.
How public is is_assignable_data_type
is there a reason to remove it other than you don't use it anymore?
static_assert( | ||
!std::is_constructible_v<Kokkos::View<double **>, Kokkos::View<double *>>); | ||
static_assert( | ||
!std::is_assignable_v<Kokkos::View<double **> &, Kokkos::View<double *>>); |
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.
Please drop the &
here and everywhere below.
Kokkos::View<double[3][5], Kokkos::LayoutLeft>>); | ||
static_assert( | ||
!std::is_assignable_v<Kokkos::View<double[3][5], Kokkos::LayoutLeft> &, | ||
Kokkos::View<double[3][5], Kokkos::LayoutRight>>); |
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.
Considering how we always check assignable && constructible consider defining a is_constructible_and_assigable_v
and a not_constructive_nor_assigable_v
variable templates.
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.
What about test TestViewConversions
It is
|
@dalg24 does it break trilinos or those are just types that are trying to make conformant Kokkos mappings? If it's the later, those enums after this PR will just be useless, but not broken |
I would assume it doesn't break |
I have thought more about this: and I am not sure I want to "fix" this, this way. The basic issue is that Pre C++20 constraints provide unintelligible error messages where you have to parse SFINAE based enable ifs and what not to figure out what is going on. So we deliberately made some non-allowed stuff mandates, i.e. static asserts. Thus to enable checks if something is constructible from something else, Kokkos has the Now it is unfortunate that But I am not convinced that the tradeoff of worse error messages is worth it to make We conditionally add |
Note that this PR uses
is_assignable
on the mapping type for constraining the converting constructor and assignment for View., replacingis_assignable_data_type
.This is a breaking change; i.e.
std::is_constructible_v<Kokkos::View<double[3][5], Kokkos::LayoutRight>, Kokkos::View<double[3][5], Kokkos::LayoutLeft>>
was true before this change but is false now. However you couldn't actually construct the view because we would static assert in the body of the function.Finally, I removed
is_assignable_data_type
. It was not used anywhere else and was a strict subset ofis_assignable
.