From 2f7158e03513e4882dca5636c2590d8369f05f34 Mon Sep 17 00:00:00 2001 From: "Hoppe, Mateusz" Date: Thu, 4 Oct 2018 07:22:22 -0700 Subject: [PATCH] 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 --- runtime/command_stream/aub_command_stream_receiver_hw.h | 2 -- runtime/command_stream/aub_command_stream_receiver_hw.inl | 6 ++---- .../command_stream_receiver_simulated_common_hw.h | 4 ++++ runtime/command_stream/tbx_command_stream_receiver_hw.h | 3 --- runtime/command_stream/tbx_command_stream_receiver_hw.inl | 8 +------- runtime/gen10/aub_command_stream_receiver_gen10.cpp | 1 + runtime/gen8/aub_command_stream_receiver_gen8.cpp | 1 + runtime/gen9/aub_command_stream_receiver_gen9.cpp | 1 + 8 files changed, 10 insertions(+), 16 deletions(-) diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.h b/runtime/command_stream/aub_command_stream_receiver_hw.h index 05ead52133..2119eb1ea4 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.h +++ b/runtime/command_stream/aub_command_stream_receiver_hw.h @@ -111,8 +111,6 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw @@ -38,7 +37,7 @@ AUBCommandStreamReceiverHw::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::getMemoryBankForGtt() const { } template -PhysicalAddressAllocator *AUBCommandStreamReceiverHw::createPhysicalAddressAllocator() { +PhysicalAddressAllocator *CommandStreamReceiverSimulatedCommonHw::createPhysicalAddressAllocator() { return new PhysicalAddressAllocator(); } - } // namespace OCLRT diff --git a/runtime/command_stream/command_stream_receiver_simulated_common_hw.h b/runtime/command_stream/command_stream_receiver_simulated_common_hw.h index d1056c127a..3b9bd69377 100644 --- a/runtime/command_stream/command_stream_receiver_simulated_common_hw.h +++ b/runtime/command_stream/command_stream_receiver_simulated_common_hw.h @@ -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::TbxCommandStreamReceiverHw(const Hardware ExecutionEnvironment &executionEnvironment) : BaseClass(hwInfoIn, executionEnvironment) { - createPhysicalAddressAllocator(); + physicalAddressAllocator.reset(this->createPhysicalAddressAllocator()); ppgtt = std::make_unique::type>(physicalAddressAllocator.get()); ggtt = std::make_unique(physicalAddressAllocator.get()); @@ -418,10 +418,4 @@ template uint32_t TbxCommandStreamReceiverHw::getMemoryBankForGtt() const { return MemoryBanks::getBank(this->deviceIndex); } - -template -void TbxCommandStreamReceiverHw::createPhysicalAddressAllocator() { - physicalAddressAllocator = std::make_unique(); -} - } // namespace OCLRT diff --git a/runtime/gen10/aub_command_stream_receiver_gen10.cpp b/runtime/gen10/aub_command_stream_receiver_gen10.cpp index 47581bb397..3ffbfced19 100644 --- a/runtime/gen10/aub_command_stream_receiver_gen10.cpp +++ b/runtime/gen10/aub_command_stream_receiver_gen10.cpp @@ -23,4 +23,5 @@ void populateFactoryTable>() { } template class AUBCommandStreamReceiverHw; +template class CommandStreamReceiverSimulatedCommonHw; } // namespace OCLRT diff --git a/runtime/gen8/aub_command_stream_receiver_gen8.cpp b/runtime/gen8/aub_command_stream_receiver_gen8.cpp index c0d7cee078..80a7f9b603 100644 --- a/runtime/gen8/aub_command_stream_receiver_gen8.cpp +++ b/runtime/gen8/aub_command_stream_receiver_gen8.cpp @@ -23,4 +23,5 @@ void populateFactoryTable>() { } template class AUBCommandStreamReceiverHw; +template class CommandStreamReceiverSimulatedCommonHw; } // namespace OCLRT diff --git a/runtime/gen9/aub_command_stream_receiver_gen9.cpp b/runtime/gen9/aub_command_stream_receiver_gen9.cpp index 5a164567b0..c92e82e2da 100644 --- a/runtime/gen9/aub_command_stream_receiver_gen9.cpp +++ b/runtime/gen9/aub_command_stream_receiver_gen9.cpp @@ -23,4 +23,5 @@ void populateFactoryTable>() { } template class AUBCommandStreamReceiverHw; +template class CommandStreamReceiverSimulatedCommonHw; } // namespace OCLRT