mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
performance: enable staging read for images
Related-To: NEO-12968 Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
363f2becd4
commit
6aeb8dffa0
@@ -2892,19 +2892,22 @@ cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue commandQueue,
|
|||||||
TRACING_EXIT(ClEnqueueReadImage, &retVal);
|
TRACING_EXIT(ClEnqueueReadImage, &retVal);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
if (pCommandQueue->isValidForStagingTransferImage(pImage, ptr, numEventsInWaitList > 0)) {
|
||||||
retVal = pCommandQueue->enqueueReadImage(
|
retVal = pCommandQueue->enqueueStagingReadImage(pImage, blockingRead, origin, region, rowPitch, slicePitch, ptr, event);
|
||||||
pImage,
|
} else {
|
||||||
blockingRead,
|
retVal = pCommandQueue->enqueueReadImage(
|
||||||
origin,
|
pImage,
|
||||||
region,
|
blockingRead,
|
||||||
rowPitch,
|
origin,
|
||||||
slicePitch,
|
region,
|
||||||
ptr,
|
rowPitch,
|
||||||
nullptr,
|
slicePitch,
|
||||||
numEventsInWaitList,
|
ptr,
|
||||||
eventWaitList,
|
nullptr,
|
||||||
event);
|
numEventsInWaitList,
|
||||||
|
eventWaitList,
|
||||||
|
event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DBG_LOG_INPUTS("event", getClFileLogger().getEvents(reinterpret_cast<const uintptr_t *>(event), 1u));
|
DBG_LOG_INPUTS("event", getClFileLogger().getEvents(reinterpret_cast<const uintptr_t *>(event), 1u));
|
||||||
TRACING_EXIT(ClEnqueueReadImage, &retVal);
|
TRACING_EXIT(ClEnqueueReadImage, &retVal);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018-2023 Intel Corporation
|
* Copyright (C) 2018-2024 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -205,4 +205,33 @@ TEST_F(ClEnqueueReadImageYuv, GivenInvalidRegionWhenReadingYuvImageThenInvalidVa
|
|||||||
retVal = clReleaseMemObject(image);
|
retVal = clReleaseMemObject(image);
|
||||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(ClEnqueueReadImageTests, givenStagingEnabledWhenEnqueueReadImageCalledThenReadSuccesfullAndStagingBufferAllocated) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
debugManager.flags.EnableCopyWithStagingBuffers.set(1);
|
||||||
|
imageFormat.image_channel_order = CL_RGBA;
|
||||||
|
auto image = Image::validateAndCreateImage(pContext, nullptr, CL_MEM_READ_WRITE, 0, &imageFormat, &imageDesc, nullptr, retVal);
|
||||||
|
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||||
|
EXPECT_NE(nullptr, image);
|
||||||
|
const size_t origin[] = {2, 2, 0};
|
||||||
|
const size_t region[] = {2, 2, 1};
|
||||||
|
char nonUsmPtr[1024];
|
||||||
|
auto retVal = clEnqueueReadImage(
|
||||||
|
pCommandQueue,
|
||||||
|
image,
|
||||||
|
false,
|
||||||
|
origin,
|
||||||
|
region,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
nonUsmPtr,
|
||||||
|
0,
|
||||||
|
nullptr,
|
||||||
|
nullptr);
|
||||||
|
auto unifiedMemoryManager = pContext->getSVMAllocsManager();
|
||||||
|
EXPECT_EQ(1u, unifiedMemoryManager->getNumAllocs());
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
retVal = clReleaseMemObject(image);
|
||||||
|
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||||
|
}
|
||||||
} // namespace ULT
|
} // namespace ULT
|
||||||
|
|||||||
Reference in New Issue
Block a user