[4/n] Move Hardware Info to Execution Environment

- remove hwInfo from ScratchSpaceController, pass it by
ExecutionEnvironment

Change-Id: I4d83e581560b8a56a51e09d0e2b8397fee59dc22
Signed-off-by: Adam Stefanowski <adam.stefanowski@intel.com>
This commit is contained in:
Stefanowski, Adam 2019-03-29 00:49:23 +01:00 committed by sys_ocldev
parent 17493426c1
commit 73b8583759
6 changed files with 16 additions and 15 deletions

View File

@ -87,7 +87,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
size_t getSshHeapSize(); size_t getSshHeapSize();
uint64_t getScratchPatchAddress(); uint64_t getScratchPatchAddress();
void createScratchSpaceController(const HardwareInfo &hwInfoIn); void createScratchSpaceController();
static void emitNoop(LinearStream &commandStream, size_t bytesToUpdate); static void emitNoop(LinearStream &commandStream, size_t bytesToUpdate);

View File

@ -53,7 +53,7 @@ CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(ExecutionEnvironment
if (DebugManager.flags.EnableTimestampPacket.get() != -1) { if (DebugManager.flags.EnableTimestampPacket.get() != -1) {
timestampPacketWriteEnabled = !!DebugManager.flags.EnableTimestampPacket.get(); timestampPacketWriteEnabled = !!DebugManager.flags.EnableTimestampPacket.get();
} }
createScratchSpaceController(peekHwInfo()); createScratchSpaceController();
} }
template <typename GfxFamily> template <typename GfxFamily>
@ -761,8 +761,8 @@ void CommandStreamReceiverHw<GfxFamily>::addClearSLMWorkAround(typename GfxFamil
} }
template <typename GfxFamily> template <typename GfxFamily>
void CommandStreamReceiverHw<GfxFamily>::createScratchSpaceController(const HardwareInfo &hwInfoIn) { void CommandStreamReceiverHw<GfxFamily>::createScratchSpaceController() {
scratchSpaceController = std::make_unique<ScratchSpaceControllerBase>(hwInfoIn, executionEnvironment, *internalAllocationStorage.get()); scratchSpaceController = std::make_unique<ScratchSpaceControllerBase>(executionEnvironment, *internalAllocationStorage.get());
} }
template <typename GfxFamily> template <typename GfxFamily>

View File

@ -14,10 +14,11 @@
#include "runtime/memory_manager/memory_manager.h" #include "runtime/memory_manager/memory_manager.h"
namespace NEO { namespace NEO {
ScratchSpaceController::ScratchSpaceController(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage) ScratchSpaceController::ScratchSpaceController(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
: hwInfo(info), executionEnvironment(environment), csrAllocationStorage(allocationStorage) { : executionEnvironment(environment), csrAllocationStorage(allocationStorage) {
auto &hwHelper = HwHelper::get(info.pPlatform->eRenderCoreFamily); auto hwInfo = executionEnvironment.getHardwareInfo();
computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(&hwInfo); auto &hwHelper = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily);
computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(hwInfo);
} }
ScratchSpaceController::~ScratchSpaceController() { ScratchSpaceController::~ScratchSpaceController() {

View File

@ -22,7 +22,7 @@ struct HardwareInfo;
class ScratchSpaceController { class ScratchSpaceController {
public: public:
ScratchSpaceController(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage); ScratchSpaceController(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
virtual ~ScratchSpaceController(); virtual ~ScratchSpaceController();
GraphicsAllocation *getScratchSpaceAllocation() { GraphicsAllocation *getScratchSpaceAllocation() {
@ -42,7 +42,6 @@ class ScratchSpaceController {
protected: protected:
MemoryManager *getMemoryManager() const; MemoryManager *getMemoryManager() const;
const HardwareInfo &hwInfo;
ExecutionEnvironment &executionEnvironment; ExecutionEnvironment &executionEnvironment;
GraphicsAllocation *scratchAllocation = nullptr; GraphicsAllocation *scratchAllocation = nullptr;
InternalAllocationStorage &csrAllocationStorage; InternalAllocationStorage &csrAllocationStorage;

View File

@ -7,6 +7,7 @@
#include "runtime/command_stream/scratch_space_controller_base.h" #include "runtime/command_stream/scratch_space_controller_base.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/aligned_memory.h" #include "runtime/helpers/aligned_memory.h"
#include "runtime/helpers/hw_helper.h" #include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/preamble.h" #include "runtime/helpers/preamble.h"
@ -16,8 +17,8 @@
#include "runtime/memory_manager/memory_manager.h" #include "runtime/memory_manager/memory_manager.h"
namespace NEO { namespace NEO {
ScratchSpaceControllerBase::ScratchSpaceControllerBase(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage) ScratchSpaceControllerBase::ScratchSpaceControllerBase(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage)
: ScratchSpaceController(info, environment, allocationStorage) { : ScratchSpaceController(environment, allocationStorage) {
} }
void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress, void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress,
@ -48,7 +49,7 @@ void ScratchSpaceControllerBase::createScratchSpaceAllocation() {
} }
uint64_t ScratchSpaceControllerBase::calculateNewGSH() { uint64_t ScratchSpaceControllerBase::calculateNewGSH() {
auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform->eRenderCoreFamily);
auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit(); auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit();
return scratchAllocation->getGpuAddress() - scratchSpaceOffsetFor64bit; return scratchAllocation->getGpuAddress() - scratchSpaceOffsetFor64bit;
} }
@ -60,7 +61,7 @@ uint64_t ScratchSpaceControllerBase::getScratchPatchAddress() {
if (scratchAllocation) { if (scratchAllocation) {
scratchAddress = scratchAllocation->getGpuAddressToPatch(); scratchAddress = scratchAllocation->getGpuAddressToPatch();
if (is64bit && !getMemoryManager()->peekForce32BitAllocations()) { if (is64bit && !getMemoryManager()->peekForce32BitAllocations()) {
auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform->eRenderCoreFamily);
auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit(); auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit();
//this is to avoid scractch allocation offset "0" //this is to avoid scractch allocation offset "0"
scratchAddress = scratchSpaceOffsetFor64bit; scratchAddress = scratchSpaceOffsetFor64bit;

View File

@ -12,7 +12,7 @@ namespace NEO {
class ScratchSpaceControllerBase : public ScratchSpaceController { class ScratchSpaceControllerBase : public ScratchSpaceController {
public: public:
ScratchSpaceControllerBase(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage); ScratchSpaceControllerBase(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage);
void setRequiredScratchSpace(void *sshBaseAddress, void setRequiredScratchSpace(void *sshBaseAddress,
uint32_t requiredPerThreadScratchSize, uint32_t requiredPerThreadScratchSize,