Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Add work-around for fill bug in memcpy2d tests #1688

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions SYCL/USM/copy2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,21 @@ int test(queue &Q, T ExpectedVal1, T ExpectedVal2) {
T *USMMemSrc = allocate<T, SrcAllocKind>(SRC_ELEMS, Q);
T *USMMemDst1 = allocate<T, DstAllocKind>(DST_ELEMS, Q);
T *USMMemDst2 = allocate<T, DstAllocKind>(DST_ELEMS, Q);
event Src1FillEvent =
fill<SrcAllocKind>(Q, USMMemSrc, ExpectedVal1, DST_ELEMS);
event Src2FillEvent =
fill<SrcAllocKind>(Q, USMMemSrc + DST_ELEMS, ExpectedVal2, DST_ELEMS);
event SrcFillEvent =
fill_with<SrcAllocKind>(Q, USMMemSrc, SRC_ELEMS, [=](size_t I) {
return I < DST_ELEMS ? ExpectedVal1 : ExpectedVal2;
});
event Dst1MemsetEvent =
memset<DstAllocKind>(Q, USMMemDst1, 0, DST_ELEMS * sizeof(T));
event Dst2MemsetEvent =
memset<DstAllocKind>(Q, USMMemDst2, 0, DST_ELEMS * sizeof(T));
event FirstCopyEvent = doCopy2D<T, PathKind>(
Q, USMMemSrc, RECT_WIDTH, USMMemDst1, RECT_WIDTH, RECT_WIDTH,
RECT_HEIGHT,
{Src1FillEvent, Src2FillEvent, Dst1MemsetEvent, Dst2MemsetEvent});
doCopy2D<T, PathKind>(Q, USMMemSrc + DST_ELEMS, RECT_WIDTH, USMMemDst2,
RECT_WIDTH, RECT_WIDTH, RECT_HEIGHT,
{FirstCopyEvent, Src1FillEvent, Src2FillEvent,
Dst1MemsetEvent, Dst2MemsetEvent})
RECT_HEIGHT, {SrcFillEvent, Dst1MemsetEvent, Dst2MemsetEvent});
doCopy2D<T, PathKind>(
Q, USMMemSrc + DST_ELEMS, RECT_WIDTH, USMMemDst2, RECT_WIDTH,
RECT_WIDTH, RECT_HEIGHT,
{FirstCopyEvent, SrcFillEvent, Dst1MemsetEvent, Dst2MemsetEvent})
.wait();
std::vector<T> Results;
Results.resize(SRC_ELEMS);
Expand Down
19 changes: 9 additions & 10 deletions SYCL/USM/memcpy2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,22 @@ int test(queue &Q, T ExpectedVal1, T ExpectedVal2) {
T *USMMemSrc = allocate<T, SrcAllocKind>(SRC_ELEMS, Q);
T *USMMemDst1 = allocate<T, DstAllocKind>(DST_ELEMS, Q);
T *USMMemDst2 = allocate<T, DstAllocKind>(DST_ELEMS, Q);
event Src1FillEvent =
fill<SrcAllocKind>(Q, USMMemSrc, ExpectedVal1, DST_ELEMS);
event Src2FillEvent =
fill<SrcAllocKind>(Q, USMMemSrc + DST_ELEMS, ExpectedVal2, DST_ELEMS);
event SrcFillEvent =
fill_with<SrcAllocKind>(Q, USMMemSrc, SRC_ELEMS, [=](size_t I) {
return I < DST_ELEMS ? ExpectedVal1 : ExpectedVal2;
});
event Dst1MemsetEvent =
memset<DstAllocKind>(Q, USMMemDst1, 0, DST_ELEMS * sizeof(T));
event Dst2MemsetEvent =
memset<DstAllocKind>(Q, USMMemDst2, 0, DST_ELEMS * sizeof(T));
event FirstMemcpyEvent = doMemcpy2D<T, PathKind>(
Q, USMMemDst1, RECT_WIDTH * sizeof(T), USMMemSrc,
RECT_WIDTH * sizeof(T), RECT_WIDTH * sizeof(T), RECT_HEIGHT,
{Src1FillEvent, Src2FillEvent, Dst1MemsetEvent, Dst2MemsetEvent});
doMemcpy2D<T, PathKind>(Q, USMMemDst2, RECT_WIDTH * sizeof(T),
USMMemSrc + DST_ELEMS, RECT_WIDTH * sizeof(T),
RECT_WIDTH * sizeof(T), RECT_HEIGHT,
{FirstMemcpyEvent, Src1FillEvent, Src2FillEvent,
Dst1MemsetEvent, Dst2MemsetEvent})
{SrcFillEvent, Dst1MemsetEvent, Dst2MemsetEvent});
doMemcpy2D<T, PathKind>(
Q, USMMemDst2, RECT_WIDTH * sizeof(T), USMMemSrc + DST_ELEMS,
RECT_WIDTH * sizeof(T), RECT_WIDTH * sizeof(T), RECT_HEIGHT,
{FirstMemcpyEvent, SrcFillEvent, Dst1MemsetEvent, Dst2MemsetEvent})
.wait();
std::vector<T> Results;
Results.resize(SRC_ELEMS);
Expand Down