mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Check if KMD migration is supported
Related-To: NEO-3312 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
320a404a91
commit
049e77b235
@@ -214,7 +214,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideThreadArbitrationPolicy, -1, "-1 (dont o
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideAubDeviceId, -1, "-1 dont override, any other: use this value for AUB generation device id")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableTimestampPacket, -1, "-1: default, 0: disable, 1:enable. Write Timestamp Packet for each set of gpu walkers")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, AllocateSharedAllocationsWithCpuAndGpuStorage, -1, "When enabled driver creates cpu & gpu storage for shared unified memory allocations. (-1 - devices default mode, 0 - disable, 1 - enable)")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UseKmdMigration, -1, "-1: devices default mode (currently - disabled), 0: disable - pagefault handling by UMD using handler for SIGSEGV, 1: enable - pagefault handling by KMD, GEM objects migrated by KMD upon access)")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, UseKmdMigration, 0, "-1: devices default mode, 0: disable - pagefault handling by UMD using handler for SIGSEGV, 1: enable - pagefault handling by KMD, GEM objects migrated by KMD upon access)")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceSemaphoreDelayBetweenWaits, -1, "Specifies the minimum number of microseconds allowed for command streamer to wait before re-fetching the data. 0 - poll interval will be equal to the memory latency of the read completion")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceLocalMemoryAccessMode, -1, "-1: don't override, 0: default rules apply, 1: CPU can access local memory, 3: CPU never accesses local memory")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceUserptrAlignment, -1, "-1: no force (4kb), >0: n kb alignment")
|
||||
|
||||
@@ -129,6 +129,7 @@ class HwHelper {
|
||||
virtual bool isSipWANeeded(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool additionalKernelExecInfoSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
|
||||
static uint32_t getSubDevicesCount(const HardwareInfo *pHwInfo);
|
||||
static uint32_t getEnginesCount(const HardwareInfo &hwInfo);
|
||||
@@ -318,6 +319,8 @@ class HwHelperHw : public HwHelper {
|
||||
|
||||
bool isMediaBlockIOSupported(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
bool isCopyOnlyEngineType(EngineGroupType type) const override;
|
||||
|
||||
void adjustAddressWidthForCanonize(uint32_t &addressWidth) const override;
|
||||
|
||||
@@ -515,6 +515,11 @@ bool HwHelperHw<GfxFamily>::isMediaBlockIOSupported(const HardwareInfo &hwInfo)
|
||||
return hwInfo.capabilityTable.supportsImages;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isKmdMigrationSupported(const HardwareInfo &hwInfo) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isCopyOnlyEngineType(EngineGroupType type) const {
|
||||
return NEO::EngineGroupType::Copy == type;
|
||||
|
||||
@@ -145,6 +145,8 @@ class MemoryManager {
|
||||
bool isLocalMemorySupported(uint32_t rootDeviceIndex) const;
|
||||
virtual bool isMemoryBudgetExhausted() const;
|
||||
|
||||
virtual bool isKmdMigrationAvailable(uint32_t rootDeviceIndex) { return false; }
|
||||
|
||||
virtual AlignedMallocRestrictions *getAlignedMallocRestrictions() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -220,13 +220,9 @@ void *SVMAllocsManager::createSharedUnifiedMemoryAllocation(size_t size,
|
||||
}
|
||||
|
||||
if (supportDualStorageSharedMemory) {
|
||||
bool useKmdMigration = false;
|
||||
|
||||
if (DebugManager.flags.UseKmdMigration.get() != -1) {
|
||||
useKmdMigration = DebugManager.flags.UseKmdMigration.get();
|
||||
}
|
||||
|
||||
bool useKmdMigration = memoryManager->isKmdMigrationAvailable(*memoryProperties.rootDeviceIndices.begin());
|
||||
void *unifiedMemoryPointer = nullptr;
|
||||
|
||||
if (useKmdMigration) {
|
||||
unifiedMemoryPointer = createUnifiedKmdMigratedAllocation(size, {}, memoryProperties);
|
||||
if (!unifiedMemoryPointer) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -175,6 +175,20 @@ void DrmMemoryManager::releaseGpuRange(void *address, size_t unmapSize, uint32_t
|
||||
gfxPartition->freeGpuAddressRange(graphicsAddress, unmapSize);
|
||||
}
|
||||
|
||||
bool DrmMemoryManager::isKmdMigrationAvailable(uint32_t rootDeviceIndex) {
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
||||
auto &hwHelper = NEO::HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
|
||||
auto useKmdMigration = hwHelper.isKmdMigrationSupported(*hwInfo) &&
|
||||
this->getDrm(rootDeviceIndex).isVmBindAvailable();
|
||||
|
||||
if (DebugManager.flags.UseKmdMigration.get() != -1) {
|
||||
useKmdMigration = DebugManager.flags.UseKmdMigration.get();
|
||||
}
|
||||
|
||||
return useKmdMigration;
|
||||
}
|
||||
|
||||
NEO::BufferObject *DrmMemoryManager::allocUserptr(uintptr_t address, size_t size, uint64_t flags, uint32_t rootDeviceIndex) {
|
||||
drm_i915_gem_userptr userptr = {};
|
||||
userptr.user_ptr = address;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
* Copyright (C) 2017-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -62,6 +62,8 @@ class DrmMemoryManager : public MemoryManager {
|
||||
void freeGpuAddress(AddressRange addressRange, uint32_t rootDeviceIndex) override;
|
||||
MOCKABLE_VIRTUAL BufferObject *createBufferObjectInMemoryRegion(Drm *drm, uint64_t gpuAddress, size_t size, uint32_t memoryBanks, size_t maxOsContextCount);
|
||||
|
||||
bool isKmdMigrationAvailable(uint32_t rootDeviceIndex) override;
|
||||
|
||||
std::unique_lock<std::mutex> acquireAllocLock();
|
||||
std::vector<GraphicsAllocation *> &getSysMemAllocs();
|
||||
std::vector<GraphicsAllocation *> &getLocalMemAllocs(uint32_t rootDeviceIndex);
|
||||
|
||||
Reference in New Issue
Block a user