mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Move physical address allocator to CommandStreamReceiverSimulatedHw
Change-Id: Ic3c397fe1a93eccae9235f1315a26ae31a3f5b60 Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
@ -49,7 +49,7 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
|
||||
}
|
||||
|
||||
if (!aubCenter->getPhysicalAddressAllocator()) {
|
||||
aubCenter->initPhysicalAddressAllocator(this->createPhysicalAddressAllocator());
|
||||
aubCenter->initPhysicalAddressAllocator(this->createPhysicalAddressAllocator(&hwInfoIn));
|
||||
}
|
||||
auto physicalAddressAllocator = aubCenter->getPhysicalAddressAllocator();
|
||||
UNRECOVERABLE_IF(nullptr == physicalAddressAllocator);
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "runtime/command_stream/command_stream_receiver_hw.h"
|
||||
#include "runtime/gen_common/aub_mapper.h"
|
||||
#include "runtime/memory_manager/memory_banks.h"
|
||||
#include "runtime/memory_manager/physical_address_allocator.h"
|
||||
|
||||
namespace AubMemDump {
|
||||
struct AubStream;
|
||||
@ -39,6 +38,5 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw<Gf
|
||||
|
||||
protected:
|
||||
MMIOList splitMMIORegisters(const std::string ®isters, char delimiter);
|
||||
PhysicalAddressAllocator *createPhysicalAddressAllocator();
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
@ -66,11 +66,6 @@ void CommandStreamReceiverSimulatedCommonHw<GfxFamily>::initAdditionalMMIO() {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
PhysicalAddressAllocator *CommandStreamReceiverSimulatedCommonHw<GfxFamily>::createPhysicalAddressAllocator() {
|
||||
return new PhysicalAddressAllocator();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint64_t CommandStreamReceiverSimulatedCommonHw<GfxFamily>::getPPGTTAdditionalBits(GraphicsAllocation *gfxAllocation) {
|
||||
return BIT(PageTableEntry::presentBit) | BIT(PageTableEntry::writableBit) | BIT(PageTableEntry::userSupervisorBit);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
#include "runtime/command_stream/command_stream_receiver_simulated_common_hw.h"
|
||||
#include "runtime/memory_manager/memory_banks.h"
|
||||
#include "runtime/memory_manager/physical_address_allocator.h"
|
||||
|
||||
namespace OCLRT {
|
||||
class GraphicsAllocation;
|
||||
@ -24,5 +25,8 @@ class CommandStreamReceiverSimulatedHw : public CommandStreamReceiverSimulatedCo
|
||||
int getAddressSpace(int hint) {
|
||||
return AubMemDump::AddressSpaceValues::TraceNonlocal;
|
||||
}
|
||||
PhysicalAddressAllocator *createPhysicalAddressAllocator(const HardwareInfo *hwInfo) {
|
||||
return new PhysicalAddressAllocator();
|
||||
}
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
@ -27,7 +27,7 @@ TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const Hardware
|
||||
ExecutionEnvironment &executionEnvironment)
|
||||
: BaseClass(hwInfoIn, executionEnvironment) {
|
||||
|
||||
physicalAddressAllocator.reset(this->createPhysicalAddressAllocator());
|
||||
physicalAddressAllocator.reset(this->createPhysicalAddressAllocator(&hwInfoIn));
|
||||
|
||||
ppgtt = std::make_unique<std::conditional<is64bit, PML4, PDPE>::type>(physicalAddressAllocator.get());
|
||||
ggtt = std::make_unique<PDPE>(physicalAddressAllocator.get());
|
||||
|
@ -851,3 +851,12 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenSshSize
|
||||
auto aubCsr = std::make_unique<MockAubCsr<FamilyType>>(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
EXPECT_EQ(64 * KB, aubCsr->defaultSshSize);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenPhysicalAddressAllocatorIsCreatedThenItIsNotNull) {
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
auto oldSkuTable = hwInfoHelper.pSkuTable;
|
||||
std::unique_ptr<FeatureTable, std::function<void(FeatureTable *)>> skuTable(new FeatureTable, [&](FeatureTable *ptr) { delete ptr; hwInfoHelper.pSkuTable = oldSkuTable; });
|
||||
hwInfoHelper.pSkuTable = skuTable.get();
|
||||
std::unique_ptr<PhysicalAddressAllocator> allocator(aubCsr.createPhysicalAddressAllocator(&hwInfoHelper));
|
||||
ASSERT_NE(nullptr, allocator);
|
||||
}
|
||||
|
@ -333,3 +333,13 @@ HWTEST_F(TbxCommandSteamSimpleTest, whenTbxCommandStreamReceiverIsCreatedThenPPG
|
||||
physicalAddress = tbxCsr.ggtt->map(address, MemoryConstants::pageSize, 0, MemoryBanks::MainBank);
|
||||
EXPECT_NE(0u, physicalAddress);
|
||||
}
|
||||
|
||||
HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCommandStreamReceiverWhenPhysicalAddressAllocatorIsCreatedThenItIsNotNull) {
|
||||
MockTbxCsr<FamilyType> tbxCsr(*platformDevices[0], *pDevice->executionEnvironment);
|
||||
auto oldSkuTable = hwInfoHelper.pSkuTable;
|
||||
std::unique_ptr<FeatureTable, std::function<void(FeatureTable *)>> skuTable(new FeatureTable, [&](FeatureTable *ptr) { delete ptr; hwInfoHelper.pSkuTable = oldSkuTable; });
|
||||
hwInfoHelper.pSkuTable = skuTable.get();
|
||||
std::unique_ptr<PhysicalAddressAllocator> allocator(tbxCsr.createPhysicalAddressAllocator(&hwInfoHelper));
|
||||
ASSERT_NE(nullptr, allocator);
|
||||
hwInfoHelper.pSkuTable = nullptr;
|
||||
}
|
||||
|
Reference in New Issue
Block a user