mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
Move hwInfo to root device environment
Related-To: NEO-3857 Change-Id: Ic23077cad080a249457cec39462ca7407e75b227 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
ac0edb9a5d
commit
e9c576393e
@@ -59,7 +59,7 @@ class Device : public ReferenceTrackedObject<Device> {
|
||||
const RootDeviceEnvironment &getRootDeviceEnvironment() const { return *executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]; }
|
||||
const HardwareCapabilities &getHardwareCapabilities() const { return hardwareCapabilities; }
|
||||
bool isFullRangeSvm() const {
|
||||
return executionEnvironment->isFullRangeSvm();
|
||||
return getRootDeviceEnvironment().isFullRangeSvm();
|
||||
}
|
||||
bool areSharedSystemAllocationsAllowed() const {
|
||||
return this->deviceInfo.sharedSystemMemCapabilities != 0u;
|
||||
|
||||
@@ -18,9 +18,7 @@
|
||||
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
ExecutionEnvironment::ExecutionEnvironment() {
|
||||
hwInfo = std::make_unique<HardwareInfo>();
|
||||
};
|
||||
ExecutionEnvironment::ExecutionEnvironment() = default;
|
||||
|
||||
ExecutionEnvironment::~ExecutionEnvironment() {
|
||||
debugger.reset();
|
||||
@@ -33,10 +31,6 @@ ExecutionEnvironment::~ExecutionEnvironment() {
|
||||
rootDeviceEnvironments.clear();
|
||||
}
|
||||
|
||||
void ExecutionEnvironment::setHwInfo(const HardwareInfo *hwInfo) {
|
||||
*this->hwInfo = *hwInfo;
|
||||
}
|
||||
|
||||
void ExecutionEnvironment::initializeMemoryManager() {
|
||||
if (this->memoryManager) {
|
||||
return;
|
||||
@@ -63,7 +57,7 @@ void ExecutionEnvironment::initializeMemoryManager() {
|
||||
}
|
||||
|
||||
void ExecutionEnvironment::initDebugger() {
|
||||
debugger = Debugger::create(hwInfo.get());
|
||||
debugger = Debugger::create(rootDeviceEnvironments[0]->getMutableHardwareInfo());
|
||||
}
|
||||
|
||||
void ExecutionEnvironment::calculateMaxOsContextCount() {
|
||||
@@ -78,10 +72,6 @@ void ExecutionEnvironment::calculateMaxOsContextCount() {
|
||||
}
|
||||
}
|
||||
|
||||
bool ExecutionEnvironment::isFullRangeSvm() const {
|
||||
return hwInfo->capabilityTable.gpuAddressSpace >= maxNBitValue(47);
|
||||
}
|
||||
|
||||
void ExecutionEnvironment::prepareRootDeviceEnvironments(uint32_t numRootDevices) {
|
||||
if (rootDeviceEnvironments.size() < numRootDevices) {
|
||||
rootDeviceEnvironments.resize(numRootDevices);
|
||||
|
||||
@@ -14,13 +14,9 @@ namespace NEO {
|
||||
class MemoryManager;
|
||||
class Debugger;
|
||||
struct RootDeviceEnvironment;
|
||||
struct HardwareInfo;
|
||||
|
||||
class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment> {
|
||||
|
||||
protected:
|
||||
std::unique_ptr<HardwareInfo> hwInfo;
|
||||
|
||||
public:
|
||||
ExecutionEnvironment();
|
||||
~ExecutionEnvironment() override;
|
||||
@@ -28,10 +24,6 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
|
||||
void initializeMemoryManager();
|
||||
void initDebugger();
|
||||
void calculateMaxOsContextCount();
|
||||
void setHwInfo(const HardwareInfo *hwInfo);
|
||||
const HardwareInfo *getHardwareInfo() const { return hwInfo.get(); }
|
||||
HardwareInfo *getMutableHardwareInfo() const { return hwInfo.get(); }
|
||||
bool isFullRangeSvm() const;
|
||||
void prepareRootDeviceEnvironments(uint32_t numRootDevices);
|
||||
|
||||
std::unique_ptr<MemoryManager> memoryManager;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "shared/source/execution_environment/execution_environment.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/gmm_helper/page_table_mngr.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/memory_manager/memory_operations_handler.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
@@ -20,7 +21,10 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
RootDeviceEnvironment::RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment) : executionEnvironment(executionEnvironment) {}
|
||||
RootDeviceEnvironment::RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment) : executionEnvironment(executionEnvironment) {
|
||||
hwInfo = std::make_unique<HardwareInfo>();
|
||||
}
|
||||
|
||||
RootDeviceEnvironment::~RootDeviceEnvironment() = default;
|
||||
|
||||
void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
|
||||
@@ -29,7 +33,19 @@ void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::st
|
||||
}
|
||||
}
|
||||
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {
|
||||
return executionEnvironment.getHardwareInfo();
|
||||
return hwInfo.get();
|
||||
}
|
||||
|
||||
HardwareInfo *RootDeviceEnvironment::getMutableHardwareInfo() const {
|
||||
return hwInfo.get();
|
||||
}
|
||||
|
||||
void RootDeviceEnvironment::setHwInfo(const HardwareInfo *hwInfo) {
|
||||
*this->hwInfo = *hwInfo;
|
||||
}
|
||||
|
||||
bool RootDeviceEnvironment::isFullRangeSvm() const {
|
||||
return hwInfo->capabilityTable.gpuAddressSpace >= maxNBitValue(47);
|
||||
}
|
||||
|
||||
GmmHelper *RootDeviceEnvironment::getGmmHelper() const {
|
||||
|
||||
@@ -28,10 +28,18 @@ struct HardwareInfo;
|
||||
class HwDeviceId;
|
||||
|
||||
struct RootDeviceEnvironment {
|
||||
protected:
|
||||
std::unique_ptr<HardwareInfo> hwInfo;
|
||||
|
||||
public:
|
||||
RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment);
|
||||
RootDeviceEnvironment(RootDeviceEnvironment &) = delete;
|
||||
MOCKABLE_VIRTUAL ~RootDeviceEnvironment();
|
||||
|
||||
MOCKABLE_VIRTUAL const HardwareInfo *getHardwareInfo() const;
|
||||
HardwareInfo *getMutableHardwareInfo() const;
|
||||
void setHwInfo(const HardwareInfo *hwInfo);
|
||||
bool isFullRangeSvm() const;
|
||||
|
||||
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
|
||||
bool initOsInterface(std::unique_ptr<HwDeviceId> &&hwDeviceId);
|
||||
|
||||
@@ -513,6 +513,19 @@ bool MemoryManager::isHostPointerTrackingEnabled(uint32_t rootDeviceIndex) {
|
||||
return (peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->capabilityTable.hostPtrTrackingEnabled | is32bit);
|
||||
}
|
||||
|
||||
bool MemoryManager::useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex) {
|
||||
bool isExternalHostPtrAlloc = (allocationType == GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR);
|
||||
bool isMapAlloc = (allocationType == GraphicsAllocation::AllocationType::MAP_ALLOCATION);
|
||||
|
||||
if (forceNonSvmForExternalHostPtr && isExternalHostPtrAlloc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isNonSvmPtrCapable = ((!peekExecutionEnvironment().rootDeviceEnvironments[rootDeviceIndex]->isFullRangeSvm() || !isHostPointerTrackingEnabled(rootDeviceIndex)) & !is32bit);
|
||||
|
||||
return isNonSvmPtrCapable && (isExternalHostPtrAlloc || isMapAlloc);
|
||||
}
|
||||
|
||||
bool MemoryManager::isCopyRequired(ImageInfo &imgInfo, const void *hostPtr) {
|
||||
if (!hostPtr) {
|
||||
return false;
|
||||
|
||||
@@ -205,18 +205,7 @@ class MemoryManager {
|
||||
}
|
||||
static bool isCopyRequired(ImageInfo &imgInfo, const void *hostPtr);
|
||||
|
||||
bool useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex) {
|
||||
bool isExternalHostPtrAlloc = (allocationType == GraphicsAllocation::AllocationType::EXTERNAL_HOST_PTR);
|
||||
bool isMapAlloc = (allocationType == GraphicsAllocation::AllocationType::MAP_ALLOCATION);
|
||||
|
||||
if (forceNonSvmForExternalHostPtr && isExternalHostPtrAlloc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isNonSvmPtrCapable = ((!peekExecutionEnvironment().isFullRangeSvm() || !isHostPointerTrackingEnabled(rootDeviceIndex)) & !is32bit);
|
||||
|
||||
return isNonSvmPtrCapable && (isExternalHostPtrAlloc || isMapAlloc);
|
||||
}
|
||||
bool useNonSvmHostPtrAlloc(GraphicsAllocation::AllocationType allocationType, uint32_t rootDeviceIndex);
|
||||
StorageInfo createStorageInfoFromProperties(const AllocationProperties &properties);
|
||||
|
||||
virtual GraphicsAllocation *createGraphicsAllocation(OsHandleStorage &handleStorage, const AllocationData &allocationData) = 0;
|
||||
|
||||
@@ -37,39 +37,39 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, Execu
|
||||
uint64_t hwInfoConfig = 0x0;
|
||||
DebugManager.getHardwareInfoOverride(hwInfoConfigStr);
|
||||
|
||||
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
||||
*hardwareInfo = *hwInfoConst;
|
||||
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
||||
auto hardwareInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo();
|
||||
*hardwareInfo = *hwInfoConst;
|
||||
|
||||
if (hwInfoConfigStr == "default") {
|
||||
hwInfoConfig = defaultHardwareInfoConfigTable[hwInfoConst->platform.eProductFamily];
|
||||
} else if (!parseHwInfoConfigString(hwInfoConfigStr, hwInfoConfig)) {
|
||||
return false;
|
||||
}
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, *hardwareInfo);
|
||||
if (hwInfoConfigStr == "default") {
|
||||
hwInfoConfig = defaultHardwareInfoConfigTable[hwInfoConst->platform.eProductFamily];
|
||||
} else if (!parseHwInfoConfigString(hwInfoConfigStr, hwInfoConfig)) {
|
||||
return false;
|
||||
}
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, *hardwareInfo);
|
||||
|
||||
hardwareInfoSetup[hwInfoConst->platform.eProductFamily](hardwareInfo, true, hwInfoConfig);
|
||||
hardwareInfoSetup[hwInfoConst->platform.eProductFamily](hardwareInfo, true, hwInfoConfig);
|
||||
|
||||
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->platform.eProductFamily);
|
||||
hardwareInfo->featureTable.ftrE2ECompression = 0;
|
||||
hwConfig->configureHardwareCustom(hardwareInfo, nullptr);
|
||||
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->platform.eProductFamily);
|
||||
hardwareInfo->featureTable.ftrE2ECompression = 0;
|
||||
hwConfig->configureHardwareCustom(hardwareInfo, nullptr);
|
||||
|
||||
executionEnvironment.calculateMaxOsContextCount();
|
||||
numDevices = numRootDevices;
|
||||
auto csrType = DebugManager.flags.SetCommandStreamReceiver.get();
|
||||
if (csrType > 0) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo->platform.eRenderCoreFamily);
|
||||
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo);
|
||||
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
||||
auto csrType = DebugManager.flags.SetCommandStreamReceiver.get();
|
||||
if (csrType > 0) {
|
||||
auto &hwHelper = HwHelper::get(hardwareInfo->platform.eRenderCoreFamily);
|
||||
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo);
|
||||
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csrType));
|
||||
auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get();
|
||||
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<AubMemoryOperationsHandler>(aubCenter->getAubManager());
|
||||
}
|
||||
|
||||
if (DebugManager.flags.OverrideGpuAddressSpace.get() != -1) {
|
||||
hardwareInfo->capabilityTable.gpuAddressSpace = maxNBitValue(static_cast<uint64_t>(DebugManager.flags.OverrideGpuAddressSpace.get()));
|
||||
}
|
||||
}
|
||||
|
||||
if (DebugManager.flags.OverrideGpuAddressSpace.get() != -1) {
|
||||
executionEnvironment.getMutableHardwareInfo()->capabilityTable.gpuAddressSpace =
|
||||
maxNBitValue(static_cast<uint64_t>(DebugManager.flags.OverrideGpuAddressSpace.get()));
|
||||
}
|
||||
executionEnvironment.calculateMaxOsContextCount();
|
||||
numDevices = numRootDevices;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -104,16 +104,16 @@ bool DeviceFactory::getDevices(size_t &totalNumRootDevices, ExecutionEnvironment
|
||||
return false;
|
||||
}
|
||||
|
||||
if (DebugManager.flags.OverrideGpuAddressSpace.get() != -1) {
|
||||
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo()->capabilityTable.gpuAddressSpace =
|
||||
maxNBitValue(static_cast<uint64_t>(DebugManager.flags.OverrideGpuAddressSpace.get()));
|
||||
}
|
||||
|
||||
rootDeviceIndex++;
|
||||
}
|
||||
|
||||
executionEnvironment.calculateMaxOsContextCount();
|
||||
|
||||
if (DebugManager.flags.OverrideGpuAddressSpace.get() != -1) {
|
||||
executionEnvironment.getMutableHardwareInfo()->capabilityTable.gpuAddressSpace =
|
||||
maxNBitValue(static_cast<uint64_t>(DebugManager.flags.OverrideGpuAddressSpace.get()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ bool RootDeviceEnvironment::initOsInterface(std::unique_ptr<HwDeviceId> &&hwDevi
|
||||
memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
|
||||
osInterface.reset(new OSInterface());
|
||||
osInterface->get()->setDrm(drm);
|
||||
auto hardwareInfo = executionEnvironment.getMutableHardwareInfo();
|
||||
auto hardwareInfo = getMutableHardwareInfo();
|
||||
HwInfoConfig *hwConfig = HwInfoConfig::get(hardwareInfo->platform.eProductFamily);
|
||||
if (hwConfig->configureHwInfo(hardwareInfo, hardwareInfo, osInterface.get())) {
|
||||
return false;
|
||||
|
||||
@@ -110,7 +110,7 @@ bool Wddm::init() {
|
||||
}
|
||||
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*hardwareInfo);
|
||||
rootDeviceEnvironment.executionEnvironment.setHwInfo(hardwareInfo.get());
|
||||
rootDeviceEnvironment.setHwInfo(hardwareInfo.get());
|
||||
rootDeviceEnvironment.initGmm();
|
||||
|
||||
if (WddmVersion::WDDM_2_3 == getWddmVersion()) {
|
||||
|
||||
@@ -506,8 +506,8 @@ bool WddmMemoryManager::createWddmAllocation(WddmAllocation *allocation, void *r
|
||||
|
||||
bool WddmMemoryManager::mapGpuVaForOneHandleAllocation(WddmAllocation *allocation, const void *preferredGpuVirtualAddress) {
|
||||
D3DGPU_VIRTUAL_ADDRESS addressToMap = castToUint64(preferredGpuVirtualAddress);
|
||||
auto heapIndex = selectHeap(allocation, preferredGpuVirtualAddress != nullptr, is32bit || executionEnvironment.isFullRangeSvm());
|
||||
if (!executionEnvironment.isFullRangeSvm()) {
|
||||
auto heapIndex = selectHeap(allocation, preferredGpuVirtualAddress != nullptr, is32bit || executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()]->isFullRangeSvm());
|
||||
if (!executionEnvironment.rootDeviceEnvironments[allocation->getRootDeviceIndex()]->isFullRangeSvm()) {
|
||||
addressToMap = 0u;
|
||||
}
|
||||
if (allocation->reservedGpuVirtualAddress) {
|
||||
|
||||
Reference in New Issue
Block a user