-
Notifications
You must be signed in to change notification settings - Fork 74
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
Memset takes non-const reference to view #2292
Comments
I am not sure if we only call constant methods of the view. |
From what I see in the linked file, it's all getters of some form. And semantically I would be very surprised if there's a (not-by-oversight) non-const use in there. As it first failed on the linked line and not at all on CPU, I think you'd only have to check the top of that file. |
I think the issue is if we think a view and a buffer should behave like a container (e.g. a With a With a With an alpaka view, a So, currently views and buffers behave more like a pointer. |
Very well analysed! I fully agree! In my interpretation of the English language, "View" feels like a very pointer-like thing but I know that a Buffer has more aspects of a container (at least in alpaka). Considering the words only, I might have gone as far as drawing the dividing line between the two but I'm not sure if that would be practical (e.g. "Is a buffer a view?" and the like). Edit: |
Yes, an alpaka buffer implements the view interface, so it is a view and can be used with To add some confusion, |
Hi,
I've just spent way too long deducing the subtleties of calling
alpaka::memset
: Down in the GPU path, the functionCreateTaskMemset::createTaskMemset(TView&, ...)
takes its view by NON-const reference. This implies that it cannot bind to rvalue views. That bit me in a call likealpaka::memset(..., alpaka::createView(...), ...);
with the very vague error message
(now find that one
&
and realise that precisely that one tries to bind to an rvalue).I think that interface is semantically not quite correct. The view is kept constant during the execution of the function. It's the underlying memory that changes, i.e., we should have something like
TView<non-const TElem> const&
(although specifying that without C++20 concepts is probably non-trivial).I would suggest to either change to
const&
or at least find a way to provide a helpful error message.The text was updated successfully, but these errors were encountered: