-
Notifications
You must be signed in to change notification settings - Fork 407
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
Allow ViewCtorProp in create_mirror[_view] #5095
Allow ViewCtorProp in create_mirror[_view] #5095
Conversation
In support of #4792 |
5cc4602
to
bd05c73
Compare
c864131
to
fef5f19
Compare
Most of the internals are now expressed in terms of a ViewCtorProp overload and there is also such a user-facing overload. In addition to current functionalities, this overload also allows specifying an execution space that avoids some fences depending on #4826. |
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.
Couple questions but largely good. Follow up: can we get rid of some of the overlaods by making ViewCtorProps implicitly constructible from some of the explicit things.
auto mirror_host_view = Kokkos::create_mirror_view( | ||
Kokkos::view_alloc(Kokkos::HostSpace{}, Kokkos::WithoutInitializing, | ||
Kokkos::DefaultExecutionSpace{}), | ||
host_view); |
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.
can we test the view_alloc(WithoutInitializing)
too?
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.
Sure, see 8c9aefb.
const I&... arg_prop) { | ||
return Kokkos::create_mirror(arg_prop..., space, src); | ||
const Impl::ViewCtorProp<ViewCtorArgs...>& arg_prop) { | ||
return create_mirror(space, src, arg_prop); |
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.
did you want to call this here? Or rather add the space to the arg_prop
?
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.
} | ||
|
||
// Create a mirror in a new space | ||
template <class Space, class T, class... P> | ||
inline auto create_mirror( | ||
const Space& space, const Kokkos::Experimental::DynamicView<T, P...>& src) { | ||
return Impl::create_mirror(space, src); | ||
return Impl::create_mirror(space, src, Impl::ViewCtorProp<>{}); |
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.
should we just pass view_alloc(space)
in 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.
No, I don't think that's possible. implicit conversions are not considered during type deduction, see https://en.cppreference.com/w/cpp/language/template_argument_deduction#Implicit_conversions. The only thing we could do is to derive from |
0aef131
to
3f1e440
Compare
Following-up on #4826, #4844, and #5035.