mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
[2/n] Unified Shared Memory
- Add kernel flags specifying indirect usage of device allocations. - make device usm allocation resident when kernel requires this Related-To: NEO-3148 Change-Id: I689347a0ea9b0f84c83f7883ca2381be63c61af9 Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
0894601edc
commit
8e969684f1
@ -34,6 +34,7 @@
|
||||
#include "runtime/mem_obj/pipe.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
#include "runtime/memory_manager/svm_memory_manager.h"
|
||||
#include "runtime/os_interface/debug_settings_manager.h"
|
||||
#include "runtime/platform/platform.h"
|
||||
#include "runtime/program/kernel_info.h"
|
||||
@ -940,6 +941,12 @@ void Kernel::clearKernelExecInfo() {
|
||||
svmAllocationsRequireCacheFlush = false;
|
||||
}
|
||||
|
||||
void Kernel::setUnifiedMemoryProperty(cl_kernel_exec_info infoType, bool infoValue) {
|
||||
if (infoType == CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL) {
|
||||
this->unifiedMemoryControls.indirectDeviceAllocationsAllowed = infoValue;
|
||||
}
|
||||
}
|
||||
|
||||
inline void Kernel::makeArgsResident(CommandStreamReceiver &commandStreamReceiver) {
|
||||
|
||||
auto numArgs = kernelInfo.kernelArgInfo.size();
|
||||
@ -989,6 +996,10 @@ void Kernel::makeResident(CommandStreamReceiver &commandStreamReceiver) {
|
||||
}
|
||||
|
||||
gtpinNotifyMakeResident(this, &commandStreamReceiver);
|
||||
|
||||
if (unifiedMemoryControls.indirectDeviceAllocationsAllowed) {
|
||||
this->getContext().getSVMAllocsManager()->makeInternalAllocationsResident(commandStreamReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
void Kernel::getResidency(std::vector<Surface *> &dst) {
|
||||
|
@ -61,6 +61,10 @@ class Kernel : public BaseObject<_cl_kernel> {
|
||||
bool isUncacheable = false;
|
||||
};
|
||||
|
||||
struct UnifiedMemoryControls {
|
||||
bool indirectDeviceAllocationsAllowed = false;
|
||||
};
|
||||
|
||||
typedef int32_t (Kernel::*KernelArgHandler)(uint32_t argIndex,
|
||||
size_t argSize,
|
||||
const void *argVal);
|
||||
@ -388,6 +392,7 @@ class Kernel : public BaseObject<_cl_kernel> {
|
||||
void setAuxTranslationFlag(bool auxTranslationFlag) {
|
||||
this->auxTranslationKernel = auxTranslationFlag;
|
||||
}
|
||||
void setUnifiedMemoryProperty(cl_kernel_exec_info infoType, bool infoValue);
|
||||
|
||||
protected:
|
||||
struct ObjectCounts {
|
||||
@ -457,8 +462,8 @@ class Kernel : public BaseObject<_cl_kernel> {
|
||||
uint64_t privateMemoryCurbeOffset, uint32_t privateMemoryPatchSize, uint64_t privateMemoryGpuAddress);
|
||||
};
|
||||
|
||||
protected:
|
||||
void makeArgsResident(CommandStreamReceiver &commandStreamReceiver);
|
||||
void
|
||||
makeArgsResident(CommandStreamReceiver &commandStreamReceiver);
|
||||
|
||||
void *patchBufferOffset(const KernelArgInfo &argInfo, void *svmPtr, GraphicsAllocation *svmAlloc);
|
||||
|
||||
@ -515,5 +520,6 @@ class Kernel : public BaseObject<_cl_kernel> {
|
||||
bool specialPipelineSelectMode = false;
|
||||
bool svmAllocationsRequireCacheFlush = false;
|
||||
std::vector<GraphicsAllocation *> kernelArgRequiresCacheFlush;
|
||||
UnifiedMemoryControls unifiedMemoryControls;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user