[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();
uint64_t getScratchPatchAddress();
void createScratchSpaceController(const HardwareInfo &hwInfoIn);
void createScratchSpaceController();
static void emitNoop(LinearStream &commandStream, size_t bytesToUpdate);

View File

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

View File

@ -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() {

View File

@ -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;

View File

@ -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;

View File

@ -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,