Skip to content

Commit 2f7158e

Browse files
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
1 parent 5cd7ca4 commit 2f7158e

8 files changed

+10
-16
lines changed

runtime/command_stream/aub_command_stream_receiver_hw.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ class AUBCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
111111
int getAddressSpaceFromPTEBits(uint64_t entryBits) const;
112112

113113
protected:
114-
PhysicalAddressAllocator *createPhysicalAddressAllocator();
115-
116114
bool dumpAubNonWritable = false;
117115
ExternalAllocationsContainer externalAllocations;
118116
};

runtime/command_stream/aub_command_stream_receiver_hw.inl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "runtime/memory_manager/graphics_allocation.h"
2222
#include "runtime/memory_manager/memory_banks.h"
2323
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
24-
#include "runtime/memory_manager/physical_address_allocator.h"
2524
#include "runtime/os_interface/debug_settings_manager.h"
2625
#include <cstring>
2726

@@ -38,7 +37,7 @@ AUBCommandStreamReceiverHw<GfxFamily>::AUBCommandStreamReceiverHw(const Hardware
3837
UNRECOVERABLE_IF(nullptr == aubCenter);
3938

4039
if (!aubCenter->getPhysicalAddressAllocator()) {
41-
aubCenter->initPhysicalAddressAllocator(createPhysicalAddressAllocator());
40+
aubCenter->initPhysicalAddressAllocator(this->createPhysicalAddressAllocator());
4241
}
4342
auto physicalAddressAllocator = aubCenter->getPhysicalAddressAllocator();
4443
UNRECOVERABLE_IF(nullptr == physicalAddressAllocator);
@@ -781,8 +780,7 @@ uint32_t AUBCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
781780
}
782781

783782
template <typename GfxFamily>
784-
PhysicalAddressAllocator *AUBCommandStreamReceiverHw<GfxFamily>::createPhysicalAddressAllocator() {
783+
PhysicalAddressAllocator *CommandStreamReceiverSimulatedCommonHw<GfxFamily>::createPhysicalAddressAllocator() {
785784
return new PhysicalAddressAllocator();
786785
}
787-
788786
} // namespace OCLRT

runtime/command_stream/command_stream_receiver_simulated_common_hw.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#pragma once
99
#include "runtime/command_stream/command_stream_receiver_hw.h"
1010
#include "runtime/memory_manager/memory_banks.h"
11+
#include "runtime/memory_manager/physical_address_allocator.h"
1112

1213
namespace OCLRT {
1314
class GraphicsAllocation;
@@ -19,5 +20,8 @@ class CommandStreamReceiverSimulatedCommonHw : public CommandStreamReceiverHw<Gf
1920
uint64_t getGTTBits() const {
2021
return 0u;
2122
}
23+
24+
protected:
25+
PhysicalAddressAllocator *createPhysicalAddressAllocator();
2226
};
2327
} // namespace OCLRT

runtime/command_stream/tbx_command_stream_receiver_hw.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,5 @@ class TbxCommandStreamReceiverHw : public CommandStreamReceiverSimulatedHw<GfxFa
8888
CommandStreamReceiverType getType() override {
8989
return CommandStreamReceiverType::CSR_TBX;
9090
}
91-
92-
protected:
93-
void createPhysicalAddressAllocator();
9491
};
9592
} // namespace OCLRT

runtime/command_stream/tbx_command_stream_receiver_hw.inl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ TbxCommandStreamReceiverHw<GfxFamily>::TbxCommandStreamReceiverHw(const Hardware
2626
ExecutionEnvironment &executionEnvironment)
2727
: BaseClass(hwInfoIn, executionEnvironment) {
2828

29-
createPhysicalAddressAllocator();
29+
physicalAddressAllocator.reset(this->createPhysicalAddressAllocator());
3030

3131
ppgtt = std::make_unique<TypeSelector<PML4, PDPE, sizeof(void *) == 8>::type>(physicalAddressAllocator.get());
3232
ggtt = std::make_unique<PDPE>(physicalAddressAllocator.get());
@@ -418,10 +418,4 @@ template <typename GfxFamily>
418418
uint32_t TbxCommandStreamReceiverHw<GfxFamily>::getMemoryBankForGtt() const {
419419
return MemoryBanks::getBank(this->deviceIndex);
420420
}
421-
422-
template <typename GfxFamily>
423-
void TbxCommandStreamReceiverHw<GfxFamily>::createPhysicalAddressAllocator() {
424-
physicalAddressAllocator = std::make_unique<PhysicalAddressAllocator>();
425-
}
426-
427421
} // namespace OCLRT

runtime/gen10/aub_command_stream_receiver_gen10.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ void populateFactoryTable<AUBCommandStreamReceiverHw<Family>>() {
2323
}
2424

2525
template class AUBCommandStreamReceiverHw<Family>;
26+
template class CommandStreamReceiverSimulatedCommonHw<Family>;
2627
} // namespace OCLRT

runtime/gen8/aub_command_stream_receiver_gen8.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ void populateFactoryTable<AUBCommandStreamReceiverHw<Family>>() {
2323
}
2424

2525
template class AUBCommandStreamReceiverHw<Family>;
26+
template class CommandStreamReceiverSimulatedCommonHw<Family>;
2627
} // namespace OCLRT

runtime/gen9/aub_command_stream_receiver_gen9.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ void populateFactoryTable<AUBCommandStreamReceiverHw<Family>>() {
2323
}
2424

2525
template class AUBCommandStreamReceiverHw<Family>;
26+
template class CommandStreamReceiverSimulatedCommonHw<Family>;
2627
} // namespace OCLRT

0 commit comments

Comments
 (0)