Fix blit enqueue support check
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
bdf8cf5e23
commit
ee44979bb5
|
@ -737,7 +737,7 @@ bool CommandQueue::queueDependenciesClearRequired() const {
|
|||
}
|
||||
|
||||
bool CommandQueue::blitEnqueueAllowed(cl_command_type cmdType) const {
|
||||
auto blitterSupported = device->getHardwareInfo().capabilityTable.blitterOperationsSupported || this->isCopyOnly;
|
||||
auto blitterSupported = (getBcsCommandStreamReceiver() != nullptr);
|
||||
|
||||
bool blitEnqueueAllowed = getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled() || this->isCopyOnly;
|
||||
if (DebugManager.flags.EnableBlitterForEnqueueOperations.get() != -1) {
|
||||
|
|
|
@ -1154,10 +1154,14 @@ TEST(CommandQueue, givenCopyOnlyQueueWhenCallingBlitEnqueueAllowedThenReturnTrue
|
|||
MockContext context{};
|
||||
HardwareInfo *hwInfo = context.getDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
MockCommandQueue queue(&context, context.getDevice(0), 0);
|
||||
if (!queue.bcsEngine) {
|
||||
queue.bcsEngine = &context.getDevice(0)->getDefaultEngine();
|
||||
}
|
||||
hwInfo->capabilityTable.blitterOperationsSupported = false;
|
||||
|
||||
queue.isCopyOnly = false;
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER));
|
||||
EXPECT_EQ(queue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled(),
|
||||
queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER));
|
||||
|
||||
queue.isCopyOnly = true;
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER));
|
||||
|
@ -1165,33 +1169,24 @@ TEST(CommandQueue, givenCopyOnlyQueueWhenCallingBlitEnqueueAllowedThenReturnTrue
|
|||
|
||||
TEST(CommandQueue, givenClCommandWhenCallingBlitEnqueueAllowedThenReturnCorrectValue) {
|
||||
MockContext context{};
|
||||
HardwareInfo *hwInfo = context.getDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
MockCommandQueue queue(&context, context.getDevice(0), 0);
|
||||
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||
|
||||
if (queue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled()) {
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_WRITE_BUFFER));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_COPY_BUFFER));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER_RECT));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_WRITE_BUFFER_RECT));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_COPY_BUFFER_RECT));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_SVM_MEMCPY));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_READ_IMAGE));
|
||||
EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_WRITE_IMAGE));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_COPY_IMAGE));
|
||||
} else {
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_WRITE_BUFFER));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_COPY_BUFFER));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER_RECT));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_WRITE_BUFFER_RECT));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_COPY_BUFFER_RECT));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_SVM_MEMCPY));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_READ_IMAGE));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_WRITE_IMAGE));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_COPY_IMAGE));
|
||||
MockCommandQueue queue(&context, context.getDevice(0), 0);
|
||||
if (!queue.bcsEngine) {
|
||||
queue.bcsEngine = &context.getDevice(0)->getDefaultEngine();
|
||||
}
|
||||
|
||||
bool supported = queue.getGpgpuCommandStreamReceiver().peekTimestampPacketWriteEnabled();
|
||||
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_WRITE_BUFFER));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_COPY_BUFFER));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER_RECT));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_WRITE_BUFFER_RECT));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_COPY_BUFFER_RECT));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_SVM_MEMCPY));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_READ_IMAGE));
|
||||
EXPECT_EQ(supported, queue.blitEnqueueAllowed(CL_COMMAND_WRITE_IMAGE));
|
||||
EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_COPY_IMAGE));
|
||||
}
|
||||
|
||||
TEST(CommandQueue, givenRegularClCommandWhenCallingBlitEnqueuePreferredThenReturnCorrectValue) {
|
||||
|
|
|
@ -157,20 +157,21 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBufferWithNotDefaultRootDeviceIndexAndBc
|
|||
|
||||
HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenEnqueueBufferOperationIsCalledThenUseBcsCsr) {
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(0);
|
||||
auto mockCmdQueue = static_cast<MockCommandQueueHw<FamilyType> *>(commandQueue.get());
|
||||
auto bcsEngine = mockCmdQueue->bcsEngine;
|
||||
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(commandQueue->getBcsCommandStreamReceiver());
|
||||
|
||||
auto bufferForBlt0 = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
auto bufferForBlt1 = clUniquePtr(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
bufferForBlt0->forceDisallowCPUCopy = true;
|
||||
bufferForBlt1->forceDisallowCPUCopy = true;
|
||||
auto *hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
|
||||
size_t bufferOrigin[] = {0, 0, 0};
|
||||
size_t hostOrigin[] = {0, 0, 0};
|
||||
size_t region[] = {1, 2, 1};
|
||||
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(0);
|
||||
hwInfo->capabilityTable.blitterOperationsSupported = false;
|
||||
mockCmdQueue->bcsEngine = nullptr;
|
||||
commandQueue->enqueueWriteBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueReadBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueCopyBuffer(bufferForBlt0.get(), bufferForBlt1.get(), 0, 1, 1, 0, nullptr, nullptr);
|
||||
|
@ -185,7 +186,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenEnqueueBufferOperationIs
|
|||
MemoryConstants::cacheLineSize, 0, nullptr, nullptr);
|
||||
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
hwInfo->capabilityTable.blitterOperationsSupported = false;
|
||||
mockCmdQueue->bcsEngine = nullptr;
|
||||
commandQueue->enqueueWriteBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueReadBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueCopyBuffer(bufferForBlt0.get(), bufferForBlt1.get(), 0, 1, 1, 0, nullptr, nullptr);
|
||||
|
@ -200,7 +201,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenEnqueueBufferOperationIs
|
|||
MemoryConstants::cacheLineSize, 0, nullptr, nullptr);
|
||||
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(0);
|
||||
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||
mockCmdQueue->bcsEngine = bcsEngine;
|
||||
commandQueue->enqueueWriteBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueReadBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueCopyBuffer(bufferForBlt0.get(), bufferForBlt1.get(), 0, 1, 1, 0, nullptr, nullptr);
|
||||
|
@ -216,7 +217,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenEnqueueBufferOperationIs
|
|||
commandQueue->enqueueSVMMemcpy(CL_TRUE, bufferForBlt0.get(), bufferForBlt1.get(), 1, 0, nullptr, nullptr);
|
||||
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(-1);
|
||||
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||
mockCmdQueue->bcsEngine = bcsEngine;
|
||||
commandQueue->enqueueWriteBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueReadBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
commandQueue->enqueueCopyBuffer(bufferForBlt0.get(), bufferForBlt1.get(), 0, 1, 1, 0, nullptr, nullptr);
|
||||
|
@ -234,7 +235,7 @@ HWTEST_TEMPLATED_F(BcsBufferTests, givenBcsSupportedWhenEnqueueBufferOperationIs
|
|||
EXPECT_EQ(7u, bcsCsr->blitBufferCalled);
|
||||
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
hwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||
mockCmdQueue->bcsEngine = bcsEngine;
|
||||
commandQueue->enqueueWriteBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(8u, bcsCsr->blitBufferCalled);
|
||||
commandQueue->enqueueReadBuffer(bufferForBlt0.get(), CL_TRUE, 0, 1, &hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
|
|
Loading…
Reference in New Issue