Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][DeviceSanitizer] Checking "sycl::free" related errors (#12882)
UR: oneapi-src/unified-runtime#1402 This PR added supports for checking the following types of error in "UR_LAYER_ASAN": - bad-free: the memory address to be freed is not allocated by UR - bad-context: the memory address to be freed uses a wrong "context" - double-free: the memory address to be freed is already freed - use-after-free: the freed memory is used in kernel I added the environment variable "UR_LAYER_ASAN_OPTIONS" to have additional control over "UR_LAYER_ASAN", which is similar to "ASAN_OPTIONS" in [ASan](https://github.com/google/sanitizers/wiki/AddressSanitizerFlags). Currently, it supports: - "quarantine_size_mb" (default = 0) - Size (in MB) of quarantine per device. The pointers passed to urUSMFree are not freed immediately, but saved into QuarantineCache (per device cache), and when the cached chunk size (only counts the size of USM buffer, not shadow memory) is more than "quarantine_size_mb", the first enqueued chunk will be freed (aka., FIFO). Lower value may reduce memory usage but increase the chance of false negatives - This option must be enabled for checking "double-free" and "use-after-free" - "debug" (default = 0) - Print extra debug messages in kernel ("__AsanDebug” in “libdevice/sanitizer_utils.cpp”), which is helpful for DeviceSanitizer developers. For example, to enable "use-after-free" with 5MB quarantine cache and debug message in kernel, you need to ```bash UR_LAYER_ASAN_OPTIONS="quarantine_size_mb:5;debug:1" ./sycl_app ``` --------- Co-authored-by: Maosu Zhao <maosu.zhao@intel.com> Co-authored-by: Aaron Greig <aaron.greig@codeplay.com>
- Loading branch information