You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that icpx is able to detect unused accessors only when they are created with buffer.get_access(...). For example, creating them with sycl::accessor{buffer, ...} does not generate any warning.
with an unused accessor which doesn't get detected when I compile with icpx --std=c++17 -fsycl -Wall -Wextra -Wpedantic -Werror -Wshadow main.cpp -o main.x.
accessor constructor has a side effect, because it calls non-const methods on a buffer object which was passed to it by reference. So, the variable cannot be safely removed, because it would change the state of the program.
buffer::get_access also invokes the very same accessor constructor, but it then returns it and the resulting unused_acc is probably initialized differently, i.e. via copy constructor of accessor which doesn't have the same side effect, so that resulting variable can be safely removed.
That is my understanding as to why it could be happening. The results showcased in the description do look confusing, but I'm not 100% if that's a bug due to the said side effect (which is legal, because buffer is passed to accessor as a non-const reference in accordance with the SYCL 2020 spec).
Describe the bug
It appears that
icpx
is able to detect unused accessors only when they are created withbuffer.get_access(...)
. For example, creating them withsycl::accessor{buffer, ...}
does not generate any warning.To reproduce
I have this simple program:
with an unused accessor which doesn't get detected when I compile with
icpx --std=c++17 -fsycl -Wall -Wextra -Wpedantic -Werror -Wshadow main.cpp -o main.x
.However, If I change it to:
It gets detected and the compilation fails with:
Environment
Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
Additional context
No response
The text was updated successfully, but these errors were encountered: