Skip to content

Commit debfeb2

Browse files
authored
[DeviceASAN][NFC] Improve the log message (#18215)
1 parent 4a912ed commit debfeb2

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

unified-runtime/source/loader/layers/sanitizer/asan/asan_interceptor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ AsanInterceptor::getOrCreateShadowMemory(ur_device_handle_t Device,
325325
if (m_ShadowMap.find(Type) == m_ShadowMap.end()) {
326326
m_ShadowMap[Type] = CreateShadowMemory(Device, Type);
327327
m_ShadowMap[Type]->Setup();
328+
UR_LOG_L(getContext()->logger, INFO, "ShadowMemory(Global, {} ~ {})",
329+
(void *)m_ShadowMap[Type]->ShadowBegin,
330+
(void *)m_ShadowMap[Type]->ShadowEnd);
328331
}
329332
return m_ShadowMap[Type];
330333
}

unified-runtime/source/loader/layers/sanitizer/asan/asan_shadow.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ ur_result_t ShadowMemoryGPU::EnqueuePoisonShadow(ur_queue_handle_t Queue,
170170
uptr ShadowBegin = MemToShadow(Ptr);
171171
uptr ShadowEnd = MemToShadow(Ptr + Size - 1);
172172
assert(ShadowBegin <= ShadowEnd);
173+
174+
UR_LOG_L(getContext()->logger, DEBUG,
175+
"EnqueuePoisonShadow(addr={}, count={}, value={})",
176+
(void *)ShadowBegin, ShadowEnd - ShadowBegin + 1,
177+
(void *)(size_t)Value);
178+
179+
// Make sure the shadow memory is mapped to physical memory
173180
{
174181
static const size_t PageSize = GetVirtualMemGranularity(Context, Device);
175182

@@ -217,12 +224,12 @@ ur_result_t ShadowMemoryGPU::EnqueuePoisonShadow(ur_queue_handle_t Queue,
217224

218225
auto URes = EnqueueUSMBlockingSet(Queue, (void *)ShadowBegin, Value,
219226
ShadowEnd - ShadowBegin + 1);
220-
UR_LOG_L(getContext()->logger, DEBUG,
221-
"EnqueuePoisonShadow (addr={}, count={}, value={}): {}",
222-
(void *)ShadowBegin, ShadowEnd - ShadowBegin + 1,
223-
(void *)(size_t)Value, URes);
227+
224228
if (URes != UR_RESULT_SUCCESS) {
225-
UR_LOG_L(getContext()->logger, ERR, "EnqueueUSMBlockingSet(): {}", URes);
229+
UR_LOG_L(getContext()->logger, ERR,
230+
"EnqueuePoisonShadow(addr={}, count={}, value={}): {}",
231+
(void *)ShadowBegin, ShadowEnd - ShadowBegin + 1,
232+
(void *)(size_t)Value, URes);
226233
return URes;
227234
}
228235

0 commit comments

Comments
 (0)