Flush command queue in release call

Related-To: NEO-5258
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2020-11-03 16:27:43 +01:00
committed by Compute-Runtime-Automation
parent 1f462eb9c2
commit 264d103774
3 changed files with 28 additions and 0 deletions

View File

@ -50,6 +50,18 @@ void releaseQueue(cl_command_queue commandQueue, cl_int &retVal) {
}
}
template <>
inline void releaseQueue<CommandQueue>(cl_command_queue commandQueue, cl_int &retVal) {
using BaseType = typename CommandQueue::BaseType;
auto queue = castToObject<CommandQueue>(static_cast<BaseType *>(commandQueue));
if (queue) {
queue->flush();
releaseVirtualEvent(*queue);
queue->release();
retVal = CL_SUCCESS;
}
}
template <typename QueueType>
cl_int getQueueInfo(QueueType *queue,
cl_command_queue_info paramName,

View File

@ -413,6 +413,16 @@ HWTEST_F(CommandQueueHwTest, GivenNotCompleteUserEventPassedToEnqueueWhenEventIs
mockCSR->getMemoryManager()->freeGraphicsMemory(constantSurface);
}
HWTEST_F(CommandQueueHwTest, whenReleaseQueueCalledThenFlushIsCalled) {
cl_int retVal = 0;
auto mockCmdQ = new MockCommandQueueHw<FamilyType>(context, pClDevice, 0);
mockCmdQ->incRefInternal();
releaseQueue<CommandQueue>(mockCmdQ, retVal);
EXPECT_TRUE(mockCmdQ->flushCalled);
//this call will release the queue
mockCmdQ->decRefInternal();
}
typedef CommandQueueHwTest BlockedCommandQueueTest;
HWTEST_F(BlockedCommandQueueTest, givenCommandQueueWhenBlockedCommandIsBeingSubmittedThenQueueHeapsAreNotUsed) {

View File

@ -209,6 +209,11 @@ class MockCommandQueueHw : public CommandQueueHw<GfxFamily> {
cl_queue_properties *properties) : BaseClass(context, device, properties, false) {
}
cl_int flush() override {
flushCalled = true;
return BaseClass::flush();
}
void setOoqEnabled() {
commandQueueProperties |= CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
}
@ -323,6 +328,7 @@ class MockCommandQueueHw : public CommandQueueHw<GfxFamily> {
} overrideIsCacheFlushForBcsRequired;
BuiltinOpParams kernelParams;
std::atomic<uint32_t> latestTaskCountWaited{std::numeric_limits<uint32_t>::max()};
bool flushCalled = false;
LinearStream *peekCommandStream() {
return this->commandStream;