From fb1a008414e46f28de81f01308a91112d3520141 Mon Sep 17 00:00:00 2001 From: Dominik Dabek Date: Mon, 31 Jan 2022 11:06:18 +0000 Subject: [PATCH] Change fences to use tag allocation Instead of creating new allocation per fence, use the task count. Fence synchronize will wait for task count update. Related-To: NEO-6634 Signed-off-by: Dominik Dabek --- .../core/source/cmdqueue/cmdqueue_hw.inl | 15 ++-- level_zero/core/source/fence/fence.cpp | 49 +++------- level_zero/core/source/fence/fence.h | 27 ++---- .../core/test/unit_tests/mocks/mock_fence.h | 14 +-- .../test_cmdqueue_enqueue_cmdlist.cpp | 43 ++++++++- .../unit_tests/sources/fence/test_fence.cpp | 90 ++++--------------- 6 files changed, 84 insertions(+), 154 deletions(-) diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 252c451b86..fbdfcebf38 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -115,7 +115,6 @@ ze_result_t CommandQueueHw::executeCommandLists( size_t preemptionSize = 0u; size_t debuggerCmdsSize = 0; constexpr size_t residencyContainerSpaceForPreemption = 2; - constexpr size_t residencyContainerSpaceForFence = 1; constexpr size_t residencyContainerSpaceForTagWrite = 1; NEO::Device *neoDevice = device->getNEODevice(); @@ -201,7 +200,6 @@ ze_result_t CommandQueueHw::executeCommandLists( size_t linearStreamSizeEstimate = totalCmdBuffers * sizeof(MI_BATCH_BUFFER_START); linearStreamSizeEstimate += csr->getCmdsSizeForHardwareContext(); - if (directSubmissionEnabled) { linearStreamSizeEstimate += sizeof(MI_BATCH_BUFFER_START); } else { @@ -212,14 +210,10 @@ ze_result_t CommandQueueHw::executeCommandLists( if (programActivePartitionConfig) { linearStreamSizeEstimate += csrHw->getCmdSizeForActivePartitionConfig(); } - const auto &hwInfo = this->device->getHwInfo(); if (hFence) { - fence = Fence::fromHandle(hFence); - spaceForResidency += residencyContainerSpaceForFence; linearStreamSizeEstimate += isCopyOnlyCommandQueue ? NEO::EncodeMiFlushDW::getMiFlushDwCmdSizeForDataWrite() : NEO::MemorySynchronizationCommands::getSizeForPipeControlWithPostSyncOperation(hwInfo); } - spaceForResidency += residencyContainerSpaceForTagWrite; csr->getResidencyAllocations().reserve(spaceForResidency); @@ -420,11 +414,12 @@ ze_result_t CommandQueueHw::executeCommandLists( commandQueuePreemptionMode = statePreemption; if (hFence) { - csr->makeResident(fence->getAllocation()); + fence = Fence::fromHandle(hFence); + fence->assignTaskCountFromCsr(); if (isCopyOnlyCommandQueue) { NEO::MiFlushArgs args; args.commandWithPostSync = true; - NEO::EncodeMiFlushDW::programMiFlushDw(child, fence->getGpuAddress(), Fence::STATE_SIGNALED, args, hwInfo); + NEO::EncodeMiFlushDW::programMiFlushDw(child, csr->getTagAllocation()->getGpuAddress(), csr->peekTaskCount() + 1, args, hwInfo); } else { NEO::PipeControlArgs args; args.dcFlushEnable = NEO::MemorySynchronizationCommands::getDcFlushEnable(true, hwInfo); @@ -434,8 +429,8 @@ ze_result_t CommandQueueHw::executeCommandLists( fence->setPartitionCount(partitionCount); NEO::MemorySynchronizationCommands::addPipeControlAndProgramPostSyncOperation( child, POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, - fence->getGpuAddress(), - Fence::STATE_SIGNALED, + csr->getTagAllocation()->getGpuAddress(), + csr->peekTaskCount() + 1, hwInfo, args); } diff --git a/level_zero/core/source/fence/fence.cpp b/level_zero/core/source/fence/fence.cpp index 16672677bf..a026bc2909 100644 --- a/level_zero/core/source/fence/fence.cpp +++ b/level_zero/core/source/fence/fence.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,52 +18,27 @@ namespace L0 { Fence *Fence::create(CommandQueueImp *cmdQueue, const ze_fence_desc_t *desc) { auto fence = new FenceImp(cmdQueue); UNRECOVERABLE_IF(fence == nullptr); - - fence->initialize(); - + fence->reset(); return fence; } -FenceImp::~FenceImp() { - cmdQueue->getDevice()->getDriverHandle()->getMemoryManager()->freeGraphicsMemory(allocation); - allocation = nullptr; -} - ze_result_t FenceImp::queryStatus() { auto csr = cmdQueue->getCsr(); csr->downloadAllocations(); - volatile uint32_t *hostAddr = static_cast(allocation->getUnderlyingBuffer()); - uint32_t queryVal = Fence::STATE_CLEARED; - for (uint32_t i = 0; i < partitionCount; i++) { - queryVal = *hostAddr; - if (queryVal == Fence::STATE_CLEARED) { - break; - } - hostAddr = ptrOffset(hostAddr, csr->getPostSyncWriteOffset()); - } - return queryVal == Fence::STATE_CLEARED ? ZE_RESULT_NOT_READY : ZE_RESULT_SUCCESS; + auto *hostAddr = csr->getTagAddress(); + + return csr->testTaskCountReady(hostAddr, taskCount) ? ZE_RESULT_SUCCESS : ZE_RESULT_NOT_READY; } -void FenceImp::initialize() { - NEO::AllocationProperties properties( - cmdQueue->getDevice()->getRootDeviceIndex(), MemoryConstants::pageSize, NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, cmdQueue->getDevice()->getNEODevice()->getDeviceBitfield()); - properties.alignment = MemoryConstants::pageSize; - allocation = cmdQueue->getDevice()->getDriverHandle()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties); - UNRECOVERABLE_IF(allocation == nullptr); - - reset(); +ze_result_t FenceImp::assignTaskCountFromCsr() { + auto csr = cmdQueue->getCsr(); + taskCount = csr->peekTaskCount() + 1; + return ZE_RESULT_SUCCESS; } ze_result_t FenceImp::reset() { - constexpr uint32_t maxPartitionCount = 16; - volatile uint32_t *hostAddress = static_cast(allocation->getUnderlyingBuffer()); - for (uint32_t i = 0; i < maxPartitionCount; i++) { - *hostAddress = Fence::STATE_CLEARED; - NEO::CpuIntrinsics::clFlush(const_cast(hostAddress)); - hostAddress = ptrOffset(hostAddress, cmdQueue->getCsr()->getPostSyncWriteOffset()); - } - partitionCount = 1; + taskCount = std::numeric_limits::max(); return ZE_RESULT_SUCCESS; } @@ -76,6 +51,10 @@ ze_result_t FenceImp::hostSynchronize(uint64_t timeout) { return ZE_RESULT_SUCCESS; } + if (std::numeric_limits::max() == taskCount) { + return ZE_RESULT_NOT_READY; + } + if (timeout == 0) { return queryStatus(); } diff --git a/level_zero/core/source/fence/fence.h b/level_zero/core/source/fence/fence.h index 7a5a06250d..581911ece1 100644 --- a/level_zero/core/source/fence/fence.h +++ b/level_zero/core/source/fence/fence.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -25,42 +25,25 @@ struct Fence : _ze_fence_handle_t { virtual ze_result_t destroy() = 0; virtual ze_result_t hostSynchronize(uint64_t timeout) = 0; virtual ze_result_t queryStatus() = 0; + virtual ze_result_t assignTaskCountFromCsr() = 0; virtual ze_result_t reset() = 0; static Fence *fromHandle(ze_fence_handle_t handle) { return static_cast(handle); } inline ze_fence_handle_t toHandle() { return this; } - enum State : uint32_t { - STATE_SIGNALED = 0u, - STATE_CLEARED = std::numeric_limits::max(), - STATE_INITIAL = STATE_CLEARED - }; - - enum EnqueueState : uint32_t { ENQUEUE_NOT_READY = 0u, - ENQUEUE_READY }; - - NEO::GraphicsAllocation &getAllocation() const { return *allocation; } - - uint64_t getGpuAddress() { - UNRECOVERABLE_IF(allocation == nullptr); - return allocation->getGpuAddress(); - } - void setPartitionCount(uint32_t newPartitionCount) { partitionCount = newPartitionCount; } protected: - NEO::GraphicsAllocation *allocation = nullptr; uint32_t partitionCount = 1; + uint32_t taskCount = 0; }; struct FenceImp : public Fence { FenceImp(CommandQueueImp *cmdQueueImp) : cmdQueue(cmdQueueImp) {} - ~FenceImp() override; - ze_result_t destroy() override { delete this; return ZE_RESULT_SUCCESS; @@ -70,9 +53,9 @@ struct FenceImp : public Fence { ze_result_t queryStatus() override; - ze_result_t reset() override; + ze_result_t assignTaskCountFromCsr() override; - void initialize(); + ze_result_t reset() override; protected: CommandQueueImp *cmdQueue; diff --git a/level_zero/core/test/unit_tests/mocks/mock_fence.h b/level_zero/core/test/unit_tests/mocks/mock_fence.h index d5764b173e..8419b44570 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_fence.h +++ b/level_zero/core/test/unit_tests/mocks/mock_fence.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -19,29 +19,21 @@ namespace ult { template <> struct WhiteBox<::L0::Fence> : public ::L0::Fence { - using ::L0::Fence::allocation; using ::L0::Fence::partitionCount; + using ::L0::Fence::taskCount; }; using Fence = WhiteBox<::L0::Fence>; template <> struct Mock : public Fence { - Mock() : mockAllocation(0, NEO::GraphicsAllocation::AllocationType::BUFFER_HOST_MEMORY, - &memory, reinterpret_cast(&memory), 0, sizeof(memory), - MemoryPool::System4KBPages) { - allocation = &mockAllocation; - } ~Mock() override = default; ADDMETHOD_NOBASE(destroy, ze_result_t, ZE_RESULT_SUCCESS, ()); ADDMETHOD_NOBASE(hostSynchronize, ze_result_t, ZE_RESULT_SUCCESS, (uint64_t timeout)); ADDMETHOD_NOBASE(queryStatus, ze_result_t, ZE_RESULT_SUCCESS, ()); + ADDMETHOD_NOBASE(assignTaskCountFromCsr, ze_result_t, ZE_RESULT_SUCCESS, ()); ADDMETHOD_NOBASE(reset, ze_result_t, ZE_RESULT_SUCCESS, ()); - - // Fake an allocation for event memory - alignas(16) uint32_t memory = -1; - NEO::GraphicsAllocation mockAllocation; }; } // namespace ult diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp index 5025cb34bb..e2e89460c7 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp @@ -11,6 +11,8 @@ #include "shared/source/utilities/software_tags_manager.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/unit_test_helper.h" +#include "shared/test/common/libult/ult_command_stream_receiver.h" +#include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/mocks/ult_device_factory.h" #include "shared/test/common/test_macros/test.h" @@ -170,7 +172,41 @@ HWTEST_F(CommandQueueExecuteCommandLists, whenASecondLevelBatchBufferPerCommandL commandQueue->destroy(); } -HWTEST2_F(CommandQueueExecuteCommandLists, whenUsingFenceThenExpectEndingPipeControlUpdatingFenceAllocation, IsGen9) { +HWTEST_F(CommandQueueExecuteCommandLists, givenFenceWhenExecutingCmdListThenFenceStatusIsCorrect) { + const ze_command_queue_desc_t desc{}; + ze_result_t returnValue; + auto commandQueue = whitebox_cast(CommandQueue::create(productFamily, + device, + neoDevice->getDefaultEngine().commandStreamReceiver, + &desc, + false, + false, + returnValue)); + ASSERT_NE(nullptr, commandQueue->commandStream); + auto &csr = neoDevice->getUltCommandStreamReceiver(); + *csr.tagAddress = 10; + csr.taskCount = 10; + + ze_fence_desc_t fenceDesc{}; + auto fence = whitebox_cast(Fence::create(commandQueue, &fenceDesc)); + ASSERT_NE(nullptr, fence); + EXPECT_EQ(ZE_RESULT_NOT_READY, fence->queryStatus()); + + auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, fence, true); + *csr.tagAddress = 11; + ASSERT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(*csr.tagAddress, fence->taskCount); + EXPECT_EQ(ZE_RESULT_SUCCESS, fence->queryStatus()); + + //reset fence + fence->assignTaskCountFromCsr(); + EXPECT_EQ(ZE_RESULT_NOT_READY, fence->queryStatus()); + + fence->destroy(); + commandQueue->destroy(); +} + +HWTEST2_F(CommandQueueExecuteCommandLists, whenUsingFenceThenExpectEndingPipeControlUpdatingTagAllocation, IsGen9) { using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL; using POST_SYNC_OPERATION = typename FamilyType::PIPE_CONTROL::POST_SYNC_OPERATION; using PARSE = typename FamilyType::PARSE; @@ -213,12 +249,11 @@ HWTEST2_F(CommandQueueExecuteCommandLists, whenUsingFenceThenExpectEndingPipeCon ASSERT_LE(1u, pipeControls.size()); PIPE_CONTROL *fenceUpdate = genCmdCast(*pipeControls[pipeControls.size() - 3]); - EXPECT_EQ(fence->getGpuAddress(), NEO::UnitTestHelper::getPipeControlPostSyncAddress(*fenceUpdate)); + EXPECT_EQ(commandQueue->getCsr()->getTagAllocation()->getGpuAddress(), NEO::UnitTestHelper::getPipeControlPostSyncAddress(*fenceUpdate)); EXPECT_EQ(POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, fenceUpdate->getPostSyncOperation()); - uint64_t fenceImmData = Fence::STATE_SIGNALED; - EXPECT_EQ(fenceImmData, fenceUpdate->getImmediateData()); + EXPECT_EQ(fence->taskCount, fenceUpdate->getImmediateData()); fence->destroy(); commandQueue->destroy(); diff --git a/level_zero/core/test/unit_tests/sources/fence/test_fence.cpp b/level_zero/core/test/unit_tests/sources/fence/test_fence.cpp index 88ae3e3a7e..052c51e19c 100644 --- a/level_zero/core/test/unit_tests/sources/fence/test_fence.cpp +++ b/level_zero/core/test/unit_tests/sources/fence/test_fence.cpp @@ -21,16 +21,12 @@ namespace ult { using FenceTest = Test; TEST_F(FenceTest, whenQueryingStatusThenCsrAllocationsAreDownloaded) { auto csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); - + *csr->tagAddress = 0; Mock cmdQueue(device, csr.get()); auto fence = Fence::create(&cmdQueue, nullptr); EXPECT_NE(nullptr, fence); - auto &graphicsAllocation = fence->getAllocation(); - - EXPECT_EQ(neoDevice->getRootDeviceIndex(), graphicsAllocation.getRootDeviceIndex()); - EXPECT_FALSE(csr->downloadAllocationsCalled); auto status = fence->queryStatus(); @@ -43,6 +39,7 @@ TEST_F(FenceTest, whenQueryingStatusThenCsrAllocationsAreDownloaded) { TEST_F(FenceTest, whenQueryingStatusWithoutCsrAndFenceUnsignaledThenReturnsNotReady) { auto csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); + *csr->tagAddress = 0; Mock cmdQueue(device, csr.get()); auto fence = Fence::create(&cmdQueue, nullptr); @@ -52,23 +49,9 @@ TEST_F(FenceTest, whenQueryingStatusWithoutCsrAndFenceUnsignaledThenReturnsNotRe fence->destroy(); } -TEST_F(FenceTest, whenQueryingStatusAndStateSignaledThenReturnSuccess) { - auto csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); - Mock cmdQueue(device, csr.get()); - auto fence = Fence::create(&cmdQueue, nullptr); - EXPECT_NE(nullptr, fence); - - auto &graphicsAllocation = fence->getAllocation(); - auto hostAddr = static_cast(graphicsAllocation.getUnderlyingBuffer()); - *hostAddr = Fence::STATE_SIGNALED; - auto status = fence->queryStatus(); - EXPECT_EQ(ZE_RESULT_SUCCESS, status); - fence->destroy(); -} - using FenceSynchronizeTest = Test; -TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithTimeoutZeroAndStateInitialHostSynchronizeReturnsNotReady) { +TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithTimeoutZeroAndStateInitialThenHostSynchronizeReturnsNotReady) { std::unique_ptr csr = nullptr; csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); @@ -76,12 +59,12 @@ TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithTimeoutZeroAndSt std::unique_ptr fence; fence = std::unique_ptr(L0::Fence::create(&cmdQueue, nullptr)); EXPECT_NE(nullptr, fence); - + *csr->tagAddress = 0; ze_result_t result = fence->hostSynchronize(0); EXPECT_EQ(ZE_RESULT_NOT_READY, result); } -TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithNonZeroTimeoutAndStateInitialHostSynchronizeReturnsNotReady) { +TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithNonZeroTimeoutAndStateInitialThenHostSynchronizeReturnsNotReady) { std::unique_ptr csr = nullptr; csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); @@ -89,75 +72,39 @@ TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithNonZeroTimeoutAn std::unique_ptr fence; fence = std::unique_ptr(L0::Fence::create(&cmdQueue, nullptr)); EXPECT_NE(nullptr, fence); + *csr->tagAddress = 0; ze_result_t result = fence->hostSynchronize(10); EXPECT_EQ(ZE_RESULT_NOT_READY, result); } -TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithTimeoutZeroAndStateSignaledHostSynchronizeReturnsSuccess) { +TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithTimeoutZeroAndTaskCountEqualsTagAllocationThenHostSynchronizeReturnsSuccess) { std::unique_ptr csr = nullptr; csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); Mock cmdQueue(device, csr.get()); - std::unique_ptr fence; - fence = std::unique_ptr(L0::Fence::create(&cmdQueue, nullptr)); + auto fence = std::unique_ptr(whitebox_cast(Fence::create(&cmdQueue, nullptr))); EXPECT_NE(nullptr, fence); - auto alloc = &(fence->getAllocation()); - auto hostAddr = static_cast(alloc->getUnderlyingBuffer()); - *hostAddr = Fence::STATE_SIGNALED; + + fence->taskCount = 1; + *csr->tagAddress = 1; ze_result_t result = fence->hostSynchronize(0); EXPECT_EQ(ZE_RESULT_SUCCESS, result); } -TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithTimeoutNonZeroAndStateSignaledHostSynchronizeReturnsSuccess) { +TEST_F(FenceSynchronizeTest, givenCallToFenceHostSynchronizeWithTimeoutNonZeroAndTaskCountEqualsTagAllocationThenHostSynchronizeReturnsSuccess) { std::unique_ptr csr = nullptr; csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); Mock cmdQueue(device, csr.get()); - std::unique_ptr fence; - fence = std::unique_ptr(L0::Fence::create(&cmdQueue, nullptr)); + auto fence = std::unique_ptr(whitebox_cast(Fence::create(&cmdQueue, nullptr))); EXPECT_NE(nullptr, fence); - auto alloc = &(fence->getAllocation()); - auto hostAddr = static_cast(alloc->getUnderlyingBuffer()); - *hostAddr = Fence::STATE_SIGNALED; + + fence->taskCount = 1; + *csr->tagAddress = 1; ze_result_t result = fence->hostSynchronize(10); EXPECT_EQ(ZE_RESULT_SUCCESS, result); } -TEST_F(FenceSynchronizeTest, givenMultiplePartitionsWhenFenceIsResetThenAllPartitionFenceStatesAreReset) { - std::unique_ptr csr = nullptr; - csr = std::make_unique(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); - csr->postSyncWriteOffset = 16; - Mock cmdQueue(device, csr.get()); - - auto fence = whitebox_cast(Fence::create(&cmdQueue, nullptr)); - EXPECT_NE(nullptr, fence); - auto alloc = &(fence->getAllocation()); - auto hostAddr = static_cast(alloc->getUnderlyingBuffer()); - - for (uint32_t i = 0; i < 16; i++) { - EXPECT_EQ(Fence::STATE_CLEARED, *hostAddr); - hostAddr = ptrOffset(hostAddr, 16); - } - - hostAddr = static_cast(alloc->getUnderlyingBuffer()); - fence->partitionCount = 2; - *hostAddr = Fence::STATE_SIGNALED; - hostAddr = ptrOffset(hostAddr, 16); - *hostAddr = Fence::STATE_SIGNALED; - - ze_result_t result = fence->reset(); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); - - hostAddr = static_cast(alloc->getUnderlyingBuffer()); - for (uint32_t i = 0; i < 16; i++) { - EXPECT_EQ(Fence::STATE_CLEARED, *hostAddr); - hostAddr = ptrOffset(hostAddr, 16); - } - EXPECT_EQ(1u, fence->partitionCount); - - fence->destroy(); -} - using FenceAubCsrTest = Test; HWTEST_F(FenceAubCsrTest, givenCallToFenceHostSynchronizeWithAubModeCsrReturnsSuccess) { @@ -173,16 +120,15 @@ HWTEST_F(FenceAubCsrTest, givenCallToFenceHostSynchronizeWithAubModeCsrReturnsSu driverHandle = std::make_unique>(); driverHandle->initialize(std::move(devices)); device = driverHandle->devices[0]; - int32_t tag; + int32_t tag = 1; auto aubCsr = new MockCsrAub(tag, *neoDevice->executionEnvironment, neoDevice->getRootDeviceIndex(), neoDevice->getDeviceBitfield()); neoDevice->resetCommandStreamReceiver(aubCsr); Mock cmdQueue(device, aubCsr); - auto fence = Fence::create(&cmdQueue, nullptr); + auto fence = std::unique_ptr(Fence::create(&cmdQueue, nullptr)); ze_result_t result = fence->hostSynchronize(10); EXPECT_EQ(ZE_RESULT_SUCCESS, result); - fence->destroy(); } } // namespace ult