mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-20 13:11:34 +08:00
Fix multi thread usage of external host alloc
With this commit OpenCL will track if external host memory is used from few threads and will secure to update task count in all threads before destroing allocation. Resolves: NEO-6807 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
1d7b99140c
commit
54eee2a88b
@ -43,6 +43,7 @@ constexpr auto nonSharedResource = 0u;
|
||||
|
||||
class Gmm;
|
||||
class MemoryManager;
|
||||
class CommandStreamReceiver;
|
||||
|
||||
struct AubInfo {
|
||||
uint32_t aubWritable = std::numeric_limits<uint32_t>::max();
|
||||
@ -155,8 +156,8 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
bool isUsed() const { return registeredContextsNum > 0; }
|
||||
bool isUsedByManyOsContexts() const { return registeredContextsNum > 1u; }
|
||||
bool isUsedByOsContext(uint32_t contextId) const { return objectNotUsed != getTaskCount(contextId); }
|
||||
void updateTaskCount(uint32_t newTaskCount, uint32_t contextId);
|
||||
uint32_t getTaskCount(uint32_t contextId) const { return usageInfos[contextId].taskCount; }
|
||||
MOCKABLE_VIRTUAL void updateTaskCount(uint32_t newTaskCount, uint32_t contextId);
|
||||
MOCKABLE_VIRTUAL uint32_t getTaskCount(uint32_t contextId) const { return usageInfos[contextId].taskCount; }
|
||||
void releaseUsageInOsContext(uint32_t contextId) { updateTaskCount(objectNotUsed, contextId); }
|
||||
uint32_t getInspectionId(uint32_t contextId) const { return usageInfos[contextId].inspectionId; }
|
||||
void setInspectionId(uint32_t newInspectionId, uint32_t contextId) { usageInfos[contextId].inspectionId = newInspectionId; }
|
||||
@ -215,6 +216,8 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
this->reservedAddressRangeInfo.rangeSize = size;
|
||||
}
|
||||
|
||||
void prepareHostPtrForResidency(CommandStreamReceiver *csr);
|
||||
|
||||
Gmm *getDefaultGmm() const {
|
||||
return getGmm(0u);
|
||||
}
|
||||
@ -252,6 +255,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
|
||||
constexpr static uint32_t objectNotResident = std::numeric_limits<uint32_t>::max();
|
||||
constexpr static uint32_t objectNotUsed = std::numeric_limits<uint32_t>::max();
|
||||
constexpr static uint32_t objectAlwaysResident = std::numeric_limits<uint32_t>::max() - 1;
|
||||
std::atomic<uint32_t> hostPtrTaskCountAssignment{0};
|
||||
|
||||
protected:
|
||||
struct UsageInfo {
|
||||
|
Reference in New Issue
Block a user