mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
zeCommandListAppendMemoryPrefetch with memory prefetch manager
Related-To: NEO-6740 Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f4c8a146eb
commit
046f9d95fc
@@ -229,6 +229,9 @@ struct CommandList : _ze_command_list_handle_t {
|
||||
bool containsCooperativeKernels() const {
|
||||
return containsCooperativeKernelsFlag;
|
||||
}
|
||||
bool isMemoryPrefetchRequested() const {
|
||||
return performMemoryPrefetch;
|
||||
}
|
||||
|
||||
enum CommandListType : uint32_t {
|
||||
TYPE_REGULAR = 0u,
|
||||
@@ -293,6 +296,7 @@ struct CommandList : _ze_command_list_handle_t {
|
||||
bool internalUsage = false;
|
||||
bool containsCooperativeKernelsFlag = false;
|
||||
bool containsStatelessUncachedResource = false;
|
||||
bool performMemoryPrefetch = false;
|
||||
};
|
||||
|
||||
using CommandListAllocatorFn = CommandList *(*)(uint32_t);
|
||||
|
||||
@@ -85,6 +85,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::reset() {
|
||||
removeHostPtrAllocations();
|
||||
commandContainer.reset();
|
||||
containsStatelessUncachedResource = false;
|
||||
performMemoryPrefetch = false;
|
||||
indirectAllocationsAllowed = false;
|
||||
unifiedMemoryControls.indirectHostAllocationsAllowed = false;
|
||||
unifiedMemoryControls.indirectSharedAllocationsAllowed = false;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/logical_state_helper.h"
|
||||
#include "shared/source/memory_manager/internal_allocation_storage.h"
|
||||
#include "shared/source/memory_manager/prefetch_manager.h"
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist_hw_immediate.h"
|
||||
|
||||
@@ -108,6 +109,12 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::executeCommandListImm
|
||||
this->migrateSharedAllocations();
|
||||
}
|
||||
|
||||
if (this->performMemoryPrefetch) {
|
||||
auto prefetchManager = this->device->getDriverHandle()->getMemoryManager()->getPrefetchManager();
|
||||
prefetchManager->migrateAllocationsToGpu(*this->device->getDriverHandle()->getSvmAllocsManager(), *this->device->getNEODevice());
|
||||
this->performMemoryPrefetch = false;
|
||||
}
|
||||
|
||||
auto ioh = (this->commandContainer.getIndirectHeap(NEO::IndirectHeap::Type::INDIRECT_OBJECT));
|
||||
NEO::IndirectHeap *dsh = nullptr;
|
||||
NEO::IndirectHeap *ssh = nullptr;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "shared/source/helpers/preamble.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/memory_manager/prefetch_manager.h"
|
||||
#include "shared/source/memory_manager/residency_container.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/os_interface/os_context.h"
|
||||
@@ -83,6 +84,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
auto anyCommandListWithoutCooperativeKernels = false;
|
||||
bool anyCommandListRequiresDisabledEUFusion = false;
|
||||
bool cachedMOCSAllowed = true;
|
||||
bool performMemoryPrefetch = false;
|
||||
|
||||
for (auto i = 0u; i < numCommandLists; i++) {
|
||||
auto commandList = CommandList::fromHandle(phCommandLists[i]);
|
||||
@@ -108,6 +110,10 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
if (commandList->requiresQueueUncachedMocs && cachedMOCSAllowed == true) {
|
||||
cachedMOCSAllowed = false;
|
||||
}
|
||||
|
||||
if (commandList->isMemoryPrefetchRequested()) {
|
||||
performMemoryPrefetch = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool isMixingRegularAndCooperativeKernelsAllowed = NEO::DebugManager.flags.AllowMixingRegularAndCooperativeKernels.get();
|
||||
@@ -446,6 +452,12 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
|
||||
commandList->migrateSharedAllocations();
|
||||
}
|
||||
|
||||
if (performMemoryPrefetch) {
|
||||
auto prefetchManager = device->getDriverHandle()->getMemoryManager()->getPrefetchManager();
|
||||
prefetchManager->migrateAllocationsToGpu(*this->device->getDriverHandle()->getSvmAllocsManager(), *this->device->getNEODevice());
|
||||
performMemoryPrefetch = false;
|
||||
}
|
||||
|
||||
if (!isCopyOnlyCommandQueue && stateSipRequired) {
|
||||
NEO::PreemptionHelper::programStateSipEndWa<GfxFamily>(child, *neoDevice);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/memory_manager/prefetch_manager.h"
|
||||
|
||||
#include "level_zero/core/source/cmdlist/cmdlist_hw.h"
|
||||
#include "level_zero/core/source/cmdlist/cmdlist_hw.inl"
|
||||
#include "level_zero/core/source/cmdlist/cmdlist_hw_immediate.h"
|
||||
@@ -33,7 +35,11 @@ ze_result_t CommandListCoreFamily<IGFX_XE_HPC_CORE>::appendMemoryPrefetch(const
|
||||
}
|
||||
|
||||
if (NEO::DebugManager.flags.AppendMemoryPrefetchForKmdMigratedSharedAllocations.get() > 0) {
|
||||
svmAllocMgr->prefetchMemory(*device->getNEODevice(), *allocData);
|
||||
this->performMemoryPrefetch = true;
|
||||
auto prefetchManager = device->getDriverHandle()->getMemoryManager()->getPrefetchManager();
|
||||
if (prefetchManager) {
|
||||
prefetchManager->insertAllocation(*allocData);
|
||||
}
|
||||
}
|
||||
|
||||
if (NEO::DebugManager.flags.AddStatePrefetchCmdToMemoryPrefetchAPI.get() != 1) {
|
||||
|
||||
Reference in New Issue
Block a user