Move createPhysicalAllocator() to a common CSR class

- AUB and TBX use this method and it was duplicated,
- moving to common base class allows to remove duplicates

Change-Id: Ia9f08dfb0967de1b5968ac0e531733c5b868e504
This commit is contained in:
Hoppe, Mateusz
2018-10-04 07:22:22 -07:00
committed by sys_ocldev
parent 5cd7ca460c
commit 2f7158e035
8 changed files with 10 additions and 16 deletions

View File

@ -111,8 +111,6 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
int getAddressSpaceFromPTEBits(uint64_t entryBits) const;
protected:
PhysicalAddressAllocator *createPhysicalAddressAllocator();
bool dumpAubNonWritable = false;
ExternalAllocationsContainer externalAllocations;
};

View File

@ -21,7 +21,6 @@
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/memory_manager/memory_banks.h"
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
#include "runtime/memory_manager/physical_address_allocator.h"
#include "runtime/os_interface/debug_settings_manager.h"
#include <cstring>
@ -38,7 +37,7 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
UNRECOVERABLE_IF(nullptr == aubCenter);
if (!aubCenter->getPhysicalAddressAllocator()) {
aubCenter->initPhysicalAddressAllocator(createPhysicalAddressAllocator());
aubCenter->initPhysicalAddressAllocator(this->createPhysicalAddressAllocator());
}
auto physicalAddressAllocator = aubCenter->getPhysicalAddressAllocator();
UNRECOVERABLE_IF(nullptr == physicalAddressAllocator);
@ -781,8 +780,7 @@ uint32_t AUBCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
}
template <typename GfxFamily>
PhysicalAddressAllocator *AUBCommandStreamReceiverHw<GfxFamily>::createPhysicalAddressAllocator() {
PhysicalAddressAllocator *CommandStreamReceiverSimulatedCommonHw<GfxFamily>::createPhysicalAddressAllocator() {
return new PhysicalAddressAllocator();
}
} // namespace OCLRT

View File

@ -8,6 +8,7 @@
#pragma once
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/memory_manager/memory_banks.h"
#include "runtime/memory_manager/physical_address_allocator.h"
namespace OCLRT {
class GraphicsAllocation;
@ -19,5 +20,8 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw<Gf
uint64_t getGTTBits() const {
return 0u;
}
protected:
PhysicalAddressAllocator *createPhysicalAddressAllocator();
};
} // namespace OCLRT

View File

@ -88,8 +88,5 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
CommandStreamReceiverType getType() override {
return CommandStreamReceiverType::CSR_TBX;
}
protected:
void createPhysicalAddressAllocator();
};
} // namespace OCLRT

View File

@ -26,7 +26,7 @@ TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const Hardware
ExecutionEnvironment &executionEnvironment)
: BaseClass(hwInfoIn, executionEnvironment) {
createPhysicalAddressAllocator();
physicalAddressAllocator.reset(this->createPhysicalAddressAllocator());
ppgtt = std::make_unique<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type>(physicalAddressAllocator.get());
ggtt = std::make_unique<PDPE>(physicalAddressAllocator.get());
@ -418,10 +418,4 @@ template <typename GfxFamily>
uint32_t TbxCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
return MemoryBanks::getBank(this->deviceIndex);
}
template <typename GfxFamily>
void TbxCommandStreamReceiverHw<GfxFamily>::createPhysicalAddressAllocator() {
physicalAddressAllocator = std::make_unique<PhysicalAddressAllocator>();
}
} // namespace OCLRT

View File

@ -23,4 +23,5 @@ void populateFactoryTable<AUBCommandStreamReceiverHw<Family>>() {
}
template class AUBCommandStreamReceiverHw<Family>;
template class CommandStreamReceiverSimulatedCommonHw<Family>;
} // namespace OCLRT

View File

@ -23,4 +23,5 @@ void populateFactoryTable<AUBCommandStreamReceiverHw<Family>>() {
}
template class AUBCommandStreamReceiverHw<Family>;
template class CommandStreamReceiverSimulatedCommonHw<Family>;
} // namespace OCLRT

View File

@ -23,4 +23,5 @@ void populateFactoryTable<AUBCommandStreamReceiverHw<Family>>() {
}
template class AUBCommandStreamReceiverHw<Family>;
template class CommandStreamReceiverSimulatedCommonHw<Family>;
} // namespace OCLRT