Unify mapAllocation and hostPtrAllocation to transferAllocation

Change-Id: I875d6886ce3b0866da7679925ba973d2d16a1141
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz 2019-10-24 14:18:39 +02:00 committed by sys_ocldev
parent 224740207f
commit 6059e77fb4
6 changed files with 10 additions and 16 deletions

View File

@ -37,8 +37,7 @@ struct BuiltinOpParams {
MemObj *dstMemObj = nullptr; MemObj *dstMemObj = nullptr;
GraphicsAllocation *srcSvmAlloc = nullptr; GraphicsAllocation *srcSvmAlloc = nullptr;
GraphicsAllocation *dstSvmAlloc = nullptr; GraphicsAllocation *dstSvmAlloc = nullptr;
GraphicsAllocation *mapAllocation = nullptr; GraphicsAllocation *transferAllocation = nullptr; //mapAllocation or hostPtrAllocation
GraphicsAllocation *hostPtrAllocation = nullptr;
const MemObjsForAuxTranslation *memObjsForAuxTranslation = nullptr; const MemObjsForAuxTranslation *memObjsForAuxTranslation = nullptr;
AuxTranslationDirection auxTranslationDirection = AuxTranslationDirection::None; AuxTranslationDirection auxTranslationDirection = AuxTranslationDirection::None;
bool unifiedMemoryArgsRequireMemSync = true; bool unifiedMemoryArgsRequireMemSync = true;

View File

@ -92,8 +92,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
dc.srcMemObj = buffer; dc.srcMemObj = buffer;
dc.srcOffset = {offset, 0, 0}; dc.srcOffset = {offset, 0, 0};
dc.size = {size, 0, 0}; dc.size = {size, 0, 0};
dc.mapAllocation = mapAllocation; dc.transferAllocation = mapAllocation ? mapAllocation : hostPtrSurf.getAllocation();
dc.hostPtrAllocation = hostPtrSurf.getAllocation();
builder.buildDispatchInfos(dispatchInfo, dc); builder.buildDispatchInfos(dispatchInfo, dc);
if (context->isProvidingPerformanceHints()) { if (context->isProvidingPerformanceHints()) {

View File

@ -88,8 +88,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
dc.dstMemObj = buffer; dc.dstMemObj = buffer;
dc.dstOffset = {offset, 0, 0}; dc.dstOffset = {offset, 0, 0};
dc.size = {size, 0, 0}; dc.size = {size, 0, 0};
dc.mapAllocation = mapAllocation; dc.transferAllocation = mapAllocation ? mapAllocation : hostPtrSurf.getAllocation();
dc.hostPtrAllocation = hostPtrSurf.getAllocation();
builder.buildDispatchInfos(dispatchInfo, dc); builder.buildDispatchInfos(dispatchInfo, dc);
enqueueHandler<CL_COMMAND_WRITE_BUFFER>( enqueueHandler<CL_COMMAND_WRITE_BUFFER>(

View File

@ -53,10 +53,7 @@ BlitProperties BlitProperties::constructPropertiesForReadWriteBuffer(BlitterCons
void *hostPtr = nullptr; void *hostPtr = nullptr;
size_t hostPtrOffset = 0; size_t hostPtrOffset = 0;
GraphicsAllocation *hostAllocation = builtinOpParams.hostPtrAllocation; GraphicsAllocation *hostAllocation = builtinOpParams.transferAllocation;
if (builtinOpParams.mapAllocation) {
hostAllocation = builtinOpParams.mapAllocation;
}
if (BlitterConstants::BlitDirection::HostPtrToBuffer == blitDirection) { if (BlitterConstants::BlitDirection::HostPtrToBuffer == blitDirection) {
// write buffer // write buffer

View File

@ -766,7 +766,7 @@ HWTEST_F(BcsTests, givenMapAllocationInBuiltinOpParamsWhenConstructingThenUseItA
builtinOpParams.dstMemObj = buffer.get(); builtinOpParams.dstMemObj = buffer.get();
builtinOpParams.srcPtr = mapPtr; builtinOpParams.srcPtr = mapPtr;
builtinOpParams.size.x = 1; builtinOpParams.size.x = 1;
builtinOpParams.mapAllocation = mapAllocation; builtinOpParams.transferAllocation = mapAllocation;
auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer, auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::HostPtrToBuffer,
csr, builtinOpParams, true); csr, builtinOpParams, true);
@ -778,7 +778,7 @@ HWTEST_F(BcsTests, givenMapAllocationInBuiltinOpParamsWhenConstructingThenUseItA
builtinOpParams.srcMemObj = buffer.get(); builtinOpParams.srcMemObj = buffer.get();
builtinOpParams.dstPtr = mapPtr; builtinOpParams.dstPtr = mapPtr;
builtinOpParams.size.x = 1; builtinOpParams.size.x = 1;
builtinOpParams.mapAllocation = mapAllocation; builtinOpParams.transferAllocation = mapAllocation;
auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::BufferToHostPtr, auto blitProperties = BlitProperties::constructPropertiesForReadWriteBuffer(BlitterConstants::BlitDirection::BufferToHostPtr,
csr, builtinOpParams, true); csr, builtinOpParams, true);

View File

@ -887,15 +887,15 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenMapAllocationWhenEnqueueingReadOrWriteBu
auto mapAllocation = bufferForBlt->getMapAllocation(); auto mapAllocation = bufferForBlt->getMapAllocation();
EXPECT_NE(nullptr, mapAllocation); EXPECT_NE(nullptr, mapAllocation);
mockCmdQ->kernelParams.mapAllocation = nullptr; mockCmdQ->kernelParams.transferAllocation = nullptr;
auto mapPtr = clEnqueueMapBuffer(mockCmdQ, bufferForBlt.get(), true, 0, 0, 1, 0, nullptr, nullptr, &retVal); auto mapPtr = clEnqueueMapBuffer(mockCmdQ, bufferForBlt.get(), true, 0, 0, 1, 0, nullptr, nullptr, &retVal);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(mapAllocation, mockCmdQ->kernelParams.mapAllocation); EXPECT_EQ(mapAllocation, mockCmdQ->kernelParams.transferAllocation);
mockCmdQ->kernelParams.mapAllocation = nullptr; mockCmdQ->kernelParams.transferAllocation = nullptr;
retVal = clEnqueueUnmapMemObject(mockCmdQ, bufferForBlt.get(), mapPtr, 0, nullptr, nullptr); retVal = clEnqueueUnmapMemObject(mockCmdQ, bufferForBlt.get(), mapPtr, 0, nullptr, nullptr);
EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(mapAllocation, mockCmdQ->kernelParams.mapAllocation); EXPECT_EQ(mapAllocation, mockCmdQ->kernelParams.transferAllocation);
} }
HWTEST_TEMPLATED_F(BcsBufferTests, givenWriteBufferEnqueueWhenProgrammingCommandStreamThenAddSemaphoreWait) { HWTEST_TEMPLATED_F(BcsBufferTests, givenWriteBufferEnqueueWhenProgrammingCommandStreamThenAddSemaphoreWait) {