Skip to content

Commit 00ce2da

Browse files
committed
wip
1 parent ed82004 commit 00ce2da

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

source/loader/layers/sanitizer/msan/msan_ddi.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,8 +1319,8 @@ ur_result_t UR_APICALL urEnqueueUSMFill(
13191319
getMsanInterceptor()->getDeviceInfo(MemInfo->Device);
13201320
const auto MemShadow = DeviceInfo->Shadow->MemToShadow(Mem);
13211321

1322-
UR_CALL(EnqueueUSMBlockingSet(hQueue, (void *)MemShadow, 0, size, 1,
1323-
phEvent, phEvent));
1322+
UR_CALL(EnqueueUSMBlockingSet(hQueue, (void *)MemShadow, 0, size,
1323+
phEvent ? 1 : 0, phEvent, phEvent));
13241324
}
13251325

13261326
return UR_RESULT_SUCCESS;
@@ -1367,16 +1367,17 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy(
13671367
const auto DstShadow = DeviceInfo->Shadow->MemToShadow(Dst);
13681368

13691369
UR_CALL(pfnUSMMemcpy(hQueue, blocking, (void *)DstShadow,
1370-
(void *)SrcShadow, size, 1, phEvent, phEvent));
1370+
(void *)SrcShadow, size, phEvent ? 1 : 0, phEvent,
1371+
phEvent));
13711372
} else if (DstInfoItOp) {
13721373
auto DstInfo = (*DstInfoItOp)->second;
13731374

13741375
const auto &DeviceInfo =
13751376
getMsanInterceptor()->getDeviceInfo(DstInfo->Device);
13761377
auto DstShadow = DeviceInfo->Shadow->MemToShadow(Dst);
13771378

1378-
UR_CALL(EnqueueUSMBlockingSet(hQueue, (void *)DstShadow, 0, size, 1,
1379-
phEvent, phEvent));
1379+
UR_CALL(EnqueueUSMBlockingSet(hQueue, (void *)DstShadow, 0, size,
1380+
phEvent ? 1 : 0, phEvent, phEvent));
13801381
}
13811382

13821383
return UR_RESULT_SUCCESS;
@@ -1427,7 +1428,7 @@ ur_result_t UR_APICALL urEnqueueUSMFill2D(
14271428

14281429
const char Pattern = 0;
14291430
UR_CALL(pfnUSMFill2D(hQueue, (void *)MemShadow, pitch, 1, &Pattern,
1430-
width, height, 1, phEvent, phEvent));
1431+
width, height, phEvent ? 1 : 0, phEvent, phEvent));
14311432
}
14321433

14331434
return UR_RESULT_SUCCESS;
@@ -1481,7 +1482,7 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
14811482

14821483
UR_CALL(pfnUSMMemcpy2D(hQueue, blocking, (void *)DstShadow, dstPitch,
14831484
(void *)SrcShadow, srcPitch, width, height,
1484-
numEventsInWaitList, phEventWaitList, phEvent));
1485+
phEvent ? 1 : 0, phEvent, phEvent));
14851486
} else if (DstInfoItOp) {
14861487
auto DstInfo = (*DstInfoItOp)->second;
14871488

@@ -1491,8 +1492,8 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
14911492

14921493
const char Pattern = 0;
14931494
UR_CALL(getContext()->urDdiTable.Enqueue.pfnUSMFill2D(
1494-
hQueue, (void *)DstShadow, dstPitch, 1, &Pattern, width, height, 1,
1495-
phEvent, phEvent));
1495+
hQueue, (void *)DstShadow, dstPitch, 1, &Pattern, width, height,
1496+
phEvent ? 1 : 0, phEvent, phEvent));
14961497
}
14971498

14981499
return UR_RESULT_SUCCESS;

source/loader/layers/sanitizer/msan/msan_interceptor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ ur_result_t MsanInterceptor::allocateMemory(ur_context_handle_t Context,
7272
// For memory release
7373
{
7474
std::scoped_lock<ur_shared_mutex> Guard(m_AllocationMapMutex);
75-
m_AllocationMap.emplace(AI->AllocBegin, std::move(AI));
75+
m_AllocationMap.emplace(AI->AllocBegin, AI);
7676
}
7777

7878
ManagedQueue Queue(Context, Device);

source/loader/layers/sanitizer/msan/msan_shadow.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ ur_result_t MsanShadowMemoryGPU::EnqueueMapShadow(
178178
std::vector<ur_event_handle_t> &EventWaitList,
179179
ur_event_handle_t *OutEvent) {
180180

181-
ur_physical_mem_properties_t Desc{UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES,
182-
nullptr, 0};
183-
184181
const size_t PageSize = GetVirtualMemGranularity(Context, Device);
185182

186183
const uptr ShadowBegin = MemToShadow(Ptr);
@@ -194,7 +191,7 @@ ur_result_t MsanShadowMemoryGPU::EnqueueMapShadow(
194191
if (VirtualMemMaps.find(MappedPtr) == VirtualMemMaps.end()) {
195192
ur_physical_mem_handle_t PhysicalMem{};
196193
auto URes = getContext()->urDdiTable.PhysicalMem.pfnCreate(
197-
Context, Device, PageSize, &Desc, &PhysicalMem);
194+
Context, Device, PageSize, nullptr, &PhysicalMem);
198195
if (URes != UR_RESULT_SUCCESS) {
199196
getContext()->logger.error("urPhysicalMemCreate(): {}", URes);
200197
return URes;
@@ -223,7 +220,8 @@ ur_result_t MsanShadowMemoryGPU::EnqueueMapShadow(
223220
}
224221

225222
EventWaitList.clear();
226-
EventWaitList.push_back(*OutEvent);
223+
if (OutEvent)
224+
EventWaitList.push_back(*OutEvent);
227225

228226
VirtualMemMaps[MappedPtr].first = PhysicalMem;
229227
}

0 commit comments

Comments
 (0)