mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-20 13:11:34 +08:00
Handle page faults while accessing unified memory
Related-To: NEO-3330 Change-Id: I7e21f894e9d1c82598954c49342d1f65af07498f Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
cf979c3bc0
commit
76fe09c2a9
@ -976,6 +976,11 @@ inline void Kernel::makeArgsResident(CommandStreamReceiver &commandStreamReceive
|
||||
if (kernelArguments[argIndex].object) {
|
||||
if (kernelArguments[argIndex].type == SVM_ALLOC_OBJ) {
|
||||
auto pSVMAlloc = (GraphicsAllocation *)kernelArguments[argIndex].object;
|
||||
auto pageFaultManager = this->getContext().getMemoryManager()->getPageFaultManager();
|
||||
if (pageFaultManager &&
|
||||
this->isUnifiedMemorySyncRequired) {
|
||||
pageFaultManager->moveAllocationToGpuDomain(reinterpret_cast<void *>(pSVMAlloc->getGpuAddress()));
|
||||
}
|
||||
commandStreamReceiver.makeResident(*pSVMAlloc);
|
||||
} else if (Kernel::isMemObj(kernelArguments[argIndex].type)) {
|
||||
auto clMem = const_cast<cl_mem>(static_cast<const _cl_mem *>(kernelArguments[argIndex].object));
|
||||
@ -1014,10 +1019,18 @@ void Kernel::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
||||
commandStreamReceiver.makeResident(*gfxAlloc);
|
||||
}
|
||||
|
||||
auto pageFaultManager = this->getContext().getMemoryManager()->getPageFaultManager();
|
||||
|
||||
for (auto gfxAlloc : kernelUnifiedMemoryGfxAllocations) {
|
||||
commandStreamReceiver.makeResident(*gfxAlloc);
|
||||
if (pageFaultManager) {
|
||||
pageFaultManager->moveAllocationToGpuDomain(reinterpret_cast<void *>(gfxAlloc->getGpuAddress()));
|
||||
}
|
||||
}
|
||||
|
||||
if (unifiedMemoryControls.indirectSharedAllocationsAllowed && pageFaultManager) {
|
||||
pageFaultManager->moveAllocationsWithinUMAllocsManagerToGpuDomain(this->getContext().getSVMAllocsManager());
|
||||
}
|
||||
makeArgsResident(commandStreamReceiver);
|
||||
|
||||
auto kernelIsaAllocation = this->kernelInfo.kernelAllocation;
|
||||
|
@ -389,6 +389,9 @@ class Kernel : public BaseObject<_cl_kernel> {
|
||||
void setAuxTranslationDirection(AuxTranslationDirection auxTranslationDirection) {
|
||||
this->auxTranslationDirection = auxTranslationDirection;
|
||||
}
|
||||
void setUnifiedMemorySyncRequirement(bool isUnifiedMemorySyncRequired) {
|
||||
this->isUnifiedMemorySyncRequired = isUnifiedMemorySyncRequired;
|
||||
}
|
||||
void setUnifiedMemoryProperty(cl_kernel_exec_info infoType, bool infoValue);
|
||||
void setUnifiedMemoryExecInfo(GraphicsAllocation *argValue);
|
||||
void clearUnifiedMemoryExecInfo();
|
||||
@ -524,5 +527,6 @@ class Kernel : public BaseObject<_cl_kernel> {
|
||||
bool svmAllocationsRequireCacheFlush = false;
|
||||
std::vector<GraphicsAllocation *> kernelArgRequiresCacheFlush;
|
||||
UnifiedMemoryControls unifiedMemoryControls;
|
||||
bool isUnifiedMemorySyncRequired = true;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user