mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
Lock exec path if default memory operations handler is used
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6e805b4fde
commit
0829e4484e
@@ -23,7 +23,7 @@ class DrmMemoryOperationsHandler : public MemoryOperationsHandler {
|
||||
virtual MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) = 0;
|
||||
virtual MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) = 0;
|
||||
virtual void mergeWithResidencyContainer(OsContext *osContext, ResidencyContainer &residencyContainer) = 0;
|
||||
virtual std::unique_lock<std::mutex> lockHandlerForExecWA() = 0;
|
||||
virtual std::unique_lock<std::mutex> lockHandlerIfUsed() = 0;
|
||||
|
||||
static std::unique_ptr<DrmMemoryOperationsHandler> create(Drm &drm, uint32_t rootDeviceIndex);
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ void DrmMemoryOperationsHandlerBind::mergeWithResidencyContainer(OsContext *osCo
|
||||
residencyContainer.clear();
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> DrmMemoryOperationsHandlerBind::lockHandlerForExecWA() {
|
||||
std::unique_lock<std::mutex> DrmMemoryOperationsHandlerBind::lockHandlerIfUsed() {
|
||||
return std::unique_lock<std::mutex>();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class DrmMemoryOperationsHandlerBind : public DrmMemoryOperationsHandler {
|
||||
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
|
||||
void mergeWithResidencyContainer(OsContext *osContext, ResidencyContainer &residencyContainer) override;
|
||||
std::unique_lock<std::mutex> lockHandlerForExecWA() override;
|
||||
std::unique_lock<std::mutex> lockHandlerIfUsed() override;
|
||||
|
||||
MOCKABLE_VIRTUAL void evictUnusedAllocations();
|
||||
|
||||
|
||||
@@ -56,9 +56,10 @@ void DrmMemoryOperationsHandlerDefault::mergeWithResidencyContainer(OsContext *o
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> DrmMemoryOperationsHandlerDefault::lockHandlerForExecWA() {
|
||||
if (DebugManager.flags.MakeAllBuffersResident.get()) {
|
||||
return std::unique_lock<std::mutex>(this->mutex);
|
||||
std::unique_lock<std::mutex> DrmMemoryOperationsHandlerDefault::lockHandlerIfUsed() {
|
||||
std::unique_lock<std::mutex> lock(this->mutex);
|
||||
if (this->residency.size()) {
|
||||
return lock;
|
||||
}
|
||||
return std::unique_lock<std::mutex>();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class DrmMemoryOperationsHandlerDefault : public DrmMemoryOperationsHandler {
|
||||
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
|
||||
|
||||
void mergeWithResidencyContainer(OsContext *osContext, ResidencyContainer &residencyContainer) override;
|
||||
std::unique_lock<std::mutex> lockHandlerForExecWA() override;
|
||||
std::unique_lock<std::mutex> lockHandlerIfUsed() override;
|
||||
|
||||
protected:
|
||||
std::unordered_set<GraphicsAllocation *> residency;
|
||||
|
||||
Reference in New Issue
Block a user