mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 15:03:02 +08:00
Flush print buffer when destroying the command queue
This ensures all pending prints are flushed, in the case for instance zeCommandQueueSynchronize() is not called. Change-Id: I4b50c535e4681eff4708242febc948c21c715055 Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
87dccc2c07
commit
04bb54d1ac
@@ -42,6 +42,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::createFence(const ze_fence_desc_t *de
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandQueueHw<gfxCoreFamily>::destroy() {
|
||||
this->printFunctionsPrintfOutput();
|
||||
delete commandStream;
|
||||
buffers.destroy(this->getDevice()->getNEODevice()->getMemoryManager());
|
||||
delete this;
|
||||
|
||||
@@ -58,6 +58,7 @@ template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
struct MockCommandQueueHw : public L0::CommandQueueHw<gfxCoreFamily> {
|
||||
using BaseClass = ::L0::CommandQueueHw<gfxCoreFamily>;
|
||||
using BaseClass::commandStream;
|
||||
using BaseClass::printfFunctionContainer;
|
||||
|
||||
MockCommandQueueHw(L0::Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc) : L0::CommandQueueHw<gfxCoreFamily>(device, csr, desc) {
|
||||
}
|
||||
|
||||
@@ -86,8 +86,13 @@ struct Mock<::L0::Kernel> : public ::L0::KernelImp {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void printPrintfOutput() override {
|
||||
printPrintfOutputCalledTimes++;
|
||||
}
|
||||
|
||||
WhiteBox<::L0::KernelImmutableData> immutableData;
|
||||
NEO::KernelDescriptor descriptor;
|
||||
uint32_t printPrintfOutputCalledTimes = 0;
|
||||
};
|
||||
|
||||
} // namespace ult
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "level_zero/core/source/driver/driver_handle_imp.h"
|
||||
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h"
|
||||
#include "level_zero/core/test/unit_tests/mocks/mock_memory_manager.h"
|
||||
|
||||
namespace L0 {
|
||||
@@ -156,5 +157,23 @@ TEST_F(CommandQueueCreate, givenCmdQueueWithBlitCopyWhenExecutingCopyBlitCommand
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
using CommandQueueDestroySupport = IsAtLeastProduct<IGFX_SKYLAKE>;
|
||||
using CommandQueueDestroy = Test<DeviceFixture>;
|
||||
|
||||
HWTEST2_F(CommandQueueDestroy, whenCommandQueueDestroyIsCalledPrintPrintfOutputIsCalled, CommandQueueDestroySupport) {
|
||||
ze_command_queue_desc_t desc = {};
|
||||
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
|
||||
auto csr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
|
||||
auto commandQueue = new MockCommandQueueHw<gfxCoreFamily>(device, csr.get(), &desc);
|
||||
commandQueue->initialize(false);
|
||||
|
||||
Mock<Kernel> kernel;
|
||||
commandQueue->printfFunctionContainer.push_back(&kernel);
|
||||
|
||||
EXPECT_EQ(0u, kernel.printPrintfOutputCalledTimes);
|
||||
commandQueue->destroy();
|
||||
EXPECT_EQ(1u, kernel.printPrintfOutputCalledTimes);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user