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
Copies numBytes of data from the pointer src to the pointer dest. The dest and src parameters must each either be a host pointer or a pointer within a USM allocation that is accessible on the handler’s device.
Source: Table 132 in SYCL 2020 spec rev. 9
However, currently, running the code using non-USM pointers with SYCL Sanitizer produces fatal errors.
I suggest adding a way to either instrument and check non-USM memory allocations, or at least add a flag to sycl-sanitizer to make such errors non-fatal.
Describe the solution you would like
A sycl-sanitize flag to allow the calls to SYCL API with unknown pointers. --allow-unknown-pointers?
Describe alternatives you have considered
Keep things as they are. Not great, valid SYCL programs will fail under sycl-sanitizer.
Allow unknown pointers by default. Might miss some errors, but those would likely segfault anyway?
Also instrument non-USM host memory allocations and track stack state, thus making all pointers known. The best solution for users, but perhaps more overhead/complexity?
Additional context
$ cat test-sanitizer-unknown.cpp #include <iostream>#include <sycl/sycl.hpp>int main() { for (const auto &dev : sycl::device::get_devices(sycl::info::device_type::gpu)) { std::cout << dev.get_info<sycl::info::device::name>() << std::endl; sycl::queue q{dev}; int stack = 1; int *heap = static_cast<int *>(malloc(sizeof(int))); *heap = 2; int *host = sycl::malloc_host<int>(1, q); *host = 3; int *d = sycl::malloc_device<int>(3, q); q.memcpy(d + 0, &stack, sizeof(int)); q.memcpy(d + 1, heap, sizeof(int)); q.memcpy(d + 2, host, sizeof(int)); q.wait(); sycl::free(d, q); free(heap); sycl::free(host, q); } std::cout << "Done!" << std::endl;}
$ clang++ -g -fsycl test-sanitizer-unknown.cpp && ONEAPI_DEVICE_SELECTOR=level_zero:gpu ./a.out ZE_LOADER_DEBUG_TRACE:Using Loader Library Path: ZE_LOADER_DEBUG_TRACE:Tracing Layer Library Path: libze_tracing_layer.so.1Intel(R) Arc(TM) A770 GraphicsIntel(R) UHD Graphics 770Done!
$ clang++ -g -fsycl test-sanitizer-unknown.cpp && ONEAPI_DEVICE_SELECTOR=level_zero:gpu sycl-sanitize ./a.out ZE_LOADER_DEBUG_TRACE:Using Loader Library Path: ZE_LOADER_DEBUG_TRACE:Tracing Layer Library Path: libze_tracing_layer.so.1Intel(R) Arc(TM) A770 Graphics[USM] Function uses unknown USM pointer (could be already released or not allocated as USM) as source memory block. | memcpy location: function main at test-sanitizer-unknown.cpp:17terminate called without an active exceptionAborted (core dumped)
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe
sycl::memcpy
and its friends can work fine with non-USM host pointers. This could be sub-optimal, but is fully legal:However, currently, running the code using non-USM pointers with SYCL Sanitizer produces fatal errors.
I suggest adding a way to either instrument and check non-USM memory allocations, or at least add a flag to
sycl-sanitizer
to make such errors non-fatal.Describe the solution you would like
A
sycl-sanitize
flag to allow the calls to SYCL API with unknown pointers.--allow-unknown-pointers
?Describe alternatives you have considered
sycl-sanitizer
.Additional context
The text was updated successfully, but these errors were encountered: