diff --git a/level_zero/core/source/cmdlist_hw_base.inl b/level_zero/core/source/cmdlist_hw_base.inl index f48bd2d892..20ab2701e3 100644 --- a/level_zero/core/source/cmdlist_hw_base.inl +++ b/level_zero/core/source/cmdlist_hw_base.inl @@ -46,9 +46,7 @@ ze_result_t CommandListCoreFamily::appendLaunchFunctionWithParams auto csr = device->getNEODevice()->getDefaultEngine().commandStreamReceiver; UnifiedMemoryControls unifiedMemoryControls = function->getUnifiedMemoryControls(); - if (unifiedMemoryControls.indirectDeviceAllocationsAllowed || - unifiedMemoryControls.indirectHostAllocationsAllowed || - unifiedMemoryControls.indirectSharedAllocationsAllowed) { + if (function->hasIndirectAllocationsAllowed()) { device->getDriverHandle()->getSvmAllocsManager()->makeInternalAllocationsResident(*csr, unifiedMemoryControls.generateMask()); } diff --git a/level_zero/core/source/kernel.h b/level_zero/core/source/kernel.h index 801441c005..5ac6355d91 100644 --- a/level_zero/core/source/kernel.h +++ b/level_zero/core/source/kernel.h @@ -130,6 +130,7 @@ struct Kernel : _ze_kernel_handle_t, virtual NEO::DispatchKernelEncoderI { virtual size_t getDynamicStateHeapDataSize() const = 0; virtual UnifiedMemoryControls getUnifiedMemoryControls() const = 0; + virtual bool hasIndirectAllocationsAllowed() = 0; virtual NEO::GraphicsAllocation *getPrintfBufferAllocation() = 0; virtual void printPrintfOutput() = 0; diff --git a/level_zero/core/source/kernel_imp.cpp b/level_zero/core/source/kernel_imp.cpp index e85f86cd84..ab0150d065 100644 --- a/level_zero/core/source/kernel_imp.cpp +++ b/level_zero/core/source/kernel_imp.cpp @@ -651,6 +651,12 @@ Kernel *Kernel::create(uint32_t productFamily, Module *module, return function; } +bool KernelImp::hasIndirectAllocationsAllowed() { + return (unifiedMemoryControls.indirectDeviceAllocationsAllowed || + unifiedMemoryControls.indirectHostAllocationsAllowed || + unifiedMemoryControls.indirectSharedAllocationsAllowed); +} + bool KernelImp::hasBarriers() { return getImmutableData()->getDescriptor().kernelAttributes.flags.usesBarriers; } diff --git a/level_zero/core/source/kernel_imp.h b/level_zero/core/source/kernel_imp.h index 47773181c3..bdf74336bd 100644 --- a/level_zero/core/source/kernel_imp.h +++ b/level_zero/core/source/kernel_imp.h @@ -104,6 +104,7 @@ struct KernelImp : Kernel { const KernelImmutableData *getImmutableData() const override { return kernelImmData; } UnifiedMemoryControls getUnifiedMemoryControls() const override { return unifiedMemoryControls; } + bool hasIndirectAllocationsAllowed() override; bool hasBarriers() override; uint32_t getSlmTotalSize() override;