From 73b8583759fa3f2f687c657facba59e4081a812a Mon Sep 17 00:00:00 2001 From: "Stefanowski, Adam" Date: Fri, 29 Mar 2019 00:49:23 +0100 Subject: [PATCH] [4/n] Move Hardware Info to Execution Environment - remove hwInfo from ScratchSpaceController, pass it by ExecutionEnvironment Change-Id: I4d83e581560b8a56a51e09d0e2b8397fee59dc22 Signed-off-by: Adam Stefanowski --- runtime/command_stream/command_stream_receiver_hw.h | 2 +- runtime/command_stream/command_stream_receiver_hw.inl | 6 +++--- runtime/command_stream/scratch_space_controller.cpp | 9 +++++---- runtime/command_stream/scratch_space_controller.h | 3 +-- runtime/command_stream/scratch_space_controller_base.cpp | 9 +++++---- runtime/command_stream/scratch_space_controller_base.h | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/runtime/command_stream/command_stream_receiver_hw.h b/runtime/command_stream/command_stream_receiver_hw.h index 4a172ab438..5c4cc1b345 100644 --- a/runtime/command_stream/command_stream_receiver_hw.h +++ b/runtime/command_stream/command_stream_receiver_hw.h @@ -87,7 +87,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver { size_t getSshHeapSize(); uint64_t getScratchPatchAddress(); - void createScratchSpaceController(const HardwareInfo &hwInfoIn); + void createScratchSpaceController(); static void emitNoop(LinearStream &commandStream, size_t bytesToUpdate); diff --git a/runtime/command_stream/command_stream_receiver_hw.inl b/runtime/command_stream/command_stream_receiver_hw.inl index c73c05cd97..2e49486508 100644 --- a/runtime/command_stream/command_stream_receiver_hw.inl +++ b/runtime/command_stream/command_stream_receiver_hw.inl @@ -53,7 +53,7 @@ CommandStreamReceiverHw::CommandStreamReceiverHw(ExecutionEnvironment if (DebugManager.flags.EnableTimestampPacket.get() != -1) { timestampPacketWriteEnabled = !!DebugManager.flags.EnableTimestampPacket.get(); } - createScratchSpaceController(peekHwInfo()); + createScratchSpaceController(); } template @@ -761,8 +761,8 @@ void CommandStreamReceiverHw::addClearSLMWorkAround(typename GfxFamil } template -void CommandStreamReceiverHw::createScratchSpaceController(const HardwareInfo &hwInfoIn) { - scratchSpaceController = std::make_unique(hwInfoIn, executionEnvironment, *internalAllocationStorage.get()); +void CommandStreamReceiverHw::createScratchSpaceController() { + scratchSpaceController = std::make_unique(executionEnvironment, *internalAllocationStorage.get()); } template diff --git a/runtime/command_stream/scratch_space_controller.cpp b/runtime/command_stream/scratch_space_controller.cpp index b39cb8f952..345e3dd044 100644 --- a/runtime/command_stream/scratch_space_controller.cpp +++ b/runtime/command_stream/scratch_space_controller.cpp @@ -14,10 +14,11 @@ #include "runtime/memory_manager/memory_manager.h" namespace NEO { -ScratchSpaceController::ScratchSpaceController(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage) - : hwInfo(info), executionEnvironment(environment), csrAllocationStorage(allocationStorage) { - auto &hwHelper = HwHelper::get(info.pPlatform->eRenderCoreFamily); - computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(&hwInfo); +ScratchSpaceController::ScratchSpaceController(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage) + : executionEnvironment(environment), csrAllocationStorage(allocationStorage) { + auto hwInfo = executionEnvironment.getHardwareInfo(); + auto &hwHelper = HwHelper::get(hwInfo->pPlatform->eRenderCoreFamily); + computeUnitsUsedForScratch = hwHelper.getComputeUnitsUsedForScratch(hwInfo); } ScratchSpaceController::~ScratchSpaceController() { diff --git a/runtime/command_stream/scratch_space_controller.h b/runtime/command_stream/scratch_space_controller.h index d90c856497..38be664b88 100644 --- a/runtime/command_stream/scratch_space_controller.h +++ b/runtime/command_stream/scratch_space_controller.h @@ -22,7 +22,7 @@ struct HardwareInfo; class ScratchSpaceController { public: - ScratchSpaceController(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage); + ScratchSpaceController(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage); virtual ~ScratchSpaceController(); GraphicsAllocation *getScratchSpaceAllocation() { @@ -42,7 +42,6 @@ class ScratchSpaceController { protected: MemoryManager *getMemoryManager() const; - const HardwareInfo &hwInfo; ExecutionEnvironment &executionEnvironment; GraphicsAllocation *scratchAllocation = nullptr; InternalAllocationStorage &csrAllocationStorage; diff --git a/runtime/command_stream/scratch_space_controller_base.cpp b/runtime/command_stream/scratch_space_controller_base.cpp index 088b7ffb7f..09c59daf74 100644 --- a/runtime/command_stream/scratch_space_controller_base.cpp +++ b/runtime/command_stream/scratch_space_controller_base.cpp @@ -7,6 +7,7 @@ #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/hw_helper.h" #include "runtime/helpers/preamble.h" @@ -16,8 +17,8 @@ #include "runtime/memory_manager/memory_manager.h" namespace NEO { -ScratchSpaceControllerBase::ScratchSpaceControllerBase(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage) - : ScratchSpaceController(info, environment, allocationStorage) { +ScratchSpaceControllerBase::ScratchSpaceControllerBase(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage) + : ScratchSpaceController(environment, allocationStorage) { } void ScratchSpaceControllerBase::setRequiredScratchSpace(void *sshBaseAddress, @@ -48,7 +49,7 @@ void ScratchSpaceControllerBase::createScratchSpaceAllocation() { } uint64_t ScratchSpaceControllerBase::calculateNewGSH() { - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform->eRenderCoreFamily); auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit(); return scratchAllocation->getGpuAddress() - scratchSpaceOffsetFor64bit; } @@ -60,7 +61,7 @@ uint64_t ScratchSpaceControllerBase::getScratchPatchAddress() { if (scratchAllocation) { scratchAddress = scratchAllocation->getGpuAddressToPatch(); if (is64bit && !getMemoryManager()->peekForce32BitAllocations()) { - auto &hwHelper = HwHelper::get(hwInfo.pPlatform->eRenderCoreFamily); + auto &hwHelper = HwHelper::get(executionEnvironment.getHardwareInfo()->pPlatform->eRenderCoreFamily); auto scratchSpaceOffsetFor64bit = hwHelper.getScratchSpaceOffsetFor64bit(); //this is to avoid scractch allocation offset "0" scratchAddress = scratchSpaceOffsetFor64bit; diff --git a/runtime/command_stream/scratch_space_controller_base.h b/runtime/command_stream/scratch_space_controller_base.h index dfcc579b6c..a0f4599ec9 100644 --- a/runtime/command_stream/scratch_space_controller_base.h +++ b/runtime/command_stream/scratch_space_controller_base.h @@ -12,7 +12,7 @@ namespace NEO { class ScratchSpaceControllerBase : public ScratchSpaceController { public: - ScratchSpaceControllerBase(const HardwareInfo &info, ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage); + ScratchSpaceControllerBase(ExecutionEnvironment &environment, InternalAllocationStorage &allocationStorage); void setRequiredScratchSpace(void *sshBaseAddress, uint32_t requiredPerThreadScratchSize,