Skip to content

Commit 885ed20

Browse files
zhaomaosubb-ur
authored andcommitted
Add exportable memory support for ASAN, MSAN, and TSAN (#21900)
Add sanitizer instrumentation for the sycl_ext_oneapi_memory_export extension's exportable device memory APIs.
1 parent 766a750 commit 885ed20

16 files changed

Lines changed: 451 additions & 233 deletions

source/loader/layers/sanitizer/asan/asan_buffer.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,9 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) {
9595
if (!Allocation) {
9696
ur_usm_desc_t USMDesc{};
9797
USMDesc.align = getAlignment();
98-
ur_usm_pool_handle_t Pool{};
99-
URes = getAsanInterceptor()->allocateMemory(Context, Device, &USMDesc, Pool,
100-
Size, AllocType::MEM_BUFFER,
101-
ur_cast<void **>(&Allocation));
98+
URes = getAsanInterceptor()->allocateMemory(
99+
Context, Device, AllocMemoryParams::forUSM(&USMDesc, {}), Size,
100+
AllocType::MEM_BUFFER, ur_cast<void **>(&Allocation));
102101
if (URes != UR_RESULT_SUCCESS) {
103102
UR_LOG_L(getContext()->logger, ERR,
104103
"Failed to allocate {} bytes memory for buffer {}", Size, this);
@@ -133,10 +132,9 @@ ur_result_t MemBuffer::getHandle(ur_device_handle_t Device, char *&Handle) {
133132
if (!HostAllocation) {
134133
ur_usm_desc_t USMDesc{};
135134
USMDesc.align = getAlignment();
136-
ur_usm_pool_handle_t Pool{};
137135
URes = getAsanInterceptor()->allocateMemory(
138-
Context, nullptr, &USMDesc, Pool, Size, AllocType::HOST_USM,
139-
ur_cast<void **>(&HostAllocation));
136+
Context, nullptr, AllocMemoryParams::forUSM(&USMDesc, {}), Size,
137+
AllocType::HOST_USM, ur_cast<void **>(&HostAllocation));
140138
if (URes != UR_RESULT_SUCCESS) {
141139
UR_LOG_L(getContext()->logger, ERR,
142140
"Failed to allocate {} bytes host USM for buffer {} migration",

0 commit comments

Comments
 (0)