mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 09:58:55 +08:00
[fix] unify heaps size programing
- share same code between csr and cmd container to get default heap size - share handling of debug flag to change heap size - share platform level surface heap size between csr and command list - refactor heap size files - put heap size constant and function into namespace - command list surface heap size increased to 2MB for xehp+ to match csr - command list increased surface heap size only for sba tracking - sba tracking heap consumption increased due to different reset policy Related-To: NEO-5055 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
ae566a42d8
commit
bc4e540c33
@@ -65,11 +65,14 @@ CommandContainer::CommandContainer(uint32_t maxNumAggregatedIdds) : CommandConta
|
||||
numIddsPerBlock = maxNumAggregatedIdds;
|
||||
}
|
||||
|
||||
CommandContainer::ErrorCode CommandContainer::initialize(Device *device, AllocationsList *reusableAllocationList, bool requireHeaps, bool createSecondaryCmdBufferInHostMem) {
|
||||
CommandContainer::ErrorCode CommandContainer::initialize(Device *device, AllocationsList *reusableAllocationList, size_t defaultSshSize, bool requireHeaps, bool createSecondaryCmdBufferInHostMem) {
|
||||
this->device = device;
|
||||
this->reusableAllocationList = reusableAllocationList;
|
||||
size_t alignedSize = getAlignedCmdBufferSize();
|
||||
size_t usableSize = getMaxUsableSpace();
|
||||
this->defaultSshSize = HeapSize::defaultHeapSize;
|
||||
if (this->stateBaseAddressTracking) {
|
||||
this->defaultSshSize = defaultSshSize;
|
||||
}
|
||||
|
||||
auto cmdBufferAllocation = this->obtainNextCommandBufferAllocation();
|
||||
|
||||
@@ -101,10 +104,6 @@ CommandContainer::ErrorCode CommandContainer::initialize(Device *device, Allocat
|
||||
|
||||
addToResidencyContainer(cmdBufferAllocation);
|
||||
if (requireHeaps) {
|
||||
size_t heapSize = 65536u;
|
||||
if (DebugManager.flags.ForceDefaultHeapSize.get() != -1) {
|
||||
heapSize = DebugManager.flags.ForceDefaultHeapSize.get() * MemoryConstants::kiloByte;
|
||||
}
|
||||
heapHelper = std::unique_ptr<HeapHelper>(new HeapHelper(device->getMemoryManager(), device->getDefaultEngine().commandStreamReceiver->getInternalAllocationStorage(), device->getNumGenericSubDevices() > 1u));
|
||||
|
||||
for (uint32_t i = 0; i < IndirectHeap::Type::NUM_TYPES; i++) {
|
||||
@@ -112,9 +111,10 @@ CommandContainer::ErrorCode CommandContainer::initialize(Device *device, Allocat
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t heapSize = getHeapSize(static_cast<HeapType>(i));
|
||||
allocationIndirectHeaps[i] = heapHelper->getHeapAllocation(i,
|
||||
heapSize,
|
||||
alignedSize,
|
||||
defaultHeapAllocationAlignment,
|
||||
device->getRootDeviceIndex());
|
||||
if (!allocationIndirectHeaps[i]) {
|
||||
return ErrorCode::OUT_OF_DEVICE_MEMORY;
|
||||
@@ -177,7 +177,7 @@ void CommandContainer::reset() {
|
||||
|
||||
for (uint32_t i = 0; i < IndirectHeap::Type::NUM_TYPES; i++) {
|
||||
if (indirectHeaps[i] != nullptr) {
|
||||
if (i == IndirectHeap::Type::INDIRECT_OBJECT || !this->keepCurrentStateHeap) {
|
||||
if (i == IndirectHeap::Type::INDIRECT_OBJECT || !this->stateBaseAddressTracking) {
|
||||
indirectHeaps[i]->replaceBuffer(indirectHeaps[i]->getCpuBase(),
|
||||
indirectHeaps[i]->getMaxAvailableSpace());
|
||||
if (i == IndirectHeap::Type::SURFACE_STATE) {
|
||||
@@ -200,7 +200,7 @@ size_t CommandContainer::getAlignedCmdBufferSize() const {
|
||||
totalCommandBufferSize = static_cast<size_t>(DebugManager.flags.OverrideCmdListCmdBufferSizeInKb.get()) * MemoryConstants::kiloByte;
|
||||
totalCommandBufferSize += cmdBufferReservedSize;
|
||||
}
|
||||
return alignUp<size_t>(totalCommandBufferSize, MemoryConstants::pageSize64k);
|
||||
return alignUp<size_t>(totalCommandBufferSize, defaultCmdBufferAllocationAlignment);
|
||||
}
|
||||
|
||||
void *CommandContainer::getHeapSpaceAllowGrow(HeapType heapType,
|
||||
@@ -226,7 +226,7 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSize(HeapType heapType, size_
|
||||
UNRECOVERABLE_IF(indirectHeap->getAvailableSpace() < sizeRequested);
|
||||
} else {
|
||||
if (indirectHeap->getAvailableSpace() < sizeRequested) {
|
||||
size_t newSize = indirectHeap->getUsed() + indirectHeap->getAvailableSpace();
|
||||
size_t newSize = indirectHeap->getMaxAvailableSpace();
|
||||
if (allowGrow) {
|
||||
newSize = std::max(newSize, indirectHeap->getAvailableSpace() + sizeRequested);
|
||||
}
|
||||
@@ -250,7 +250,7 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSize(HeapType heapType, size_
|
||||
void CommandContainer::createAndAssignNewHeap(HeapType heapType, size_t size) {
|
||||
auto indirectHeap = getIndirectHeap(heapType);
|
||||
auto oldAlloc = getIndirectHeapAllocation(heapType);
|
||||
auto newAlloc = getHeapHelper()->getHeapAllocation(heapType, size, MemoryConstants::pageSize, device->getRootDeviceIndex());
|
||||
auto newAlloc = getHeapHelper()->getHeapAllocation(heapType, size, defaultHeapAllocationAlignment, device->getRootDeviceIndex());
|
||||
UNRECOVERABLE_IF(!oldAlloc);
|
||||
UNRECOVERABLE_IF(!newAlloc);
|
||||
auto oldBase = indirectHeap->getHeapGpuBase();
|
||||
@@ -330,7 +330,7 @@ void CommandContainer::prepareBindfulSsh() {
|
||||
constexpr size_t heapSize = MemoryConstants::pageSize64k;
|
||||
allocationIndirectHeaps[IndirectHeap::Type::SURFACE_STATE] = heapHelper->getHeapAllocation(IndirectHeap::Type::SURFACE_STATE,
|
||||
heapSize,
|
||||
MemoryConstants::pageSize64k,
|
||||
defaultHeapAllocationAlignment,
|
||||
device->getRootDeviceIndex());
|
||||
UNRECOVERABLE_IF(!allocationIndirectHeaps[IndirectHeap::Type::SURFACE_STATE]);
|
||||
residencyContainer.push_back(allocationIndirectHeaps[IndirectHeap::Type::SURFACE_STATE]);
|
||||
@@ -477,17 +477,15 @@ void CommandContainer::fillReusableAllocationLists() {
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr size_t heapSize = 65536u;
|
||||
size_t alignedSize = getAlignedCmdBufferSize();
|
||||
for (auto i = 0u; i < amountToFill; i++) {
|
||||
for (auto heapType = 0u; heapType < IndirectHeap::Type::NUM_TYPES; heapType++) {
|
||||
if (skipHeapAllocationCreation(static_cast<HeapType>(heapType))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t heapSize = getHeapSize(static_cast<HeapType>(heapType));
|
||||
auto heapToReuse = heapHelper->getHeapAllocation(heapType,
|
||||
heapSize,
|
||||
alignedSize,
|
||||
defaultHeapAllocationAlignment,
|
||||
device->getRootDeviceIndex());
|
||||
if (heapToReuse != nullptr) {
|
||||
this->immediateCmdListCsr->makeResident(*heapToReuse);
|
||||
@@ -532,4 +530,12 @@ bool CommandContainer::skipHeapAllocationCreation(HeapType heapType) {
|
||||
return skipCreation;
|
||||
}
|
||||
|
||||
size_t CommandContainer::getHeapSize(HeapType heapType) {
|
||||
size_t defaultHeapSize = HeapSize::defaultHeapSize;
|
||||
if (HeapType::SURFACE_STATE == heapType) {
|
||||
defaultHeapSize = this->defaultSshSize;
|
||||
}
|
||||
return HeapSize::getDefaultHeapSize(defaultHeapSize);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -70,6 +70,8 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
CSRequirements::csOverfetchSize;
|
||||
static constexpr size_t totalCmdBufferSize = defaultListCmdBufferSize + cmdBufferReservedSize;
|
||||
static constexpr size_t startingResidencyContainerSize = 128;
|
||||
static constexpr size_t defaultCmdBufferAllocationAlignment = MemoryConstants::pageSize64k;
|
||||
static constexpr size_t defaultHeapAllocationAlignment = MemoryConstants::pageSize64k;
|
||||
|
||||
CommandContainer();
|
||||
|
||||
@@ -100,7 +102,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
|
||||
void *getHeapSpaceAllowGrow(HeapType heapType, size_t size);
|
||||
|
||||
ErrorCode initialize(Device *device, AllocationsList *reusableAllocationList, bool requireHeaps, bool createSecondaryCmdBufferInHostMem);
|
||||
ErrorCode initialize(Device *device, AllocationsList *reusableAllocationList, size_t defaultSshSize, bool requireHeaps, bool createSecondaryCmdBufferInHostMem);
|
||||
|
||||
void prepareBindfulSsh();
|
||||
|
||||
@@ -173,8 +175,8 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
return indirectHeapInLocalMemory;
|
||||
}
|
||||
|
||||
void setKeepCurrentStateHeap(bool value) {
|
||||
keepCurrentStateHeap = value;
|
||||
void setStateBaseAddressTracking(bool value) {
|
||||
stateBaseAddressTracking = value;
|
||||
}
|
||||
|
||||
HeapContainer sshAllocations;
|
||||
@@ -196,6 +198,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
void createAndAssignNewHeap(HeapType heapType, size_t size);
|
||||
IndirectHeap *initIndirectHeapReservation(ReservedIndirectHeap *indirectHeapReservation, size_t size, size_t alignment, HeapType heapType);
|
||||
inline bool skipHeapAllocationCreation(HeapType heapType);
|
||||
size_t getHeapSize(HeapType heapType);
|
||||
|
||||
GraphicsAllocation *allocationIndirectHeaps[HeapType::NUM_TYPES] = {};
|
||||
std::unique_ptr<IndirectHeap> indirectHeaps[HeapType::NUM_TYPES];
|
||||
@@ -221,6 +224,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
CommandStreamReceiver *immediateCmdListCsr = nullptr;
|
||||
IndirectHeap *sharedSshCsrHeap = nullptr;
|
||||
IndirectHeap *sharedDshCsrHeap = nullptr;
|
||||
size_t defaultSshSize = 0;
|
||||
|
||||
uint32_t dirtyHeaps = std::numeric_limits<uint32_t>::max();
|
||||
uint32_t numIddsPerBlock = 64;
|
||||
@@ -231,7 +235,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
|
||||
bool heapSharingEnabled = false;
|
||||
bool useSecondaryCommandStream = false;
|
||||
bool indirectHeapInLocalMemory = false;
|
||||
bool keepCurrentStateHeap = false;
|
||||
bool stateBaseAddressTracking = false;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -167,6 +167,7 @@ struct EncodeStates {
|
||||
const void *fnDynamicStateHeap,
|
||||
BindlessHeapsHelper *bindlessHeapHelper,
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
static size_t getSshHeapSize();
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
||||
@@ -579,4 +579,10 @@ template <typename Family>
|
||||
size_t EncodeDispatchKernel<Family>::additionalSizeRequiredDsh(uint32_t iddCount) {
|
||||
return iddCount * sizeof(typename Family::INTERFACE_DESCRIPTOR_DATA);
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
size_t EncodeStates<Family>::getSshHeapSize() {
|
||||
return 64 * KB;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -798,4 +798,10 @@ template <typename Family>
|
||||
size_t EncodeDispatchKernel<Family>::additionalSizeRequiredDsh(uint32_t iddCount) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
size_t EncodeStates<Family>::getSshHeapSize() {
|
||||
return 2 * MB;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -622,7 +622,7 @@ IndirectHeap &CommandStreamReceiver::getIndirectHeap(IndirectHeap::Type heapType
|
||||
void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
|
||||
size_t minRequiredSize, IndirectHeap *&indirectHeap) {
|
||||
size_t reservedSize = 0;
|
||||
auto finalHeapSize = getDefaultHeapSize();
|
||||
auto finalHeapSize = HeapSize::getDefaultHeapSize(HeapSize::defaultHeapSize);
|
||||
if (IndirectHeap::Type::SURFACE_STATE == heapType) {
|
||||
finalHeapSize = defaultSshSize;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,6 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
||||
void setClearSlmWorkAroundParameter(PipeControlArgs &args);
|
||||
void addPipeControlBeforeStateSip(LinearStream &commandStream, Device &device);
|
||||
void addPipeControlBefore3dState(LinearStream &commandStream, DispatchFlags &dispatchFlags);
|
||||
size_t getSshHeapSize();
|
||||
bool are4GbHeapsAvailable() const;
|
||||
|
||||
uint64_t getScratchPatchAddress();
|
||||
|
||||
@@ -74,7 +74,7 @@ CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(ExecutionEnvironment
|
||||
if (DebugManager.flags.FlattenBatchBufferForAUBDump.get() || DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
|
||||
flatBatchBufferHelper.reset(new FlatBatchBufferHelperHw<GfxFamily>(executionEnvironment));
|
||||
}
|
||||
defaultSshSize = getSshHeapSize();
|
||||
defaultSshSize = HeapSize::getDefaultHeapSize(EncodeStates<GfxFamily>::getSshHeapSize());
|
||||
canUse4GbHeaps = are4GbHeapsAvailable();
|
||||
|
||||
timestampPacketWriteEnabled = gfxCoreHelper.timestampPacketWriteSupported();
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t CommandStreamReceiverHw<GfxFamily>::getSshHeapSize() {
|
||||
return getDefaultHeapSize();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool CommandStreamReceiverHw<GfxFamily>::are4GbHeapsAvailable() const { return true; }
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t CommandStreamReceiverHw<GfxFamily>::getSshHeapSize() { return 2 * MB; }
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool CommandStreamReceiverHw<GfxFamily>::are4GbHeapsAvailable() const { return is64bit; }
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#
|
||||
# Copyright (C) 2019-2022 Intel Corporation
|
||||
# Copyright (C) 2019-2023 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(NEO_CORE_INDIRECT_HEAP
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/heap_size.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/heap_size.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indirect_heap.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/indirect_heap_type.h
|
||||
)
|
||||
|
||||
24
shared/source/indirect_heap/heap_size.cpp
Normal file
24
shared/source/indirect_heap/heap_size.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
namespace HeapSize {
|
||||
|
||||
size_t getDefaultHeapSize(size_t defaultValue) {
|
||||
auto defaultSize = defaultValue;
|
||||
if (DebugManager.flags.ForceDefaultHeapSize.get() != -1) {
|
||||
defaultSize = DebugManager.flags.ForceDefaultHeapSize.get() * MemoryConstants::kiloByte;
|
||||
}
|
||||
return defaultSize;
|
||||
}
|
||||
|
||||
} // namespace HeapSize
|
||||
} // namespace NEO
|
||||
19
shared/source/indirect_heap/heap_size.h
Normal file
19
shared/source/indirect_heap/heap_size.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/constants.h"
|
||||
|
||||
namespace NEO {
|
||||
namespace HeapSize {
|
||||
|
||||
inline constexpr size_t defaultHeapSize = 64 * KB;
|
||||
|
||||
size_t getDefaultHeapSize(size_t defaultValue);
|
||||
|
||||
} // namespace HeapSize
|
||||
} // namespace NEO
|
||||
@@ -8,23 +8,13 @@
|
||||
#pragma once
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/helpers/aligned_memory.h"
|
||||
#include "shared/source/helpers/constants.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/source/indirect_heap/indirect_heap_type.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
inline constexpr size_t defaultHeapSize = 64 * KB;
|
||||
|
||||
inline size_t getDefaultHeapSize() {
|
||||
auto defaultSize = defaultHeapSize;
|
||||
if (DebugManager.flags.ForceDefaultHeapSize.get() != -1) {
|
||||
defaultSize = DebugManager.flags.ForceDefaultHeapSize.get() * MemoryConstants::kiloByte;
|
||||
}
|
||||
return defaultSize;
|
||||
}
|
||||
|
||||
class IndirectHeap : public LinearStream {
|
||||
using BaseClass = LinearStream;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ using CommandContainerTest = Test<CommandContainerFixture>;
|
||||
class MyMockCommandContainer : public CommandContainer {
|
||||
public:
|
||||
using CommandContainer::allocationIndirectHeaps;
|
||||
using CommandContainer::defaultSshSize;
|
||||
using CommandContainer::dirtyHeaps;
|
||||
using CommandContainer::getAlignedCmdBufferSize;
|
||||
using CommandContainer::immediateReusableAllocationList;
|
||||
@@ -88,7 +89,7 @@ TEST_F(CommandContainerHeapStateTests, givenDirtyHeapsWhenSettingStateForSingleH
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenCreatingCommandBufferThenCorrectAllocationTypeIsSet) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
ASSERT_NE(0u, cmdContainer.getCmdBufferAllocations().size());
|
||||
EXPECT_EQ(AllocationType::COMMAND_BUFFER, cmdContainer.getCmdBufferAllocations()[0]->getAllocationType());
|
||||
@@ -101,7 +102,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenCreatingCommandBufferThenCorre
|
||||
|
||||
TEST_F(CommandContainerTest, givenCreateSecondaryCmdBufferInHostMemWhenInitializeThenCreateAdditionalLinearStream) {
|
||||
MyMockCommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, true);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, true);
|
||||
|
||||
EXPECT_NE(cmdContainer.secondaryCommandStreamForImmediateCmdList.get(), nullptr);
|
||||
|
||||
@@ -116,7 +117,7 @@ TEST_F(CommandContainerTest, givenCreateSecondaryCmdBufferInHostMemWhenInitializ
|
||||
|
||||
TEST_F(CommandContainerTest, whenInitializeThenNotCreateAdditionalLinearStream) {
|
||||
MyMockCommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EXPECT_EQ(cmdContainer.secondaryCommandStreamForImmediateCmdList.get(), nullptr);
|
||||
|
||||
@@ -129,7 +130,7 @@ TEST_F(CommandContainerTest, whenInitializeThenNotCreateAdditionalLinearStream)
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenAllocatingHeapsThenSetCorrectAllocationTypes) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
for (uint32_t i = 0; i < HeapType::NUM_TYPES; i++) {
|
||||
HeapType heapType = static_cast<HeapType>(i);
|
||||
@@ -150,7 +151,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenAllocatingHeapsThenSetCorrectA
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeThenEverythingIsInitialized) {
|
||||
CommandContainer cmdContainer;
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, status);
|
||||
|
||||
EXPECT_EQ(pDevice, cmdContainer.getDevice());
|
||||
@@ -180,7 +181,7 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeThenEverythingIs
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenHeapNotRequiredThenHeapIsNotInitialized) {
|
||||
CommandContainer cmdContainer;
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, false, false);
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, false, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, status);
|
||||
|
||||
EXPECT_EQ(pDevice, cmdContainer.getDevice());
|
||||
@@ -217,7 +218,7 @@ TEST_F(CommandContainerTest, givenEnabledLocalMemoryAndIsaInSystemMemoryWhenCmdC
|
||||
auto instructionHeapBaseAddress = device->getMemoryManager()->getInternalHeapBaseAddress(0, false);
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
auto status = cmdContainer.initialize(device.get(), nullptr, true, false);
|
||||
auto status = cmdContainer.initialize(device.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, status);
|
||||
|
||||
EXPECT_EQ(instructionHeapBaseAddress, cmdContainer.getInstructionHeapBaseAddress());
|
||||
@@ -236,7 +237,7 @@ TEST_F(CommandContainerTest, givenForceDefaultHeapSizeWhenCmdContainerIsInitiali
|
||||
auto device = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
auto status = cmdContainer.initialize(device.get(), nullptr, true, false);
|
||||
auto status = cmdContainer.initialize(device.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, status);
|
||||
|
||||
auto indirectHeap = cmdContainer.getIndirectHeap(IndirectHeap::Type::INDIRECT_OBJECT);
|
||||
@@ -246,21 +247,21 @@ TEST_F(CommandContainerTest, givenForceDefaultHeapSizeWhenCmdContainerIsInitiali
|
||||
TEST_F(CommandContainerTest, givenCommandContainerDuringInitWhenAllocateGfxMemoryFailsThenErrorIsReturned) {
|
||||
CommandContainer cmdContainer;
|
||||
pDevice->executionEnvironment->memoryManager.reset(new FailMemoryManager(0, *pDevice->executionEnvironment));
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::OUT_OF_DEVICE_MEMORY, status);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCreateSecondaryCmdBufferInHostMemWhenAllocateSecondaryCmdStreamFailsDuringInitializeThenErrorIsReturned) {
|
||||
CommandContainer cmdContainer;
|
||||
static_cast<MockMemoryManager *>(pDevice->getMemoryManager())->maxSuccessAllocatedGraphicsMemoryIndex = 7;
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, true, true);
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, true);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::OUT_OF_DEVICE_MEMORY, status);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWithAllocsListWhenAllocateAndResetThenCmdBufferAllocIsReused) {
|
||||
AllocationsList allocList;
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice, &allocList, true, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, true, HeapSize::defaultHeapSize, false);
|
||||
auto &cmdBufferAllocs = cmdContainer->getCmdBufferAllocations();
|
||||
auto memoryManager = static_cast<MockMemoryManager *>(pDevice->getMemoryManager());
|
||||
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 0u);
|
||||
@@ -297,7 +298,7 @@ TEST_F(CommandContainerTest, givenReusableAllocationsAndRemoveUserFenceInCmdlist
|
||||
|
||||
AllocationsList allocList;
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice, &allocList, true, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, true, false);
|
||||
auto &cmdBufferAllocs = cmdContainer->getCmdBufferAllocations();
|
||||
auto memoryManager = static_cast<MockMemoryManager *>(pDevice->getMemoryManager());
|
||||
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
|
||||
@@ -319,7 +320,7 @@ TEST_F(CommandContainerTest, givenCommandContainerDuringInitWhenAllocateHeapMemo
|
||||
CommandContainer cmdContainer;
|
||||
auto tempMemoryManager = pDevice->executionEnvironment->memoryManager.release();
|
||||
pDevice->executionEnvironment->memoryManager.reset(new FailMemoryManager(1, *pDevice->executionEnvironment));
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto status = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::OUT_OF_DEVICE_MEMORY, status);
|
||||
delete tempMemoryManager;
|
||||
}
|
||||
@@ -334,10 +335,10 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenSettingIndirectHeapAllocat
|
||||
|
||||
TEST_F(CommandContainerTest, givenHeapAllocationsWhenDestroyCommandContainerThenHeapAllocationsAreReused) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, HeapSize::defaultHeapSize, false);
|
||||
auto heapAllocationsAddress = cmdContainer->getIndirectHeapAllocation(HeapType::SURFACE_STATE)->getUnderlyingBuffer();
|
||||
cmdContainer.reset(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, HeapSize::defaultHeapSize, false);
|
||||
bool status = true;
|
||||
for (uint32_t i = 0; i < HeapType::NUM_TYPES && !status; i++) {
|
||||
auto heapType = static_cast<HeapType>(i);
|
||||
@@ -352,7 +353,7 @@ TEST_F(CommandContainerTest, givenHeapAllocationsWhenDestroyCommandContainerThen
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenResetThenStateIsReset) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
LinearStream stream;
|
||||
uint32_t usedSize = 1;
|
||||
cmdContainer.getCommandStream()->getSpace(usedSize);
|
||||
@@ -366,7 +367,7 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenResetThenStateIsReset) {
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenWantToAddNullPtrToResidencyContainerThenNothingIsAdded) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto size = cmdContainer.getResidencyContainer().size();
|
||||
cmdContainer.addToResidencyContainer(nullptr);
|
||||
EXPECT_EQ(cmdContainer.getResidencyContainer().size(), size);
|
||||
@@ -375,14 +376,14 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenWantToAddNullPtrToResidenc
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenInitializeThenCmdBuffersAreAddedToResidencyContainer) {
|
||||
CommandContainer cmdContainer;
|
||||
EXPECT_EQ(cmdContainer.getResidencyContainer().size(), 0u);
|
||||
cmdContainer.initialize(pDevice, nullptr, false, true);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, false, true);
|
||||
EXPECT_EQ(cmdContainer.getResidencyContainer().size(), 2u);
|
||||
EXPECT_EQ(cmdContainer.getResidencyContainer().size(), cmdContainer.getCmdBufferAllocations().size());
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCommandContainerWhenWantToAddAlreadyAddedAllocationAndDuplicatesRemovedThenExpectedSizeIsReturned) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
MockGraphicsAllocation mockAllocation;
|
||||
|
||||
auto sizeBefore = cmdContainer.getResidencyContainer().size();
|
||||
@@ -407,7 +408,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerWhenInitializeCalledThenSSHHeapH
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->setReservedSshSize(4 * MemoryConstants::pageSize);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
auto heap = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
@@ -420,7 +421,7 @@ HWTEST_F(CommandContainerTest, givenNotEnoughSpaceInSSHWhenGettingHeapWithRequir
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->setReservedSshSize(4 * MemoryConstants::pageSize);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
auto heap = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
@@ -435,7 +436,7 @@ HWTEST_F(CommandContainerTest, givenNotEnoughSpaceInSSHWhenGettingHeapWithRequir
|
||||
|
||||
TEST_F(CommandContainerTest, givenAvailableSpaceWhenGetHeapWithRequiredSizeAndAlignmentCalledThenExistingAllocationIsReturned) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
HeapType heapTypes[] = {HeapType::SURFACE_STATE,
|
||||
HeapType::DYNAMIC_STATE};
|
||||
@@ -470,7 +471,7 @@ TEST_F(CommandContainerTest, givenAvailableSpaceWhenGetHeapWithRequiredSizeAndAl
|
||||
|
||||
TEST_F(CommandContainerTest, givenUnalignedAvailableSpaceWhenGetHeapWithRequiredSizeAndAlignmentCalledThenHeapReturnedIsCorrectlyAligned) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
auto heapAllocation = cmdContainer->getIndirectHeapAllocation(HeapType::SURFACE_STATE);
|
||||
auto heap = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
@@ -494,7 +495,7 @@ TEST_F(CommandContainerTest, givenUnalignedAvailableSpaceWhenGetHeapWithRequired
|
||||
|
||||
TEST_F(CommandContainerTest, givenNoAlignmentAndAvailableSpaceWhenGetHeapWithRequiredSizeAndAlignmentCalledThenHeapReturnedIsNotAligned) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
auto heapAllocation = cmdContainer->getIndirectHeapAllocation(HeapType::SURFACE_STATE);
|
||||
auto heap = cmdContainer->getIndirectHeap(HeapType::SURFACE_STATE);
|
||||
@@ -518,7 +519,7 @@ TEST_F(CommandContainerTest, givenNoAlignmentAndAvailableSpaceWhenGetHeapWithReq
|
||||
|
||||
TEST_F(CommandContainerTest, givenNotEnoughSpaceWhenGetHeapWithRequiredSizeAndAlignmentCalledThenNewAllocationIsReturned) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
HeapType heapTypes[] = {HeapType::SURFACE_STATE,
|
||||
HeapType::DYNAMIC_STATE};
|
||||
@@ -556,7 +557,7 @@ TEST_F(CommandContainerTest, givenNotEnoughSpaceWhenGetHeapWithRequiredSizeAndAl
|
||||
|
||||
TEST_F(CommandContainerTest, givenNotEnoughSpaceWhenCreatedAlocationHaveDifferentBaseThenHeapIsDirty) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
HeapType type = HeapType::INDIRECT_OBJECT;
|
||||
|
||||
@@ -588,7 +589,7 @@ TEST_F(CommandContainerTest, givenNotEnoughSpaceWhenCreatedAlocationHaveDifferen
|
||||
|
||||
TEST_F(CommandContainerTest, whenAllocateNextCmdBufferIsCalledThenNewAllocationIsCreatedAndCommandStreamReplaced) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto stream = cmdContainer->getCommandStream();
|
||||
ASSERT_NE(nullptr, stream);
|
||||
|
||||
@@ -616,7 +617,7 @@ TEST_F(CommandContainerTest, whenAllocateNextCmdBufferIsCalledThenNewAllocationI
|
||||
|
||||
TEST_F(CommandContainerTest, whenResettingCommandContainerThenStoredCmdBuffersAreFreedAndStreamIsReplacedWithInitialBuffer) {
|
||||
std::unique_ptr<CommandContainer> cmdContainer(new CommandContainer);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
cmdContainer->allocateNextCommandBuffer();
|
||||
cmdContainer->allocateNextCommandBuffer();
|
||||
@@ -662,7 +663,7 @@ TEST_P(CommandContainerHeaps, givenCommandContainerWhenGetAllowHeapGrowCalledThe
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
if (!pDevice->getHardwareInfo().capabilityTable.supportsImages && HeapType::DYNAMIC_STATE == heapType) {
|
||||
EXPECT_EQ(cmdContainer.getIndirectHeap(heapType), nullptr);
|
||||
} else {
|
||||
@@ -680,7 +681,7 @@ TEST_P(CommandContainerHeaps, givenCommandContainerWhenGetingMoreThanAvailableSi
|
||||
HeapType heapType = GetParam();
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer.setDirtyStateForAllHeaps(false);
|
||||
auto heap = cmdContainer.getIndirectHeap(heapType);
|
||||
if (!pDevice->getHardwareInfo().capabilityTable.supportsImages && HeapType::DYNAMIC_STATE == heapType) {
|
||||
@@ -715,10 +716,10 @@ TEST_P(CommandContainerHeaps, givenCommandContainerForDifferentRootDevicesThenHe
|
||||
auto device1 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||
|
||||
CommandContainer cmdContainer0;
|
||||
cmdContainer0.initialize(device0.get(), nullptr, true, false);
|
||||
cmdContainer0.initialize(device0.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
CommandContainer cmdContainer1;
|
||||
cmdContainer1.initialize(device1.get(), nullptr, true, false);
|
||||
cmdContainer1.initialize(device1.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
if (!pDevice->getHardwareInfo().capabilityTable.supportsImages && HeapType::DYNAMIC_STATE == heapType) {
|
||||
EXPECT_EQ(cmdContainer0.getIndirectHeap(heapType), nullptr);
|
||||
EXPECT_EQ(cmdContainer1.getIndirectHeap(heapType), nullptr);
|
||||
@@ -745,13 +746,13 @@ TEST_F(CommandContainerHeaps, givenCommandContainerForDifferentRootDevicesThenCm
|
||||
auto device1 = std::unique_ptr<MockDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
|
||||
|
||||
CommandContainer cmdContainer0;
|
||||
cmdContainer0.initialize(device0.get(), nullptr, true, false);
|
||||
cmdContainer0.initialize(device0.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(1u, cmdContainer0.getCmdBufferAllocations().size());
|
||||
uint32_t cmdBufferAllocationIndex0 = cmdContainer0.getCmdBufferAllocations().front()->getRootDeviceIndex();
|
||||
EXPECT_EQ(device0->getRootDeviceIndex(), cmdBufferAllocationIndex0);
|
||||
|
||||
CommandContainer cmdContainer1;
|
||||
cmdContainer1.initialize(device1.get(), nullptr, true, false);
|
||||
cmdContainer1.initialize(device1.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(1u, cmdContainer1.getCmdBufferAllocations().size());
|
||||
uint32_t cmdBufferAllocationIndex1 = cmdContainer1.getCmdBufferAllocations().front()->getRootDeviceIndex();
|
||||
EXPECT_EQ(device1->getRootDeviceIndex(), cmdBufferAllocationIndex1);
|
||||
@@ -773,13 +774,13 @@ TEST_F(CommandContainerHeaps, givenCommandContainerForDifferentRootDevicesThenIn
|
||||
auto &gfxCoreHelper1 = device1->getGfxCoreHelper();
|
||||
|
||||
CommandContainer cmdContainer0;
|
||||
cmdContainer0.initialize(device0.get(), nullptr, true, false);
|
||||
cmdContainer0.initialize(device0.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
bool useLocalMemory0 = !gfxCoreHelper0.useSystemMemoryPlacementForISA(device0->getHardwareInfo());
|
||||
uint64_t baseAddressHeapDevice0 = device0->getMemoryManager()->getInternalHeapBaseAddress(device0->getRootDeviceIndex(), useLocalMemory0);
|
||||
EXPECT_EQ(cmdContainer0.getInstructionHeapBaseAddress(), baseAddressHeapDevice0);
|
||||
|
||||
CommandContainer cmdContainer1;
|
||||
cmdContainer1.initialize(device1.get(), nullptr, true, false);
|
||||
cmdContainer1.initialize(device1.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
bool useLocalMemory1 = !gfxCoreHelper1.useSystemMemoryPlacementForISA(device0->getHardwareInfo());
|
||||
uint64_t baseAddressHeapDevice1 = device1->getMemoryManager()->getInternalHeapBaseAddress(device1->getRootDeviceIndex(), useLocalMemory1);
|
||||
EXPECT_EQ(cmdContainer1.getInstructionHeapBaseAddress(), baseAddressHeapDevice1);
|
||||
@@ -790,7 +791,7 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenDestructionThenNonHeapAllo
|
||||
MockGraphicsAllocation alloc;
|
||||
size_t size = 0x1000;
|
||||
alloc.setSize(size);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->getDeallocationContainer().push_back(&alloc);
|
||||
cmdContainer.reset();
|
||||
EXPECT_EQ(alloc.getUnderlyingBufferSize(), size);
|
||||
@@ -798,7 +799,7 @@ TEST_F(CommandContainerTest, givenCommandContainerWhenDestructionThenNonHeapAllo
|
||||
|
||||
TEST_F(CommandContainerTest, givenContainerAllocatesNextCommandBufferWhenResetingContainerThenExpectFirstCommandBufferAllocationIsReused) {
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
auto stream = cmdContainer->getCommandStream();
|
||||
ASSERT_NE(nullptr, stream);
|
||||
@@ -843,14 +844,14 @@ class MyLinearStreamMock : public LinearStream {
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenContainerIsInitializedThenStreamContainsContainerPtr) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EXPECT_EQ(reinterpret_cast<MyLinearStreamMock *>(cmdContainer.getCommandStream())->cmdContainer, &cmdContainer);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenContainerIsInitializedThenStreamSizeEqualAlignedTotalCmdBuffSizeDecreasedOfReservedSize) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
size_t alignedSize = alignUp<size_t>(CommandContainer::totalCmdBufferSize, MemoryConstants::pageSize64k);
|
||||
EXPECT_EQ(cmdContainer.getCommandStream()->getMaxAvailableSpace(), alignedSize - CommandContainer::cmdBufferReservedSize);
|
||||
}
|
||||
@@ -860,21 +861,21 @@ TEST_F(CommandContainerTest, GivenCmdContainerAndDebugFlagWhenContainerIsInitial
|
||||
|
||||
DebugManager.flags.OverrideCmdListCmdBufferSizeInKb.set(0);
|
||||
MyMockCommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
size_t alignedSize = alignUp<size_t>(cmdContainer.getAlignedCmdBufferSize(), MemoryConstants::pageSize64k);
|
||||
EXPECT_EQ(cmdContainer.getCommandStream()->getMaxAvailableSpace(), alignedSize - MyMockCommandContainer::cmdBufferReservedSize);
|
||||
|
||||
auto newSizeInKB = 512;
|
||||
DebugManager.flags.OverrideCmdListCmdBufferSizeInKb.set(newSizeInKB);
|
||||
MyMockCommandContainer cmdContainer2;
|
||||
cmdContainer2.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer2.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
alignedSize = alignUp<size_t>(cmdContainer.getAlignedCmdBufferSize(), MemoryConstants::pageSize64k);
|
||||
EXPECT_EQ(cmdContainer2.getCommandStream()->getMaxAvailableSpace(), alignedSize - MyMockCommandContainer::cmdBufferReservedSize);
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenAlocatingNextCmdBufferThenStreamSizeEqualAlignedTotalCmdBuffSizeDecreasedOfReservedSize) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer.allocateNextCommandBuffer();
|
||||
size_t alignedSize = alignUp<size_t>(CommandContainer::totalCmdBufferSize, MemoryConstants::pageSize64k);
|
||||
EXPECT_EQ(cmdContainer.getCommandStream()->getMaxAvailableSpace(), alignedSize - CommandContainer::cmdBufferReservedSize);
|
||||
@@ -882,7 +883,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenAlocatingNextCmdBufferThenStre
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenCloseAndAllocateNextCommandBufferCalledThenBBEndPlacedAtEndOfLinearStream) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto ptr = cmdContainer.getCommandStream()->getSpace(0u);
|
||||
cmdContainer.closeAndAllocateNextCommandBuffer();
|
||||
@@ -891,7 +892,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenCloseAndAllocateNextCommandBuf
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenCloseAndAllocateNextCommandBufferCalledThenNewCmdBufferAllocationCreated) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(cmdContainer.getCmdBufferAllocations().size(), 1u);
|
||||
cmdContainer.closeAndAllocateNextCommandBuffer();
|
||||
EXPECT_EQ(cmdContainer.getCmdBufferAllocations().size(), 2u);
|
||||
@@ -899,7 +900,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenCloseAndAllocateNextCommandBuf
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenSetCmdBufferThenCmdBufferSetCorrectly) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
AllocationProperties properties{pDevice->getRootDeviceIndex(),
|
||||
true /* allocateMemory*/,
|
||||
@@ -918,7 +919,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenSetCmdBufferThenCmdBufferSetCo
|
||||
TEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithoutAnyAllocationInListThenReturnNullptr) {
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, false, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, false, false);
|
||||
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
cmdContainer->immediateReusableAllocationList = std::make_unique<NEO::AllocationsList>();
|
||||
@@ -935,7 +936,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithAl
|
||||
*csr.tagAddress = 0u;
|
||||
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, false, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, false, false);
|
||||
cmdContainer->setImmediateCmdListCsr(&csr);
|
||||
cmdContainer->immediateReusableAllocationList = std::make_unique<NEO::AllocationsList>();
|
||||
|
||||
@@ -956,7 +957,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithAl
|
||||
*csr.tagAddress = 10u;
|
||||
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, false, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, false, false);
|
||||
cmdContainer->setImmediateCmdListCsr(&csr);
|
||||
cmdContainer->immediateReusableAllocationList = std::make_unique<NEO::AllocationsList>();
|
||||
|
||||
@@ -973,7 +974,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithAl
|
||||
|
||||
TEST_F(CommandContainerTest, GivenCmdContainerWhenContainerIsInitializedThenSurfaceStateIndirectHeapSizeIsCorrect) {
|
||||
MyMockCommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto size = cmdContainer.allocationIndirectHeaps[IndirectHeap::Type::SURFACE_STATE]->getUnderlyingBufferSize();
|
||||
constexpr size_t expectedHeapSize = MemoryConstants::pageSize64k;
|
||||
EXPECT_EQ(expectedHeapSize, size);
|
||||
@@ -1010,7 +1011,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerHasImmediateCsrWhenGettingHeapWi
|
||||
cmdContainer.immediateReusableAllocationList = std::make_unique<NEO::AllocationsList>();
|
||||
|
||||
cmdContainer.setNumIddPerBlock(1);
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, code);
|
||||
|
||||
EXPECT_EQ(nullptr, cmdContainer.getIndirectHeap(HeapType::DYNAMIC_STATE));
|
||||
@@ -1186,7 +1187,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerUsedInRegularCmdListWhenGettingH
|
||||
HeapReserveArguments sshReserveArgs = {sshHeapPtr, 0, sshAlign};
|
||||
HeapReserveArguments dshReserveArgs = {dshHeapPtr, 0, dshAlign};
|
||||
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, code);
|
||||
|
||||
cmdContainer.reserveSpaceForDispatch(sshReserveArgs, dshReserveArgs, true);
|
||||
@@ -1234,7 +1235,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerUsingPrivateHeapsWhenGettingRese
|
||||
HeapReserveArguments sshReserveArgs = {sshHeapPtr, 0, sshAlign};
|
||||
HeapReserveArguments dshReserveArgs = {dshHeapPtr, 0, dshAlign};
|
||||
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, code);
|
||||
|
||||
constexpr size_t nonZeroSshSize = 4 * MemoryConstants::kiloByte;
|
||||
@@ -1277,7 +1278,7 @@ HWTEST_F(CommandContainerTest,
|
||||
|
||||
cmdContainer.setNumIddPerBlock(1);
|
||||
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto code = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EXPECT_EQ(CommandContainer::ErrorCode::SUCCESS, code);
|
||||
|
||||
constexpr size_t misalignedSize = 11;
|
||||
@@ -1387,7 +1388,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsThe
|
||||
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, true, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
|
||||
auto heapHelper = reinterpret_cast<MockHeapHelper *>(cmdContainer->getHeapHelper());
|
||||
@@ -1413,7 +1414,7 @@ TEST_F(CommandContainerTest, givenCreateSecondaryCmdBufferInHostMemWhenFillReusa
|
||||
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, true, true);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, true, true);
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
|
||||
auto actualResidencyContainerSize = cmdContainer->getResidencyContainer().size();
|
||||
@@ -1437,7 +1438,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
|
||||
|
||||
AllocationsList allocList;
|
||||
cmdContainer->enableHeapSharing();
|
||||
cmdContainer->initialize(pDevice, &allocList, true, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
|
||||
auto &reusableHeapsList = reinterpret_cast<MockHeapHelper *>(cmdContainer->getHeapHelper())->storageForReuse->getAllocationsForReuse();
|
||||
@@ -1457,7 +1458,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
|
||||
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, true, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
|
||||
auto &reusableHeapsList = reinterpret_cast<MockHeapHelper *>(cmdContainer->getHeapHelper())->storageForReuse->getAllocationsForReuse();
|
||||
@@ -1478,7 +1479,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
|
||||
DebugManager.flags.SetAmountOfReusableAllocations.set(1);
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, false, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, false, false);
|
||||
|
||||
EXPECT_EQ(cmdContainer->immediateReusableAllocationList, nullptr);
|
||||
cmdContainer->fillReusableAllocationLists();
|
||||
@@ -1493,7 +1494,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsAnd
|
||||
DebugManager.flags.SetAmountOfReusableAllocations.set(1);
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, false, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, false, false);
|
||||
|
||||
EXPECT_EQ(cmdContainer->immediateReusableAllocationList, nullptr);
|
||||
EXPECT_TRUE(allocList.peekIsEmpty());
|
||||
@@ -1514,7 +1515,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWithoutGlobalListWhenFillReusableA
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.SetAmountOfReusableAllocations.set(1);
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, false, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, false, false);
|
||||
|
||||
EXPECT_EQ(cmdContainer->immediateReusableAllocationList, nullptr);
|
||||
cmdContainer->fillReusableAllocationLists();
|
||||
@@ -1532,7 +1533,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsWit
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, false, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, false, false);
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
|
||||
EXPECT_EQ(cmdContainer->immediateReusableAllocationList, nullptr);
|
||||
@@ -1549,7 +1550,7 @@ TEST_F(CommandContainerTest, givenCmdContainerAndCsrWhenGetHeapWithRequiredSizeA
|
||||
auto cmdContainer = std::make_unique<CommandContainer>();
|
||||
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, true, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
|
||||
cmdContainer->fillReusableAllocationLists();
|
||||
@@ -1573,7 +1574,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWhenFillReusableAllocationListsAnd
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
auto csr = pDevice->getDefaultEngine().commandStreamReceiver;
|
||||
AllocationsList allocList;
|
||||
cmdContainer->initialize(pDevice, &allocList, false, false);
|
||||
cmdContainer->initialize(pDevice, &allocList, HeapSize::defaultHeapSize, false, false);
|
||||
cmdContainer->setImmediateCmdListCsr(csr);
|
||||
|
||||
cmdContainer->fillReusableAllocationLists();
|
||||
@@ -1597,7 +1598,7 @@ TEST_F(CommandContainerHeapStateTests, givenCmdContainerWhenSettingHeapAddressMo
|
||||
TEST_F(CommandContainerTest, givenGlobalHeapModelSelectedWhenCmdContainerIsInitializedThenNoSurfaceAndDynamicHeapCreated) {
|
||||
MyMockCommandContainer cmdContainer;
|
||||
cmdContainer.setHeapAddressModel(HeapAddressModel::GlobalStateless);
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EXPECT_EQ(nullptr, cmdContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE));
|
||||
EXPECT_EQ(nullptr, cmdContainer.getIndirectHeap(NEO::HeapType::DYNAMIC_STATE));
|
||||
@@ -1605,17 +1606,17 @@ TEST_F(CommandContainerTest, givenGlobalHeapModelSelectedWhenCmdContainerIsIniti
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerAllocatesIndirectHeapWhenGettingMemoryPlacementThenFlagMatchesGraphicsAllocationPlacement) {
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EXPECT_EQ(cmdContainer->isIndirectHeapInLocalMemory(), cmdContainer->getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT)->getGraphicsAllocation()->isAllocatedInLocalMemoryPool());
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerSetToKeepStateHeapPositionWhenStateHeapsConsumedAndContainerResetThenHeapsCurrentPositionRetained) {
|
||||
TEST_F(CommandContainerTest, givenCmdContainerSetToSbaTrackingWhenStateHeapsConsumedAndContainerResetThenHeapsCurrentPositionRetained) {
|
||||
bool useDsh = pDevice->getHardwareInfo().capabilityTable.supportsImages;
|
||||
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
cmdContainer->setKeepCurrentStateHeap(true);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->setStateBaseAddressTracking(true);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
NEO::IndirectHeap *ioh = cmdContainer->getIndirectHeap(NEO::HeapType::INDIRECT_OBJECT);
|
||||
ioh->getSpace(64);
|
||||
@@ -1639,3 +1640,16 @@ TEST_F(CommandContainerTest, givenCmdContainerSetToKeepStateHeapPositionWhenStat
|
||||
EXPECT_EQ(dshUsed, dsh->getUsed());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(CommandContainerTest, givenCmdContainerSetToSbaTrackingWhenContainerIsInitializedThenSurfaceHeapDefaultValueIsUsed) {
|
||||
constexpr size_t sshDefaultSize = 2 * HeapSize::defaultHeapSize;
|
||||
|
||||
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, sshDefaultSize, true, false);
|
||||
EXPECT_EQ(HeapSize::defaultHeapSize, cmdContainer->defaultSshSize);
|
||||
|
||||
cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
cmdContainer->setStateBaseAddressTracking(true);
|
||||
cmdContainer->initialize(pDevice, nullptr, sshDefaultSize, true, false);
|
||||
EXPECT_EQ(2 * HeapSize::defaultHeapSize, cmdContainer->defaultSshSize);
|
||||
}
|
||||
|
||||
@@ -252,3 +252,13 @@ HWTEST_F(CommandEncoderTests, givenDcFlushNotRequiredWhenGettingDcFlushValueThen
|
||||
bool helperValue = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(requiredFlag, rootDeviceEnvironment);
|
||||
EXPECT_FALSE(helperValue);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenXeHpPlatformsWhenGettingDefaultSshSizeThenExpectTwoMegabytes) {
|
||||
constexpr size_t expectedSize = 2 * MemoryConstants::megaByte;
|
||||
EXPECT_EQ(expectedSize, EncodeStates<FamilyType>::getSshHeapSize());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncoderTests, givenPreXeHpPlatformsWhenGettingDefaultSshSizeThenExpectSixtyFourKilobytes) {
|
||||
constexpr size_t expectedSize = 64 * MemoryConstants::kiloByte;
|
||||
EXPECT_EQ(expectedSize, EncodeStates<FamilyType>::getSshHeapSize());
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_stream/linear_stream.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/fixtures/linear_stream_fixture.h"
|
||||
@@ -161,7 +162,7 @@ TEST_F(LinearStreamTest, givenLinearStreamWithoutCmdContainerWhenOneByteLeftInSt
|
||||
using CommandContainerLinearStreamTest = Test<DeviceFixture>;
|
||||
TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenOneByteLeftInStreamThenGetSpaceThrowAbort) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto stream = reinterpret_cast<MyLinearStreamMock *>(cmdContainer.getCommandStream());
|
||||
stream->sizeUsed = stream->getMaxAvailableSpace() - 1;
|
||||
EXPECT_THROW(stream->getSpace(1), std::exception);
|
||||
@@ -169,7 +170,7 @@ TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenOn
|
||||
|
||||
TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenThereIsNoSpaceForCommandAndBBEndThenNewCmdBufferAllocated) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto stream = reinterpret_cast<MyLinearStreamMock *>(cmdContainer.getCommandStream());
|
||||
size_t dummyCommandSize = 2;
|
||||
@@ -181,7 +182,7 @@ TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenTh
|
||||
|
||||
TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenThereIsNoSpaceForCommandAndBBEndThenLinearStreamHasNewAllocation) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto stream = reinterpret_cast<MyLinearStreamMock *>(cmdContainer.getCommandStream());
|
||||
size_t dummyCommandSize = 2;
|
||||
@@ -194,7 +195,7 @@ TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenTh
|
||||
|
||||
TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenThereIsNoSpaceForCommandAndBBEndThenGetSpaceReturnPtrFromNewAllocation) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto stream = reinterpret_cast<MyLinearStreamMock *>(cmdContainer.getCommandStream());
|
||||
size_t dummyCommandSize = 2;
|
||||
@@ -206,7 +207,7 @@ TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenTh
|
||||
|
||||
TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenThereIsSpaceForCommandAndBBEndThenNewCmdBufferIsNotAllocated) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto stream = reinterpret_cast<MyLinearStreamMock *>(cmdContainer.getCommandStream());
|
||||
size_t dummyCommandSize = 2;
|
||||
@@ -218,7 +219,7 @@ TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenTh
|
||||
|
||||
TEST_F(CommandContainerLinearStreamTest, givenLinearStreamWithCmdContainerWhenThereIsNoSpaceForCommandAndBBEndThenBBEndAddedAtEndOfStream) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
|
||||
auto stream = reinterpret_cast<MyLinearStreamMock *>(cmdContainer.getCommandStream());
|
||||
size_t dummyCommandSize = 2;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "shared/source/helpers/blit_helper.h"
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/source/memory_manager/allocation_properties.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
@@ -638,7 +639,7 @@ HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenNotChangedSurfaceStateWhenCapt
|
||||
debugger->sbaTrackingGpuVa.address = 0x45670000;
|
||||
|
||||
NEO::CommandContainer container;
|
||||
container.initialize(pDevice, nullptr, true, false);
|
||||
container.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.SurfaceStateBaseAddress = 0x123456000;
|
||||
@@ -661,7 +662,7 @@ HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenChangedBaseAddressesWhenCaptur
|
||||
debugger->sbaTrackingGpuVa.address = 0x45670000;
|
||||
{
|
||||
NEO::CommandContainer container;
|
||||
container.initialize(pDevice, nullptr, true, false);
|
||||
container.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.SurfaceStateBaseAddress = 0x123456000;
|
||||
@@ -674,7 +675,7 @@ HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenChangedBaseAddressesWhenCaptur
|
||||
|
||||
{
|
||||
NEO::CommandContainer container;
|
||||
container.initialize(pDevice, nullptr, true, false);
|
||||
container.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.GeneralStateBaseAddress = 0x123456000;
|
||||
@@ -687,7 +688,7 @@ HWTEST2_P(L0DebuggerSimpleParameterizedTest, givenChangedBaseAddressesWhenCaptur
|
||||
|
||||
{
|
||||
NEO::CommandContainer container;
|
||||
container.initialize(pDevice, nullptr, true, false);
|
||||
container.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
NEO::Debugger::SbaAddresses sba = {};
|
||||
sba.BindlessSurfaceStateBaseAddress = 0x123456000;
|
||||
|
||||
@@ -162,7 +162,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterCommandEncoderTest, givenOffsetAndValue
|
||||
|
||||
GenCmdList commands;
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
constexpr uint32_t regOffset = 0x2000u;
|
||||
constexpr uint32_t immVal = 0xbaau;
|
||||
constexpr uint64_t dstAddress = 0xDEADCAF0u;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/command_container/cmdcontainer.h"
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -18,7 +19,7 @@ using EncodeBatchBufferStartOrEndTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBEndThenCommandIsAdded) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeBatchBufferStartOrEnd<FamilyType>::programBatchBufferEnd(cmdContainer);
|
||||
|
||||
GenCmdList commands;
|
||||
@@ -31,7 +32,7 @@ HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBEndTh
|
||||
|
||||
HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBStartThenCommandIsAdded) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeBatchBufferStartOrEnd<FamilyType>::programBatchBufferStart(cmdContainer.getCommandStream(), 0, true, false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
@@ -44,7 +45,7 @@ HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBStart
|
||||
|
||||
HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBStartWithSecondLevelParameterThenCommandIsProgrammedCorrectly) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeBatchBufferStartOrEnd<FamilyType>::programBatchBufferStart(cmdContainer.getCommandStream(), 0, true, false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
@@ -61,7 +62,7 @@ HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBStart
|
||||
|
||||
HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBStartWithFirstLevelParameterThenCommandIsProgrammedCorrectly) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeBatchBufferStartOrEnd<FamilyType>::programBatchBufferStart(cmdContainer.getCommandStream(), 0, false, false, false);
|
||||
|
||||
GenCmdList commands;
|
||||
@@ -78,7 +79,7 @@ HWTEST_F(EncodeBatchBufferStartOrEndTest, givenCommandContainerWhenEncodeBBStart
|
||||
|
||||
HWTEST_F(EncodeBatchBufferStartOrEndTest, givenGpuAddressWhenEncodeBBStartThenAddressIsProgrammedCorrectly) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
uint64_t gpuAddress = 12 * MemoryConstants::pageSize;
|
||||
EncodeBatchBufferStartOrEnd<FamilyType>::programBatchBufferStart(cmdContainer.getCommandStream(), gpuAddress, false, false, false);
|
||||
@@ -99,7 +100,7 @@ using EncodeNoopTest = Test<DeviceFixture>;
|
||||
|
||||
HWTEST_F(EncodeNoopTest, WhenAligningLinearStreamToCacheLineSizeThenItIsAlignedCorrectly) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto commandStream = cmdContainer.getCommandStream();
|
||||
|
||||
EncodeNoop<FamilyType>::alignToCacheLine(*commandStream);
|
||||
@@ -112,7 +113,7 @@ HWTEST_F(EncodeNoopTest, WhenAligningLinearStreamToCacheLineSizeThenItIsAlignedC
|
||||
|
||||
HWTEST_F(EncodeNoopTest, WhenEmittingNoopsThenExpectCorrectNumberOfBytesNooped) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
auto commandStream = cmdContainer.getCommandStream();
|
||||
|
||||
size_t usedBefore = commandStream->getUsed();
|
||||
|
||||
@@ -506,7 +506,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeDe
|
||||
{
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(-1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
@@ -539,7 +539,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeDe
|
||||
{
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(0);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
@@ -567,7 +567,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeDe
|
||||
{
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
@@ -1273,7 +1273,7 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindlessKernelAndBindles
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
@@ -1311,7 +1311,7 @@ HWTEST2_F(BindlessCommandEncodeStatesContainerTest, givenBindlessKernelAndBindle
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
|
||||
@@ -1351,7 +1351,7 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindfulKernelWhenBindles
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
|
||||
@@ -1388,7 +1388,7 @@ HWTEST_F(BindlessCommandEncodeStatesContainerTest, givenBindlessModeEnabledWhenD
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
auto commandContainer = std::make_unique<CommandContainer>();
|
||||
commandContainer->initialize(pDevice, nullptr, true, false);
|
||||
commandContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
commandContainer->setDirtyStateForAllHeaps(false);
|
||||
commandContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]->createBindlessHeapsHelper(pDevice->getMemoryManager(),
|
||||
@@ -1430,7 +1430,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenGlobalBindlessHeapsWhenDispatchin
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(1);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
using SAMPLER_BORDER_COLOR_STATE = typename FamilyType::SAMPLER_BORDER_COLOR_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
@@ -1481,7 +1481,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, givenGlobalBindlessHeapsWhenDispatchin
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, givenBindlessModeDisabledelWithSamplerThenGlobalDshIsNotResidnecyContainer) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseBindlessMode.set(0);
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename FamilyType::INTERFACE_DESCRIPTOR_DATA;
|
||||
uint32_t numSamplers = 1;
|
||||
|
||||
@@ -438,7 +438,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
|
||||
{
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(-1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
@@ -472,7 +472,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
|
||||
{
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(0);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
@@ -497,7 +497,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenForceBtpPrefetchModeD
|
||||
{
|
||||
DebugManager.flags.ForceBtpPrefetchMode.set(1);
|
||||
cmdContainer.reset(new MyMockCommandContainer());
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->l1CachePolicyData = &l1CachePolicyData;
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -147,7 +148,7 @@ HWTEST_F(CommandEncoderMathTest, WhenReservingCommandThenBitfieldSetCorrectly) {
|
||||
GenCmdList commands;
|
||||
CommandContainer cmdContainer;
|
||||
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeMath<FamilyType>::commandReserve(cmdContainer);
|
||||
|
||||
@@ -177,7 +178,7 @@ HWTEST_F(CommandEncoderMathTest, givenOffsetAndValueWhenEncodeBitwiseAndValIsCal
|
||||
|
||||
GenCmdList commands;
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
constexpr uint32_t regOffset = 0x2000u;
|
||||
constexpr uint32_t immVal = 0xbaau;
|
||||
constexpr uint64_t dstAddress = 0xDEADCAF0u;
|
||||
@@ -223,7 +224,7 @@ HWTEST_F(CommandEncoderMathTest, WhenSettingGroupSizeIndirectThenCommandsAreCorr
|
||||
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
CrossThreadDataOffset offsets[3] = {0, sizeof(uint32_t), 2 * sizeof(uint32_t)};
|
||||
uint32_t crossThreadAddress[3] = {};
|
||||
@@ -249,7 +250,7 @@ HWTEST_F(CommandEncoderMathTest, WhenSettingGroupCountIndirectThenCommandsAreCor
|
||||
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
CrossThreadDataOffset offsets[3] = {0, sizeof(uint32_t), 2 * sizeof(uint32_t)};
|
||||
uint32_t crossThreadAddress[3] = {};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -24,7 +25,7 @@ HWTEST2_F(XeHPAndLaterCommandEncoderMathTest, WhenAppendsAGreaterThanThenPredica
|
||||
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeMathMMIO<FamilyType>::encodeGreaterThanPredicate(cmdContainer, 0xDEADBEEFCAF0u, 17u);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -18,7 +19,7 @@ class CommandSetMMIOFixture : public DeviceFixture {
|
||||
void setUp() {
|
||||
DeviceFixture::setUp();
|
||||
cmdContainer = std::make_unique<CommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
}
|
||||
void tearDown() {
|
||||
cmdContainer.reset();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
|
||||
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/source/os_interface/product_helper.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
@@ -15,7 +16,7 @@ namespace NEO {
|
||||
void CommandEncodeStatesFixture::setUp() {
|
||||
DeviceFixture::setUp();
|
||||
cmdContainer = std::make_unique<MyMockCommandContainer>();
|
||||
cmdContainer->initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer->initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
const auto &hwInfo = pDevice->getHardwareInfo();
|
||||
auto &productHelper = pDevice->getProductHelper();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gen11/hw_cmds.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -26,7 +27,7 @@ GEN11TEST_F(CommandEncoderMathTestGen11, WhenAppendsAGreaterThanThenPredicateCor
|
||||
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeMathMMIO<FamilyType>::encodeGreaterThanPredicate(cmdContainer, 0xDEADBEEFCAF0u, 17u);
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/helpers/gfx_core_helper.h"
|
||||
#include "shared/source/helpers/pipeline_select_helper.h"
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
@@ -33,7 +34,7 @@ GEN12LPTEST_F(CommandEncoderTest, WhenAdjustComputeModeIsCalledThenStateComputeM
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
|
||||
auto ret = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto ret = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
ASSERT_EQ(CommandContainer::ErrorCode::SUCCESS, ret);
|
||||
|
||||
auto usedSpaceBefore = cmdContainer.getCommandStream()->getUsed();
|
||||
@@ -63,7 +64,7 @@ GEN12LPTEST_F(CommandEncoderTest, WhenAdjustComputeModeIsCalledThenStateComputeM
|
||||
|
||||
GEN12LPTEST_F(CommandEncoderTest, givenCommandContainerWhenEncodeL3StateThenDoNotDispatchMMIOCommand) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeL3State<FamilyType>::encode(cmdContainer, false);
|
||||
|
||||
GenCmdList commands;
|
||||
@@ -85,7 +86,7 @@ GEN12LPTEST_F(CommandEncodeStatesTest, givenVariousEngineTypesWhenEncodeSbaThenA
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
|
||||
auto ret = cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
auto ret = cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
ASSERT_EQ(CommandContainer::ErrorCode::SUCCESS, ret);
|
||||
|
||||
auto gmmHelper = cmdContainer.getDevice()->getRootDeviceEnvironment().getGmmHelper();
|
||||
@@ -128,7 +129,7 @@ GEN12LPTEST_F(CommandEncoderTest, GivenGen12LpWhenProgrammingL3StateOnThenExpect
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeL3State<FamilyType>::encode(cmdContainer, true);
|
||||
|
||||
@@ -142,7 +143,7 @@ GEN12LPTEST_F(CommandEncoderTest, GivenGen12LpWhenProgrammingL3StateOnThenExpect
|
||||
GEN12LPTEST_F(CommandEncoderTest, GivenGen12LpWhenProgrammingL3StateOffThenExpectNoCommandsDispatched) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeL3State<FamilyType>::encode(cmdContainer, false);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -24,7 +25,7 @@ GEN12LPTEST_F(CommandEncoderMathTestGen12Lp, WhenAppendsAGreaterThanThenPredicat
|
||||
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeMathMMIO<FamilyType>::encodeGreaterThanPredicate(cmdContainer, 0xDEADBEEFCAF0u, 17u);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gen8/hw_cmds.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -26,7 +27,7 @@ GEN8TEST_F(CommandEncoderMathTestGen8, WhenAppendsAGreaterThanThenPredicateCorre
|
||||
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeMathMMIO<FamilyType>::encodeGreaterThanPredicate(cmdContainer, 0xDEADBEEFCAF0u, 17u);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gen9/hw_cmds.h"
|
||||
#include "shared/source/helpers/blit_commands_helper.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -23,7 +24,7 @@ using CommandEncoderTest = Test<DeviceFixture>;
|
||||
|
||||
GEN9TEST_F(CommandEncoderTest, WhenProgrammingThenLoadRegisterImmIsUsed) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeL3State<FamilyType>::encode(cmdContainer, false);
|
||||
|
||||
GenCmdList commands;
|
||||
@@ -36,7 +37,7 @@ GEN9TEST_F(CommandEncoderTest, WhenProgrammingThenLoadRegisterImmIsUsed) {
|
||||
|
||||
GEN9TEST_F(CommandEncoderTest, givenNoSlmThenCorrectMmioIsSet) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeL3State<FamilyType>::encode(cmdContainer, false);
|
||||
|
||||
GenCmdList commands;
|
||||
@@ -54,7 +55,7 @@ GEN9TEST_F(CommandEncoderTest, givenNoSlmThenCorrectMmioIsSet) {
|
||||
|
||||
GEN9TEST_F(CommandEncoderTest, givenSlmThenCorrectMmioIsSet) {
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
EncodeL3State<FamilyType>::encode(cmdContainer, true);
|
||||
|
||||
GenCmdList commands;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/gen9/hw_cmds.h"
|
||||
#include "shared/source/helpers/register_offsets.h"
|
||||
#include "shared/source/indirect_heap/heap_size.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
@@ -26,7 +27,7 @@ GEN9TEST_F(CommandEncoderMathTestGen9, WhenAppendsAGreaterThanThenPredicateCorre
|
||||
using MI_MATH_ALU_INST_INLINE = typename FamilyType::MI_MATH_ALU_INST_INLINE;
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(pDevice, nullptr, true, false);
|
||||
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
EncodeMathMMIO<FamilyType>::encodeGreaterThanPredicate(cmdContainer, 0xDEADBEEFCAF0u, 17u);
|
||||
|
||||
|
||||
@@ -3812,7 +3812,7 @@ TEST(DrmMemoryManager, givenEnabledResourceRegistrationWhenSshIsAllocatedThenItI
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDevice>(executionEnvironment, 0));
|
||||
|
||||
CommandContainer cmdContainer;
|
||||
cmdContainer.initialize(device.get(), nullptr, true, false);
|
||||
cmdContainer.initialize(device.get(), nullptr, HeapSize::defaultHeapSize, true, false);
|
||||
|
||||
auto *ssh = cmdContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
|
||||
auto bo = static_cast<DrmAllocation *>(ssh->getGraphicsAllocation())->getBO();
|
||||
|
||||
Reference in New Issue
Block a user