mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Create ClPreemptionHelper
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
754fcae321
commit
80b49e4a47
@ -7,13 +7,10 @@
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
|
||||
#include "shared/source/built_ins/built_ins.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
|
||||
#include "opencl/source/helpers/dispatch_info.h"
|
||||
#include "opencl/source/kernel/kernel.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool PreemptionHelper::allowThreadGroupPreemption(const PreemptionFlags &flags) {
|
||||
@ -58,38 +55,6 @@ PreemptionMode PreemptionHelper::taskPreemptionMode(PreemptionMode devicePreempt
|
||||
return PreemptionMode::MidBatch;
|
||||
};
|
||||
|
||||
void PreemptionHelper::setPreemptionLevelFlags(PreemptionFlags &flags, Device &device, Kernel *kernel) {
|
||||
if (kernel) {
|
||||
const auto &kernelDescriptor = kernel->getKernelInfo().kernelDescriptor;
|
||||
flags.flags.disabledMidThreadPreemptionKernel = kernelDescriptor.kernelAttributes.flags.requiresDisabledMidThreadPreemption;
|
||||
flags.flags.vmeKernel = kernel->isVmeKernel();
|
||||
flags.flags.usesFencesForReadWriteImages = kernelDescriptor.kernelAttributes.flags.usesFencesForReadWriteImages;
|
||||
flags.flags.schedulerKernel = kernel->isSchedulerKernel;
|
||||
}
|
||||
flags.flags.deviceSupportsVmePreemption = device.getDeviceInfo().vmeAvcSupportsPreemption;
|
||||
flags.flags.disablePerCtxtPreemptionGranularityControl = device.getHardwareInfo().workaroundTable.waDisablePerCtxtPreemptionGranularityControl;
|
||||
flags.flags.disableLSQCROPERFforOCL = device.getHardwareInfo().workaroundTable.waDisableLSQCROPERFforOCL;
|
||||
}
|
||||
|
||||
PreemptionMode PreemptionHelper::taskPreemptionMode(Device &device, const MultiDispatchInfo &multiDispatchInfo) {
|
||||
PreemptionMode devMode = device.getPreemptionMode();
|
||||
|
||||
for (const auto &di : multiDispatchInfo) {
|
||||
auto kernel = di.getKernel();
|
||||
|
||||
PreemptionFlags flags = {};
|
||||
setPreemptionLevelFlags(flags, device, kernel);
|
||||
|
||||
PreemptionMode taskMode = taskPreemptionMode(devMode, flags);
|
||||
if (devMode > taskMode) {
|
||||
devMode = taskMode;
|
||||
}
|
||||
PRINT_DEBUG_STRING(DebugManager.flags.PrintDebugMessages.get(), stdout, "devMode = %d, taskMode = %d.\n",
|
||||
static_cast<int>(device.getPreemptionMode()), static_cast<int>(taskMode));
|
||||
}
|
||||
return devMode;
|
||||
}
|
||||
|
||||
void PreemptionHelper::adjustDefaultPreemptionMode(RuntimeCapabilityTable &deviceCapabilities, bool allowMidThread, bool allowThreadGroup, bool allowMidBatch) {
|
||||
if (deviceCapabilities.defaultPreemptionMode >= PreemptionMode::MidThread &&
|
||||
allowMidThread) {
|
||||
|
Reference in New Issue
Block a user