mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 15:03:02 +08:00
Revert "Revert "Fix Read/WriteBuffer for unaligned offsets""
This reverts commit 71f6524197.
Change-Id: I4f31fb6fa14fb5e3b8d8bf0a1745429bcdacd5af
This commit is contained in:
committed by
sys_ocldev
parent
541ab5af50
commit
f6757c02a4
@@ -89,8 +89,15 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
|
||||
BuiltInOwnershipWrapper builtInLock(builder, this->context);
|
||||
|
||||
void *srcPtr = const_cast<void *>(ptr);
|
||||
void *alignedSrcPtr = srcPtr;
|
||||
size_t srcPtrOffset = 0;
|
||||
|
||||
HostPtrSurface hostPtrSurf(srcPtr, size, true);
|
||||
if (!isAligned<4>(srcPtr)) {
|
||||
alignedSrcPtr = alignDown(srcPtr, 4);
|
||||
srcPtrOffset = ptrDiff(srcPtr, alignedSrcPtr);
|
||||
}
|
||||
|
||||
HostPtrSurface hostPtrSurf(alignedSrcPtr, size + srcPtrOffset, true);
|
||||
MemObjSurface bufferSurf(buffer);
|
||||
Surface *surfaces[] = {&bufferSurf, &hostPtrSurf};
|
||||
|
||||
@@ -99,11 +106,13 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
|
||||
if (!status) {
|
||||
return CL_OUT_OF_RESOURCES;
|
||||
}
|
||||
srcPtr = reinterpret_cast<void *>(hostPtrSurf.getAllocation()->getGpuAddressToPatch());
|
||||
|
||||
hostPtrSurf.getAllocation()->allocationOffset = srcPtrOffset;
|
||||
}
|
||||
|
||||
BuiltinDispatchInfoBuilder::BuiltinOpParams dc;
|
||||
dc.srcPtr = srcPtr;
|
||||
dc.srcPtr = alignedSrcPtr;
|
||||
dc.srcOffset = {srcPtrOffset, 0, 0};
|
||||
dc.dstMemObj = buffer;
|
||||
dc.dstOffset = {offset, 0, 0};
|
||||
dc.size = {size, 0, 0};
|
||||
|
||||
Reference in New Issue
Block a user