Add flag to determine if csr can allocate in internal heaps
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
0c8080ac26
commit
298df1582b
|
@ -517,12 +517,13 @@ TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenValidObjectIsRet
|
|||
EXPECT_NE(nullptr, &indirectHeap);
|
||||
}
|
||||
|
||||
TEST_P(CommandQueueIndirectHeapTest, givenIndirectObjectHeapWhenItIsQueriedForInternalAllocationThenTrueIsReturned) {
|
||||
HWTEST_P(CommandQueueIndirectHeapTest, givenIndirectObjectHeapWhenItIsQueriedForInternalAllocationThenTrueIsReturned) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
MockCommandQueue cmdQ(context.get(), pClDevice, props);
|
||||
auto &commandStreamReceiver = pClDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto &indirectHeap = cmdQ.getIndirectHeap(this->GetParam(), 8192);
|
||||
if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT) {
|
||||
if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT && commandStreamReceiver.canUse4GbHeaps) {
|
||||
EXPECT_TRUE(indirectHeap.getGraphicsAllocation()->is32BitAllocation());
|
||||
} else {
|
||||
EXPECT_FALSE(indirectHeap.getGraphicsAllocation()->is32BitAllocation());
|
||||
|
@ -587,7 +588,7 @@ TEST_P(CommandQueueIndirectHeapTest, WhenGettingIndirectHeapThenSizeIsAlignedToC
|
|||
EXPECT_TRUE(isAligned<MemoryConstants::cacheLineSize>(indirectHeap.getAvailableSpace()));
|
||||
}
|
||||
|
||||
TEST_P(CommandQueueIndirectHeapTest, givenCommandStreamReceiverWithReusableAllocationsWhenAskedForHeapAllocationThenAllocationFromReusablePoolIsReturned) {
|
||||
HWTEST_P(CommandQueueIndirectHeapTest, givenCommandStreamReceiverWithReusableAllocationsWhenAskedForHeapAllocationThenAllocationFromReusablePoolIsReturned) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
MockCommandQueue cmdQ(context.get(), pClDevice, props);
|
||||
|
||||
|
@ -597,9 +598,9 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandStreamReceiverWithReusableAlloc
|
|||
|
||||
GraphicsAllocation *allocation = nullptr;
|
||||
|
||||
auto &commandStreamReceiver = cmdQ.getGpgpuCommandStreamReceiver();
|
||||
auto &commandStreamReceiver = pClDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto allocationType = GraphicsAllocation::AllocationType::LINEAR_STREAM;
|
||||
if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT) {
|
||||
if (this->GetParam() == IndirectHeap::INDIRECT_OBJECT && commandStreamReceiver.canUse4GbHeaps) {
|
||||
allocationType = GraphicsAllocation::AllocationType::INTERNAL_HEAP;
|
||||
}
|
||||
allocation = memoryManager->allocateGraphicsMemoryWithProperties({pDevice->getRootDeviceIndex(), allocationSize, allocationType, pDevice->getDeviceBitfield()});
|
||||
|
@ -736,13 +737,14 @@ TEST_P(CommandQueueIndirectHeapTest, GivenCommandQueueWithHeapWhenGraphicAllocat
|
|||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetIndirectHeapIsCalledThenIndirectHeapAllocationTypeShouldBeSetToInternalHeapForIohAndLinearStreamForOthers) {
|
||||
HWTEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetIndirectHeapIsCalledThenIndirectHeapAllocationTypeShouldBeSetToInternalHeapForIohAndLinearStreamForOthers) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, 0, 0};
|
||||
MockCommandQueue cmdQ(context.get(), pClDevice, props);
|
||||
auto &commandStreamReceiver = pClDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
|
||||
auto heapType = this->GetParam();
|
||||
|
||||
bool requireInternalHeap = IndirectHeap::INDIRECT_OBJECT == heapType;
|
||||
bool requireInternalHeap = IndirectHeap::INDIRECT_OBJECT == heapType && commandStreamReceiver.canUse4GbHeaps;
|
||||
const auto &indirectHeap = cmdQ.getIndirectHeap(heapType, 100);
|
||||
auto indirectHeapAllocation = indirectHeap.getGraphicsAllocation();
|
||||
ASSERT_NE(nullptr, indirectHeapAllocation);
|
||||
|
|
|
@ -206,7 +206,7 @@ HWTEST_F(HardwareCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoComme
|
|||
EXPECT_EQ(PatchInfoAllocationType::IndirectObjectHeap, kernel->getPatchInfoDataList()[0].targetType);
|
||||
}
|
||||
|
||||
HWTEST_F(HardwareCommandsTest, givenIndirectHeapNotAllocatedFromInternalPoolWhenSendCrossThreadDataIsCalledThenOffsetZeroIsReturned) {
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenIndirectHeapNotAllocatedFromInternalPoolWhenSendCrossThreadDataIsCalledThenOffsetZeroIsReturned) {
|
||||
auto nonInternalAllocation = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
IndirectHeap indirectHeap(nonInternalAllocation, false);
|
||||
|
||||
|
@ -221,7 +221,7 @@ HWTEST_F(HardwareCommandsTest, givenIndirectHeapNotAllocatedFromInternalPoolWhen
|
|||
pDevice->getMemoryManager()->freeGraphicsMemory(nonInternalAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(HardwareCommandsTest, givenIndirectHeapAllocatedFromInternalPoolWhenSendCrossThreadDataIsCalledThenHeapBaseOffsetIsReturned) {
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenIndirectHeapAllocatedFromInternalPoolWhenSendCrossThreadDataIsCalledThenHeapBaseOffsetIsReturned) {
|
||||
auto internalAllocation = pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties(pDevice->getRootDeviceIndex(), true, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::INTERNAL_HEAP, pDevice->getDeviceBitfield()));
|
||||
IndirectHeap indirectHeap(internalAllocation, true);
|
||||
auto expectedOffset = internalAllocation->getGpuAddressToPatch();
|
||||
|
@ -238,7 +238,7 @@ HWTEST_F(HardwareCommandsTest, givenIndirectHeapAllocatedFromInternalPoolWhenSen
|
|||
pDevice->getMemoryManager()->freeGraphicsMemory(internalAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(HardwareCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoCommentsForAUBDumpIsSetThenAddPatchInfoDataOffsetsAreMoved) {
|
||||
HWCMDTEST_F(IGFX_GEN8_CORE, HardwareCommandsTest, givenSendCrossThreadDataWhenWhenAddPatchInfoCommentsForAUBDumpIsSetThenAddPatchInfoDataOffsetsAreMoved) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AddPatchInfoCommentsForAUBDump.set(true);
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
|
|||
using BaseClass::staticWorkPartitioningEnabled;
|
||||
using BaseClass::wasSubmittedToSingleSubdevice;
|
||||
using BaseClass::CommandStreamReceiver::bindingTableBaseAddressRequired;
|
||||
using BaseClass::CommandStreamReceiver::canUse4GbHeaps;
|
||||
using BaseClass::CommandStreamReceiver::checkForNewResources;
|
||||
using BaseClass::CommandStreamReceiver::checkImplicitFlushForGpuIdle;
|
||||
using BaseClass::CommandStreamReceiver::cleanupResources;
|
||||
|
|
|
@ -390,7 +390,7 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
|
|||
if (IndirectHeap::SURFACE_STATE == heapType) {
|
||||
finalHeapSize = defaultSshSize;
|
||||
}
|
||||
bool requireInternalHeap = IndirectHeap::INDIRECT_OBJECT == heapType ? true : false;
|
||||
bool requireInternalHeap = IndirectHeap::INDIRECT_OBJECT == heapType ? canUse4GbHeaps : false;
|
||||
|
||||
if (DebugManager.flags.AddPatchInfoCommentsForAUBDump.get()) {
|
||||
requireInternalHeap = false;
|
||||
|
|
|
@ -184,6 +184,7 @@ class CommandStreamReceiver {
|
|||
bool peekTimestampPacketWriteEnabled() const { return timestampPacketWriteEnabled; }
|
||||
|
||||
size_t defaultSshSize;
|
||||
bool canUse4GbHeaps = true;
|
||||
|
||||
AllocationsList &getTemporaryAllocations();
|
||||
AllocationsList &getAllocationsForReuse();
|
||||
|
|
|
@ -145,6 +145,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|||
void addPipeControlCmd(LinearStream &commandStream, PipeControlArgs &args);
|
||||
void addPipeControlBeforeStateBaseAddress(LinearStream &commandStream);
|
||||
size_t getSshHeapSize();
|
||||
bool are4GbHeapsAvailable() const;
|
||||
|
||||
uint64_t getScratchPatchAddress();
|
||||
void createScratchSpaceController();
|
||||
|
|
|
@ -52,6 +52,7 @@ CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(ExecutionEnvironment
|
|||
resetKmdNotifyHelper(new KmdNotifyHelper(&peekHwInfo().capabilityTable.kmdNotifyProperties));
|
||||
flatBatchBufferHelper.reset(new FlatBatchBufferHelperHw<GfxFamily>(executionEnvironment));
|
||||
defaultSshSize = getSshHeapSize();
|
||||
canUse4GbHeaps = are4GbHeapsAvailable();
|
||||
|
||||
timestampPacketWriteEnabled = hwHelper.timestampPacketWriteSupported();
|
||||
if (DebugManager.flags.EnableTimestampPacket.get() != -1) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -14,6 +14,9 @@ size_t CommandStreamReceiverHw<GfxFamily>::getSshHeapSize() {
|
|||
return defaultHeapSize;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool CommandStreamReceiverHw<GfxFamily>::are4GbHeapsAvailable() const { return true; }
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline void CommandStreamReceiverHw<GfxFamily>::programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config) {
|
||||
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
|
||||
|
|
Loading…
Reference in New Issue