Files
compute-runtime/runtime/command_stream/scratch_space_controller.cpp
Stefanowski, Adam 73b8583759 [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>
2019-04-01 14:25:43 +02:00

35 lines
1.2 KiB
C++

/*
* Copyright (C) 2018-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/command_stream/scratch_space_controller.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/memory_manager/graphics_allocation.h"
#include "runtime/memory_manager/internal_allocation_storage.h"
#include "runtime/memory_manager/memory_manager.h"
namespace NEO {
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() {
if (scratchAllocation) {
getMemoryManager()->freeGraphicsMemory(scratchAllocation);
}
}
MemoryManager *ScratchSpaceController::getMemoryManager() const {
UNRECOVERABLE_IF(executionEnvironment.memoryManager.get() == nullptr);
return executionEnvironment.memoryManager.get();
}
} // namespace NEO