mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Revert "feature: support explicit memory locking"
This reverts commit 27a3307bb0.
Signed-off-by: Young Jin Yoon <young.jin.yoon@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e44ac2a001
commit
068f6a25c6
@@ -209,9 +209,6 @@ class BufferObject {
|
||||
std::vector<uint64_t> &getColourAddresses() {
|
||||
return this->bindAddresses;
|
||||
}
|
||||
void requireExplicitLockedMemory(bool locked) { requiresLocked = locked; }
|
||||
bool isExplicitLockedMemoryRequired() { return requiresLocked; }
|
||||
|
||||
uint64_t peekPatIndex() const { return patIndex; }
|
||||
void setPatIndex(uint64_t newPatIndex) { this->patIndex = newPatIndex; }
|
||||
BOType peekBOType() const { return boType; }
|
||||
@@ -261,7 +258,6 @@ class BufferObject {
|
||||
bool allowCapture = false;
|
||||
bool requiresImmediateBinding = false;
|
||||
bool requiresExplicitResidency = false;
|
||||
bool requiresLocked = false;
|
||||
bool chunked = false;
|
||||
bool isReused = false;
|
||||
};
|
||||
|
||||
@@ -39,13 +39,6 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResident(Device *devi
|
||||
return result;
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
|
||||
for (auto gfxAllocation = gfxAllocations.begin(); gfxAllocation != gfxAllocations.end(); gfxAllocation++) {
|
||||
(*gfxAllocation)->setLockedMemory(true);
|
||||
}
|
||||
return makeResident(device, gfxAllocations);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) {
|
||||
auto deviceBitfield = osContext->getDeviceBitfield();
|
||||
|
||||
@@ -66,12 +59,12 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsConte
|
||||
}
|
||||
|
||||
if (!bo->getBindInfo()[bo->getOsContextId(osContext)][drmIterator]) {
|
||||
bo->requireExplicitLockedMemory(drmAllocation->isLockedMemory());
|
||||
int result = drmAllocation->makeBOsResident(osContext, drmIterator, nullptr, true);
|
||||
if (result) {
|
||||
return MemoryOperationsStatus::outOfMemory;
|
||||
}
|
||||
}
|
||||
|
||||
if (!evictable) {
|
||||
drmAllocation->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, osContext->getContextId());
|
||||
}
|
||||
@@ -84,7 +77,6 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::makeResidentWithinOsConte
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerBind::evict(Device *device, GraphicsAllocation &gfxAllocation) {
|
||||
auto &engines = device->getAllEngines();
|
||||
auto retVal = MemoryOperationsStatus::success;
|
||||
gfxAllocation.setLockedMemory(false);
|
||||
for (const auto &engine : engines) {
|
||||
retVal = this->evictWithinOsContext(engine.osContext, gfxAllocation);
|
||||
if (retVal != MemoryOperationsStatus::success) {
|
||||
@@ -193,10 +185,7 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::evictUnusedAllocationsImp
|
||||
evict = false;
|
||||
break;
|
||||
}
|
||||
if (allocation->isLockedMemory()) {
|
||||
evict = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (waitForCompletion) {
|
||||
const auto waitStatus = engine.commandStreamReceiver->waitForCompletionWithTimeout(WaitParams{false, false, 0}, engine.commandStreamReceiver->peekLatestFlushedTaskCount());
|
||||
if (waitStatus == WaitStatus::gpuHang) {
|
||||
|
||||
@@ -18,7 +18,6 @@ class DrmMemoryOperationsHandlerBind : public DrmMemoryOperationsHandler {
|
||||
|
||||
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override;
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override;
|
||||
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#include "shared/source/os_interface/linux/drm_memory_operations_handler_default.h"
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/os_interface/linux/drm_allocation.h"
|
||||
#include "shared/source/os_interface/linux/drm_buffer_object.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@@ -31,18 +29,6 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::makeResident(Device *d
|
||||
return this->makeResidentWithinOsContext(osContext, gfxAllocations, false);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) {
|
||||
OsContext *osContext = nullptr;
|
||||
for (auto gfxAllocation = gfxAllocations.begin(); gfxAllocation != gfxAllocations.end(); gfxAllocation++) {
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(*gfxAllocation);
|
||||
drmAllocation->setLockedMemory(true);
|
||||
for (auto bo : drmAllocation->getBOs()) {
|
||||
bo->requireExplicitLockedMemory(true);
|
||||
}
|
||||
}
|
||||
return this->makeResidentWithinOsContext(osContext, gfxAllocations, false);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) {
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
this->residency.erase(&gfxAllocation);
|
||||
@@ -51,16 +37,6 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::evictWithinOsContext(O
|
||||
|
||||
MemoryOperationsStatus DrmMemoryOperationsHandlerDefault::evict(Device *device, GraphicsAllocation &gfxAllocation) {
|
||||
OsContext *osContext = nullptr;
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(&gfxAllocation);
|
||||
drmAllocation->setLockedMemory(false);
|
||||
if (drmAllocation->storageInfo.isChunked || drmAllocation->storageInfo.getNumBanks() == 1) {
|
||||
auto bo = drmAllocation->getBO();
|
||||
bo->requireExplicitLockedMemory(false);
|
||||
} else {
|
||||
for (auto bo : drmAllocation->getBOs()) {
|
||||
bo->requireExplicitLockedMemory(false);
|
||||
}
|
||||
}
|
||||
return this->evictWithinOsContext(osContext, gfxAllocation);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ class DrmMemoryOperationsHandlerDefault : public DrmMemoryOperationsHandler {
|
||||
|
||||
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override;
|
||||
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override;
|
||||
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override;
|
||||
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
|
||||
@@ -41,11 +41,6 @@ class DrmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
|
||||
return BaseOperationsHandler::makeResident(device, gfxAllocations);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
|
||||
aubMemoryOperationsHandler->makeResident(device, gfxAllocations);
|
||||
return BaseOperationsHandler::lock(device, gfxAllocations);
|
||||
}
|
||||
|
||||
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override {
|
||||
aubMemoryOperationsHandler->evict(device, gfxAllocation);
|
||||
return BaseOperationsHandler::evict(device, gfxAllocation);
|
||||
|
||||
@@ -1313,8 +1313,7 @@ int changeBufferObjectBinding(Drm *drm, OsContext *osContext, uint32_t vmHandleI
|
||||
bindMakeResident = bo->isExplicitResidencyRequired();
|
||||
bindImmediate = true;
|
||||
}
|
||||
bool bindLock = bo->isExplicitLockedMemoryRequired();
|
||||
flags |= ioctlHelper->getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident, bindLock);
|
||||
flags |= ioctlHelper->getFlagsForVmBind(bindCapture, bindImmediate, bindMakeResident);
|
||||
}
|
||||
|
||||
auto &bindAddresses = bo->getColourAddresses();
|
||||
|
||||
@@ -115,7 +115,7 @@ class IoctlHelper {
|
||||
virtual bool getGemTiling(void *setTiling) = 0;
|
||||
virtual uint32_t getDirectSubmissionFlag() = 0;
|
||||
virtual std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) = 0;
|
||||
virtual uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool bindLockedMemory) = 0;
|
||||
virtual uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) = 0;
|
||||
virtual int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) = 0;
|
||||
virtual uint16_t getWaitUserFenceSoftFlag() = 0;
|
||||
virtual int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) = 0;
|
||||
@@ -257,7 +257,7 @@ class IoctlHelperUpstream : public IoctlHelperI915 {
|
||||
bool setVmPrefetch(uint64_t start, uint64_t length, uint32_t region, uint32_t vmId) override;
|
||||
uint32_t getDirectSubmissionFlag() override;
|
||||
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool bindLockedMemory) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
||||
int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
uint16_t getWaitUserFenceSoftFlag() override;
|
||||
int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override;
|
||||
@@ -334,7 +334,7 @@ class IoctlHelperPrelim20 : public IoctlHelperI915 {
|
||||
bool setVmPrefetch(uint64_t start, uint64_t length, uint32_t region, uint32_t vmId) override;
|
||||
uint32_t getDirectSubmissionFlag() override;
|
||||
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool bindLockedMemory) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
||||
int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
uint16_t getWaitUserFenceSoftFlag() override;
|
||||
int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override;
|
||||
|
||||
@@ -503,7 +503,7 @@ std::unique_ptr<uint8_t[]> IoctlHelperPrelim20::prepareVmBindExt(const StackVec<
|
||||
return extensionsBuffer;
|
||||
}
|
||||
|
||||
uint64_t IoctlHelperPrelim20::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool bindLockedMemory) {
|
||||
uint64_t IoctlHelperPrelim20::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) {
|
||||
uint64_t flags = 0u;
|
||||
if (bindCapture) {
|
||||
flags |= PRELIM_I915_GEM_VM_BIND_CAPTURE;
|
||||
@@ -511,7 +511,7 @@ uint64_t IoctlHelperPrelim20::getFlagsForVmBind(bool bindCapture, bool bindImmed
|
||||
if (bindImmediate) {
|
||||
flags |= PRELIM_I915_GEM_VM_BIND_IMMEDIATE;
|
||||
}
|
||||
if (bindMakeResident || bindLockedMemory) { // lockedMemory is equal to residency in i915_prelim
|
||||
if (bindMakeResident) {
|
||||
flags |= PRELIM_I915_GEM_VM_BIND_MAKE_RESIDENT;
|
||||
}
|
||||
return flags;
|
||||
|
||||
@@ -168,7 +168,7 @@ std::unique_ptr<uint8_t[]> IoctlHelperUpstream::prepareVmBindExt(const StackVec<
|
||||
return {};
|
||||
}
|
||||
|
||||
uint64_t IoctlHelperUpstream::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool bindLockedMemory) {
|
||||
uint64_t IoctlHelperUpstream::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ set(NEO_CORE_OS_INTERFACE_LINUX_XE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_version_xe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ioctl_helper_xe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_xe_string_value_getter.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_xe_vm_bind_flag.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_xe_vm_export.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_xe_context.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}ioctl_helper_xe_perf.cpp
|
||||
|
||||
@@ -743,6 +743,21 @@ bool IoctlHelperXe::completionFenceExtensionSupported(const bool isVmBindAvailab
|
||||
return isVmBindAvailable;
|
||||
}
|
||||
|
||||
uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) {
|
||||
uint64_t ret = 0;
|
||||
xeLog(" -> IoctlHelperXe::%s %d %d %d\n", __FUNCTION__, bindCapture, bindImmediate, bindMakeResident);
|
||||
if (bindCapture) {
|
||||
ret |= XE_NEO_BIND_CAPTURE_FLAG;
|
||||
}
|
||||
if (bindImmediate) {
|
||||
ret |= XE_NEO_BIND_IMMEDIATE_FLAG;
|
||||
}
|
||||
if (bindMakeResident) {
|
||||
ret |= XE_NEO_BIND_MAKERESIDENT_FLAG;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int IoctlHelperXe::queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) {
|
||||
xeLog(" -> IoctlHelperXe::%s\n", __FUNCTION__);
|
||||
return 0;
|
||||
@@ -1227,7 +1242,6 @@ int IoctlHelperXe::xeVmBind(const VmBindParams &vmBindParams, bool isBind) {
|
||||
|
||||
if (isBind) {
|
||||
bind.bind.op = DRM_XE_VM_BIND_OP_MAP;
|
||||
bind.bind.flags = static_cast<uint32_t>(vmBindParams.flags);
|
||||
bind.bind.obj = vmBindParams.handle;
|
||||
if (bindInfo[index].userptr) {
|
||||
bind.bind.op = DRM_XE_VM_BIND_OP_MAP_USERPTR;
|
||||
|
||||
@@ -20,8 +20,7 @@ struct drm_xe_engine_class_instance;
|
||||
// Arbitratry value for easier identification in the logs for now
|
||||
#define XE_NEO_BIND_CAPTURE_FLAG 0x1
|
||||
#define XE_NEO_BIND_IMMEDIATE_FLAG 0x20
|
||||
#define XE_NEO_BIND_PIN_FLAG (1 << 3) // value for DRM_XE_VM_BIND_FLAG_PIN
|
||||
#define XE_NEO_BIND_MAKERESIDENT_FLAG XE_NEO_BIND_PIN_FLAG
|
||||
#define XE_NEO_BIND_MAKERESIDENT_FLAG 0x300
|
||||
|
||||
#define XE_NEO_VMCREATE_DISABLESCRATCH_FLAG 0x100000
|
||||
#define XE_NEO_VMCREATE_ENABLEPAGEFAULT_FLAG 0x20000
|
||||
@@ -77,7 +76,7 @@ class IoctlHelperXe : public IoctlHelper {
|
||||
bool getGemTiling(void *setTiling) override;
|
||||
uint32_t getDirectSubmissionFlag() override;
|
||||
std::unique_ptr<uint8_t[]> prepareVmBindExt(const StackVec<uint32_t, 2> &bindExtHandles) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool bindLock) override;
|
||||
uint64_t getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident) override;
|
||||
int queryDistances(std::vector<QueryItem> &queryItems, std::vector<DistanceInfo> &distanceInfos) override;
|
||||
uint16_t getWaitUserFenceSoftFlag() override;
|
||||
int execBuffer(ExecBuffer *execBuffer, uint64_t completionGpuAddress, TaskCountType counterValue) override;
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/xe/ioctl_helper_xe.h"
|
||||
|
||||
#include "drm/xe_drm.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
uint64_t IoctlHelperXe::getFlagsForVmBind(bool bindCapture, bool bindImmediate, bool bindMakeResident, bool bindLock) {
|
||||
uint64_t ret = 0;
|
||||
xeLog(" -> IoctlHelperXe::%s %d %d %d %d\n", __FUNCTION__, bindCapture, bindImmediate, bindMakeResident, bindLock);
|
||||
if (bindCapture) {
|
||||
ret |= XE_NEO_BIND_CAPTURE_FLAG;
|
||||
}
|
||||
if (bindImmediate) {
|
||||
ret |= DRM_XE_VM_BIND_FLAG_IMMEDIATE;
|
||||
}
|
||||
if (bindMakeResident) {
|
||||
ret |= XE_NEO_BIND_MAKERESIDENT_FLAG;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user