Skip to content

Commit 824180d

Browse files
committed
Emulate USMFill2D with USMFill
1 parent 6461460 commit 824180d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,20 @@ ur_result_t EnqueueMemCopyRectHelper(
8383
NumEventsInWaitList, EventWaitList, &NewEvent));
8484
Events.push_back(NewEvent);
8585
} else if (IsDstDeviceUSM && !IsSrcDeviceUSM) {
86-
NewEvent = nullptr;
8786
uptr DstShadowAddr = DeviceInfo->Shadow->MemToShadow(
8887
(uptr)DstOrigin + (i * DstSlicePitch));
8988
const char Val = 0;
90-
UR_CALL(getContext()->urDdiTable.Enqueue.pfnUSMFill2D(
91-
Queue, (void *)DstShadowAddr, DstRowPitch, 1, &Val,
92-
Region.width, Region.height, NumEventsInWaitList, EventWaitList,
93-
&NewEvent));
94-
Events.push_back(NewEvent);
89+
// opencl & l0 adapter doesn't implement urEnqueueUSMFill2D, so
90+
// emulate the operation with urEnqueueUSMFill.
91+
for (size_t HeightIndex = 0; HeightIndex < Region.height;
92+
HeightIndex++) {
93+
NewEvent = nullptr;
94+
UR_CALL(getContext()->urDdiTable.Enqueue.pfnUSMFill(
95+
Queue, (void *)(DstShadowAddr + HeightIndex * DstRowPitch),
96+
1, &Val, Region.width, NumEventsInWaitList, EventWaitList,
97+
&NewEvent));
98+
Events.push_back(NewEvent);
99+
}
95100
}
96101
}
97102

0 commit comments

Comments
 (0)