mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Kmd notify improvements [2/n]: Use QuickKmdSleep for sporadic waits
- Measure time between wait calls. If delay is exeeded use QuickKmdSleep - Kmd Notify helper functions - Refactor overriding from debug variables - Refactor Kmd Notify tests Change-Id: I123c31f492d98fd304184f99ee0bf7d733d06f04
This commit is contained in:

committed by
sys_ocldev

parent
c0a8522eb1
commit
9486dba6dd
@ -92,6 +92,8 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|||||||
|
|
||||||
const HardwareInfo &hwInfo;
|
const HardwareInfo &hwInfo;
|
||||||
CsrSizeRequestFlags csrSizeRequestFlags = {};
|
CsrSizeRequestFlags csrSizeRequestFlags = {};
|
||||||
|
|
||||||
|
std::chrono::high_resolution_clock::time_point lastWaitForCompletionTimestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
|
@ -40,6 +40,9 @@ namespace OCLRT {
|
|||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(const HardwareInfo &hwInfoIn) : hwInfo(hwInfoIn) {
|
CommandStreamReceiverHw<GfxFamily>::CommandStreamReceiverHw(const HardwareInfo &hwInfoIn) : hwInfo(hwInfoIn) {
|
||||||
requiredThreadArbitrationPolicy = PreambleHelper<GfxFamily>::getDefaultThreadArbitrationPolicy();
|
requiredThreadArbitrationPolicy = PreambleHelper<GfxFamily>::getDefaultThreadArbitrationPolicy();
|
||||||
|
if (hwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits) {
|
||||||
|
lastWaitForCompletionTimestamp = std::chrono::high_resolution_clock::now();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
@ -561,18 +564,22 @@ template <typename GfxFamily>
|
|||||||
inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) {
|
inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep) {
|
||||||
const auto &kmdNotifyProperties = this->hwInfo.capabilityTable.kmdNotifyProperties;
|
const auto &kmdNotifyProperties = this->hwInfo.capabilityTable.kmdNotifyProperties;
|
||||||
|
|
||||||
const auto &kmdNotifyDelay = useQuickKmdSleep && kmdNotifyProperties.enableQuickKmdSleep ? kmdNotifyProperties.delayQuickKmdSleepMicroseconds
|
useQuickKmdSleep |= kmdNotifyProperties.applyQuickKmdSleepForSporadicWait(lastWaitForCompletionTimestamp);
|
||||||
: kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
|
||||||
|
const auto &kmdNotifyDelay = kmdNotifyProperties.selectDelay(useQuickKmdSleep);
|
||||||
|
|
||||||
auto status = waitForCompletionWithTimeout(kmdNotifyProperties.enableKmdNotify && flushStampToWait != 0,
|
auto status = waitForCompletionWithTimeout(kmdNotifyProperties.enableKmdNotify && flushStampToWait != 0,
|
||||||
kmdNotifyDelay, taskCountToWait);
|
kmdNotifyDelay, taskCountToWait);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
waitForFlushStamp(flushStampToWait);
|
waitForFlushStamp(flushStampToWait);
|
||||||
//now call blocking wait, this is to ensure that task count is reached
|
//now call blocking wait, this is to ensure that task count is reached
|
||||||
waitForCompletionWithTimeout(false, kmdNotifyDelay, taskCountToWait);
|
waitForCompletionWithTimeout(false, 0, taskCountToWait);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNRECOVERABLE_IF(*getTagAddress() < taskCountToWait);
|
UNRECOVERABLE_IF(*getTagAddress() < taskCountToWait);
|
||||||
|
|
||||||
|
if (kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits) {
|
||||||
|
lastWaitForCompletionTimestamp = std::chrono::high_resolution_clock::now();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename GfxFamily>
|
template <typename GfxFamily>
|
||||||
|
@ -69,11 +69,11 @@ const RuntimeCapabilityTable BDW::capabilityTable{
|
|||||||
{false, false},
|
{false, false},
|
||||||
&isSimulationBDW,
|
&isSimulationBDW,
|
||||||
true,
|
true,
|
||||||
true, // forceStatelessCompilationFor32Bit
|
true, // forceStatelessCompilationFor32Bit
|
||||||
{false, 0, false, 0}, // KmdNotifyProperties
|
{false, 0, false, 0, false, 0}, // KmdNotifyProperties
|
||||||
false, // ftr64KBpages
|
false, // ftr64KBpages
|
||||||
EngineType::ENGINE_RCS, // defaultEngineType
|
EngineType::ENGINE_RCS, // defaultEngineType
|
||||||
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
||||||
};
|
};
|
||||||
|
|
||||||
const HardwareInfo BDW_1x2x6::hwInfo = {
|
const HardwareInfo BDW_1x2x6::hwInfo = {
|
||||||
|
@ -65,11 +65,11 @@ const RuntimeCapabilityTable BXT::capabilityTable{
|
|||||||
{true, false},
|
{true, false},
|
||||||
&isSimulationBXT,
|
&isSimulationBXT,
|
||||||
true,
|
true,
|
||||||
false, // forceStatelessCompilationFor32Bit
|
false, // forceStatelessCompilationFor32Bit
|
||||||
{false, 0, false, 0}, // KmdNotifyProperties
|
{false, 0, false, 0, false, 0}, // KmdNotifyProperties
|
||||||
false, // ftr64KBpages
|
false, // ftr64KBpages
|
||||||
EngineType::ENGINE_RCS, // defaultEngineType
|
EngineType::ENGINE_RCS, // defaultEngineType
|
||||||
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
||||||
};
|
};
|
||||||
|
|
||||||
const HardwareInfo BXT_1x2x6::hwInfo = {
|
const HardwareInfo BXT_1x2x6::hwInfo = {
|
||||||
|
@ -60,11 +60,11 @@ const RuntimeCapabilityTable CFL::capabilityTable{
|
|||||||
{true, false},
|
{true, false},
|
||||||
&isSimulationCFL,
|
&isSimulationCFL,
|
||||||
true,
|
true,
|
||||||
true, // forceStatelessCompilationFor32Bit
|
true, // forceStatelessCompilationFor32Bit
|
||||||
{false, 0, false, 0}, // KmdNotifyProperties
|
{false, 0, false, 0, false, 0}, // KmdNotifyProperties
|
||||||
true, // ftr64KBpages
|
true, // ftr64KBpages
|
||||||
EngineType::ENGINE_RCS, // defaultEngineType
|
EngineType::ENGINE_RCS, // defaultEngineType
|
||||||
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
||||||
};
|
};
|
||||||
|
|
||||||
const HardwareInfo CFL_1x2x6::hwInfo = {
|
const HardwareInfo CFL_1x2x6::hwInfo = {
|
||||||
|
@ -60,11 +60,11 @@ const RuntimeCapabilityTable GLK::capabilityTable{
|
|||||||
{true, false},
|
{true, false},
|
||||||
&isSimulationGLK,
|
&isSimulationGLK,
|
||||||
true,
|
true,
|
||||||
false, // forceStatelessCompilationFor32Bit
|
false, // forceStatelessCompilationFor32Bit
|
||||||
{true, 30000, false, 0}, // KmdNotifyProperties
|
{true, 30000, false, 0, false, 0}, // KmdNotifyProperties
|
||||||
false, // ftr64KBpages
|
false, // ftr64KBpages
|
||||||
EngineType::ENGINE_RCS, // defaultEngineType
|
EngineType::ENGINE_RCS, // defaultEngineType
|
||||||
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
||||||
};
|
};
|
||||||
|
|
||||||
const HardwareInfo GLK_1x3x6::hwInfo = {
|
const HardwareInfo GLK_1x3x6::hwInfo = {
|
||||||
|
@ -60,11 +60,11 @@ const RuntimeCapabilityTable KBL::capabilityTable{
|
|||||||
{true, false},
|
{true, false},
|
||||||
&isSimulationKBL,
|
&isSimulationKBL,
|
||||||
true,
|
true,
|
||||||
true, // forceStatelessCompilationFor32Bit
|
true, // forceStatelessCompilationFor32Bit
|
||||||
{false, 0, false, 0}, // KmdNotifyProperties
|
{false, 0, false, 0, false, 0}, // KmdNotifyProperties
|
||||||
true, // ftr64KBpages
|
true, // ftr64KBpages
|
||||||
EngineType::ENGINE_RCS, // defaultEngineType
|
EngineType::ENGINE_RCS, // defaultEngineType
|
||||||
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
||||||
};
|
};
|
||||||
|
|
||||||
const HardwareInfo KBL_1x2x6::hwInfo = {
|
const HardwareInfo KBL_1x2x6::hwInfo = {
|
||||||
|
@ -68,11 +68,11 @@ const RuntimeCapabilityTable SKL::capabilityTable{
|
|||||||
{true, false},
|
{true, false},
|
||||||
&isSimulationSKL,
|
&isSimulationSKL,
|
||||||
true,
|
true,
|
||||||
true, // forceStatelessCompilationFor32Bit
|
true, // forceStatelessCompilationFor32Bit
|
||||||
{false, 0, false, 0}, // KmdNotifyProperties
|
{false, 0, false, 0, false, 0}, // KmdNotifyProperties
|
||||||
true, // ftr64KBpages
|
true, // ftr64KBpages
|
||||||
EngineType::ENGINE_RCS, // defaultEngineType
|
EngineType::ENGINE_RCS, // defaultEngineType
|
||||||
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
MemoryConstants::pageSize //requiredPreemptionSurfaceSize
|
||||||
};
|
};
|
||||||
|
|
||||||
const HardwareInfo SKL_1x2x6::hwInfo = {
|
const HardwareInfo SKL_1x2x6::hwInfo = {
|
||||||
|
@ -54,6 +54,7 @@ set(RUNTIME_SRCS_HELPERS_BASE
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel_commands.h
|
${CMAKE_CURRENT_SOURCE_DIR}/kernel_commands.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel_commands.inl
|
${CMAKE_CURRENT_SOURCE_DIR}/kernel_commands.inl
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties.h
|
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_properties.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.h
|
${CMAKE_CURRENT_SOURCE_DIR}/mipmap.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/options.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/options.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/options.h
|
${CMAKE_CURRENT_SOURCE_DIR}/options.h
|
||||||
|
54
runtime/helpers/kmd_notify_properties.cpp
Normal file
54
runtime/helpers/kmd_notify_properties.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Intel Corporation
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include "runtime/helpers/kmd_notify_properties.h"
|
||||||
|
|
||||||
|
using namespace OCLRT;
|
||||||
|
|
||||||
|
bool KmdNotifyProperties::applyQuickKmdSleepForSporadicWait(std::chrono::high_resolution_clock::time_point &lastWaitTimestamp) const {
|
||||||
|
if (enableQuickKmdSleepForSporadicWaits) {
|
||||||
|
auto now = std::chrono::high_resolution_clock::now();
|
||||||
|
auto timeDiff = std::chrono::duration_cast<std::chrono::microseconds>(now - lastWaitTimestamp).count();
|
||||||
|
if (timeDiff > delayQuickKmdSleepForSporadicWaitsMicroseconds) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int64_t &KmdNotifyProperties::selectDelay(bool useQuickKmdSleep) const {
|
||||||
|
return (useQuickKmdSleep && enableQuickKmdSleep) ? delayQuickKmdSleepMicroseconds
|
||||||
|
: delayKmdNotifyMicroseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KmdNotifyProperties::overrideFromDebugVariable(int32_t debugVariableValue, int64_t &destination) {
|
||||||
|
if (debugVariableValue >= 0) {
|
||||||
|
destination = static_cast<int64_t>(debugVariableValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KmdNotifyProperties::overrideFromDebugVariable(int32_t debugVariableValue, bool &destination) {
|
||||||
|
if (debugVariableValue >= 0) {
|
||||||
|
destination = !!(debugVariableValue);
|
||||||
|
}
|
||||||
|
}
|
@ -22,12 +22,25 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
namespace OCLRT {
|
namespace OCLRT {
|
||||||
struct KmdNotifyProperties {
|
struct KmdNotifyProperties {
|
||||||
|
// Main switch for KMD Notify optimization - if its disabled, all below are disabled too
|
||||||
bool enableKmdNotify;
|
bool enableKmdNotify;
|
||||||
int64_t delayKmdNotifyMicroseconds;
|
int64_t delayKmdNotifyMicroseconds;
|
||||||
|
// Use smaller delay in specific situations (ie. from AsyncEventsHandler)
|
||||||
bool enableQuickKmdSleep;
|
bool enableQuickKmdSleep;
|
||||||
int64_t delayQuickKmdSleepMicroseconds;
|
int64_t delayQuickKmdSleepMicroseconds;
|
||||||
|
// If waits are called sporadically use QuickKmdSleep mode, otherwise use standard delay
|
||||||
|
bool enableQuickKmdSleepForSporadicWaits;
|
||||||
|
int64_t delayQuickKmdSleepForSporadicWaitsMicroseconds;
|
||||||
|
|
||||||
|
bool applyQuickKmdSleepForSporadicWait(std::chrono::high_resolution_clock::time_point &lastWaitTimestamp) const;
|
||||||
|
|
||||||
|
const int64_t &selectDelay(bool useQuickKmdSleep) const;
|
||||||
|
|
||||||
|
static void overrideFromDebugVariable(int32_t debugVariableValue, int64_t &destination);
|
||||||
|
static void overrideFromDebugVariable(int32_t debugVariableValue, bool &destination);
|
||||||
};
|
};
|
||||||
} // namespace OCLRT
|
} // namespace OCLRT
|
||||||
|
@ -79,6 +79,8 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideEnableKmdNotify, -1, "-1: dont override,
|
|||||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideKmdNotifyDelayMicroseconds, -1, "-1: dont override, 0: infinite timeout, >0: timeout in microseconds")
|
DECLARE_DEBUG_VARIABLE(int32_t, OverrideKmdNotifyDelayMicroseconds, -1, "-1: dont override, 0: infinite timeout, >0: timeout in microseconds")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideEnableQuickKmdSleep, -1, "-1: dont override, 0: disable, 1: enable. It works only when Kmd Notify is enabled.")
|
DECLARE_DEBUG_VARIABLE(int32_t, OverrideEnableQuickKmdSleep, -1, "-1: dont override, 0: disable, 1: enable. It works only when Kmd Notify is enabled.")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideQuickKmdSleepDelayMicroseconds, -1, "-1: dont override, 0: infinite timeout, >0: timeout in microseconds")
|
DECLARE_DEBUG_VARIABLE(int32_t, OverrideQuickKmdSleepDelayMicroseconds, -1, "-1: dont override, 0: infinite timeout, >0: timeout in microseconds")
|
||||||
|
DECLARE_DEBUG_VARIABLE(int32_t, OverrideEnableQuickKmdSleepForSporadicWaits, -1, "-1: dont override, 0: disable, 1: enable. It works only when QuickKmdSleep is enabled.")
|
||||||
|
DECLARE_DEBUG_VARIABLE(int32_t, OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds, -1, "-1: dont override, >0: timeout in microseconds")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, EnableVaLibCalls, true, "Enable cl-va sharing lib calls")
|
DECLARE_DEBUG_VARIABLE(bool, EnableVaLibCalls, true, "Enable cl-va sharing lib calls")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, CsrDispatchMode, 0, "Chooses DispatchMode for Csr")
|
DECLARE_DEBUG_VARIABLE(int32_t, CsrDispatchMode, 0, "Chooses DispatchMode for Csr")
|
||||||
/*DRIVER TOGGLES*/
|
/*DRIVER TOGGLES*/
|
||||||
|
@ -184,21 +184,13 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
|
|||||||
static_cast<bool>(outHwInfo->pSkuTable->ftrGpGpuMidBatchPreempt) && preemption);
|
static_cast<bool>(outHwInfo->pSkuTable->ftrGpGpuMidBatchPreempt) && preemption);
|
||||||
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte;
|
outHwInfo->capabilityTable.requiredPreemptionSurfaceSize = outHwInfo->pSysInfo->CsrSizeInMb * MemoryConstants::megaByte;
|
||||||
|
|
||||||
outHwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify = DebugManager.flags.OverrideEnableKmdNotify.get() >= 0
|
auto &kmdNotifyProperties = outHwInfo->capabilityTable.kmdNotifyProperties;
|
||||||
? !!DebugManager.flags.OverrideEnableKmdNotify.get()
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);
|
||||||
: outHwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify;
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get(), kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleep.get(), kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
outHwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get() >= 0
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
? static_cast<int64_t>(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get())
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.get(), kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
: outHwInfo->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
|
|
||||||
outHwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep = DebugManager.flags.OverrideEnableQuickKmdSleep.get() >= 0
|
|
||||||
? !!DebugManager.flags.OverrideEnableQuickKmdSleep.get()
|
|
||||||
: outHwInfo->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep;
|
|
||||||
|
|
||||||
outHwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds = DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get() >= 0
|
|
||||||
? static_cast<int64_t>(DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get())
|
|
||||||
: outHwInfo->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
|
||||||
|
|
||||||
pPlatform.release();
|
pPlatform.release();
|
||||||
pSkuTable.release();
|
pSkuTable.release();
|
||||||
|
@ -66,21 +66,13 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
|
|||||||
// Instrumentation
|
// Instrumentation
|
||||||
tempHwInfos[devNum].capabilityTable.instrumentationEnabled &= haveInstrumentation;
|
tempHwInfos[devNum].capabilityTable.instrumentationEnabled &= haveInstrumentation;
|
||||||
|
|
||||||
tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.enableKmdNotify = DebugManager.flags.OverrideEnableKmdNotify.get() >= 0
|
auto &kmdNotifyProperties = tempHwInfos[devNum].capabilityTable.kmdNotifyProperties;
|
||||||
? !!DebugManager.flags.OverrideEnableKmdNotify.get()
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableKmdNotify.get(), kmdNotifyProperties.enableKmdNotify);
|
||||||
: tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.enableKmdNotify;
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get(), kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleep.get(), kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get() >= 0
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
? static_cast<int64_t>(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get())
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.get(), kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
: tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
KmdNotifyProperties::overrideFromDebugVariable(DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
|
|
||||||
tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.enableQuickKmdSleep = DebugManager.flags.OverrideEnableQuickKmdSleep.get() >= 0
|
|
||||||
? !!DebugManager.flags.OverrideEnableQuickKmdSleep.get()
|
|
||||||
: tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.enableQuickKmdSleep;
|
|
||||||
|
|
||||||
tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds = DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get() >= 0
|
|
||||||
? static_cast<int64_t>(DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.get())
|
|
||||||
: tempHwInfos[devNum].capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
|
||||||
|
|
||||||
numDevices = 1;
|
numDevices = 1;
|
||||||
*pHWInfos = tempHwInfos;
|
*pHWInfos = tempHwInfos;
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "runtime/helpers/basic_math.h"
|
#include "runtime/helpers/basic_math.h"
|
||||||
#include "runtime/helpers/kernel_commands.h"
|
#include "runtime/helpers/kernel_commands.h"
|
||||||
#include "runtime/helpers/options.h"
|
#include "runtime/helpers/options.h"
|
||||||
#include "runtime/os_interface/device_factory.h"
|
|
||||||
|
|
||||||
#include "unit_tests/command_queue/command_queue_fixture.h"
|
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||||
#include "unit_tests/command_stream/command_stream_fixture.h"
|
#include "unit_tests/command_stream/command_stream_fixture.h"
|
||||||
@ -35,7 +34,6 @@
|
|||||||
#include "unit_tests/fixtures/device_fixture.h"
|
#include "unit_tests/fixtures/device_fixture.h"
|
||||||
#include "unit_tests/fixtures/memory_management_fixture.h"
|
#include "unit_tests/fixtures/memory_management_fixture.h"
|
||||||
#include "unit_tests/fixtures/buffer_fixture.h"
|
#include "unit_tests/fixtures/buffer_fixture.h"
|
||||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
|
||||||
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
||||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||||
#include "unit_tests/mocks/mock_command_queue.h"
|
#include "unit_tests/mocks/mock_command_queue.h"
|
||||||
@ -643,170 +641,23 @@ HWTEST_F(CommandQueueCSTest, getCSShouldReturnACSWithEnoughSizeCSRTraffic) {
|
|||||||
EXPECT_EQ(0x1000u, cs.getUsed());
|
EXPECT_EQ(0x1000u, cs.getUsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
struct KmdNotifyTests : public ::testing::Test {
|
using CommandQueueTests = ::testing::Test;
|
||||||
|
HWTEST_F(CommandQueueTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGraphicsAllocationIsReused) {
|
||||||
void SetUp() override {
|
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(*platformDevices));
|
||||||
resetObjects(1, 1, 1, 2);
|
MockContext context(device.get());
|
||||||
*device->getTagAddress() = taskCountToWait;
|
std::unique_ptr<CommandQueue> commandQ(new CommandQueue(&context, device.get(), 0));
|
||||||
}
|
|
||||||
|
|
||||||
void TearDown() override {
|
|
||||||
delete cmdQ;
|
|
||||||
delete device;
|
|
||||||
DeviceFactory::releaseDevices();
|
|
||||||
}
|
|
||||||
|
|
||||||
void resetObjects(int32_t overrideKmdNotifyEnable, int32_t overrideKmdNotifyDelay,
|
|
||||||
int overrideQuickKmdSleepEnable, int32_t overrideQuickKmdSleepDelay) {
|
|
||||||
if (cmdQ) {
|
|
||||||
delete cmdQ;
|
|
||||||
}
|
|
||||||
if (device) {
|
|
||||||
delete device;
|
|
||||||
DeviceFactory::releaseDevices();
|
|
||||||
}
|
|
||||||
DebugManagerStateRestore stateRestore;
|
|
||||||
DebugManager.flags.OverrideEnableKmdNotify.set(overrideKmdNotifyEnable);
|
|
||||||
DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.set(overrideKmdNotifyDelay);
|
|
||||||
DebugManager.flags.OverrideEnableQuickKmdSleep.set(overrideQuickKmdSleepEnable);
|
|
||||||
DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.set(overrideQuickKmdSleepDelay);
|
|
||||||
size_t numDevices;
|
|
||||||
HardwareInfo *hwInfo = nullptr;
|
|
||||||
DeviceFactory::getDevices(&hwInfo, numDevices);
|
|
||||||
device = Device::create<MockDevice>(hwInfo);
|
|
||||||
cmdQ = new ::testing::NiceMock<MyCommandQueue>(&context, device);
|
|
||||||
device->getCommandStreamReceiver().waitForFlushStamp(flushStampToWait);
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyCommandQueue : public CommandQueue {
|
|
||||||
public:
|
|
||||||
MyCommandQueue(Context *ctx, Device *device) : CommandQueue(ctx, device, 0) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Family>
|
|
||||||
class MyCsr : public UltCommandStreamReceiver<Family> {
|
|
||||||
public:
|
|
||||||
MyCsr(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<Family>(hwInfo) {}
|
|
||||||
MOCK_METHOD1(waitForFlushStamp, bool(FlushStamp &flushStampToWait));
|
|
||||||
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
|
|
||||||
};
|
|
||||||
|
|
||||||
MockContext context;
|
|
||||||
MockDevice *device = nullptr;
|
|
||||||
::testing::NiceMock<MyCommandQueue> *cmdQ = nullptr;
|
|
||||||
FlushStamp flushStampToWait = 1000;
|
|
||||||
uint32_t taskCountToWait = 5;
|
|
||||||
};
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenTaskCountWhenWaitUntilCompletionCalledThenAlwaysTryCpuPolling) {
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 1, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 1, taskCountToWait)).Times(0);
|
|
||||||
|
|
||||||
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenTaskCountAndKmdNotifyDisabledWhenWaitUntilCompletionCalledThenTryCpuPollingWithoutTimeout) {
|
|
||||||
resetObjects(0, 0, 0, 0);
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 0, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
|
|
||||||
|
|
||||||
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenWaitUntilCompletionCalledThenTryCpuPollingAndKmdWait) {
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
*device->getTagAddress() = taskCountToWait - 1;
|
|
||||||
|
|
||||||
::testing::InSequence is;
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 1, taskCountToWait)).Times(1).WillOnce(::testing::Return(false));
|
|
||||||
EXPECT_CALL(*csr, waitForFlushStamp(flushStampToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 1, taskCountToWait)).Times(1).WillOnce(::testing::Return(false));
|
|
||||||
|
|
||||||
//we have unrecoverable for this case, this will throw.
|
|
||||||
EXPECT_THROW(cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false), std::exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenReadyTaskCountWhenWaitUntilCompletionCalledThenTryCpuPollingAndDontCallKmdWait) {
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
|
|
||||||
::testing::InSequence is;
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 1, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
|
|
||||||
|
|
||||||
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenDefaultArgumentWhenWaitUntilCompleteIsCalledThenDisableQuickKmdSleep) {
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
|
||||||
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
|
|
||||||
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenEnabledQuickSleepWhenWaitUntilCompleteIsCalledThenChangeDelayValue) {
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
|
||||||
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
|
|
||||||
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenDisabledQuickSleepWhenWaitUntilCompleteWithQuickSleepRequestIsCalledThenUseBaseDelayValue) {
|
|
||||||
resetObjects(1, 1, 0, 0);
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
|
||||||
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
|
|
||||||
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenPollForCompletionCalledThenTimeout) {
|
|
||||||
CommandQueue commandQ(&context, device, 0);
|
|
||||||
*device->getTagAddress() = taskCountToWait - 1;
|
|
||||||
auto success = device->getCommandStreamReceiver().waitForCompletionWithTimeout(true, 1, taskCountToWait);
|
|
||||||
EXPECT_FALSE(success);
|
|
||||||
}
|
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenMultipleCommandQueuesWhenMarkerIsEmittedThenGraphicsAllocationIsReused) {
|
|
||||||
std::unique_ptr<CommandQueue> commandQ(new CommandQueue(&context, device, 0));
|
|
||||||
*device->getTagAddress() = 0;
|
*device->getTagAddress() = 0;
|
||||||
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
||||||
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
||||||
|
|
||||||
auto commandStreamGraphicsAllocation = commandQ->getCS(0).getGraphicsAllocation();
|
auto commandStreamGraphicsAllocation = commandQ->getCS(0).getGraphicsAllocation();
|
||||||
commandQ.reset(new CommandQueue(&context, device, 0));
|
commandQ.reset(new CommandQueue(&context, device.get(), 0));
|
||||||
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
||||||
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
commandQ->enqueueMarkerWithWaitList(0, nullptr, nullptr);
|
||||||
auto commandStreamGraphicsAllocation2 = commandQ->getCS(0).getGraphicsAllocation();
|
auto commandStreamGraphicsAllocation2 = commandQ->getCS(0).getGraphicsAllocation();
|
||||||
EXPECT_EQ(commandStreamGraphicsAllocation, commandStreamGraphicsAllocation2);
|
EXPECT_EQ(commandStreamGraphicsAllocation, commandStreamGraphicsAllocation2);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(KmdNotifyTests, givenZeroFlushStampWhenWaitIsCalledThenDisableTimeout) {
|
|
||||||
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
|
||||||
device->resetCommandStreamReceiver(csr);
|
|
||||||
|
|
||||||
EXPECT_TRUE(device->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
|
|
||||||
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, ::testing::_, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
|
||||||
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
|
|
||||||
|
|
||||||
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 0, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct WaitForQueueCompletionTests : public ::testing::Test {
|
struct WaitForQueueCompletionTests : public ::testing::Test {
|
||||||
template <typename Family>
|
template <typename Family>
|
||||||
struct MyCmdQueue : public CommandQueueHw<Family> {
|
struct MyCmdQueue : public CommandQueueHw<Family> {
|
||||||
|
@ -29,21 +29,7 @@
|
|||||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||||
#include "unit_tests/mocks/mock_gmm.h"
|
#include "unit_tests/mocks/mock_gmm.h"
|
||||||
|
|
||||||
using OCLRT::AUBCommandStreamReceiver;
|
using namespace OCLRT;
|
||||||
using OCLRT::AUBCommandStreamReceiverHw;
|
|
||||||
using OCLRT::BatchBuffer;
|
|
||||||
using OCLRT::CommandStreamReceiver;
|
|
||||||
using OCLRT::DebugManager;
|
|
||||||
using OCLRT::GraphicsAllocation;
|
|
||||||
using OCLRT::HardwareInfo;
|
|
||||||
using OCLRT::LinearStream;
|
|
||||||
using OCLRT::MemoryManager;
|
|
||||||
using OCLRT::ObjectNotResident;
|
|
||||||
using OCLRT::ResidencyContainer;
|
|
||||||
using OCLRT::platformDevices;
|
|
||||||
|
|
||||||
using ::testing::Return;
|
|
||||||
using ::testing::_;
|
|
||||||
|
|
||||||
typedef Test<DeviceFixture> AubCommandStreamReceiverTests;
|
typedef Test<DeviceFixture> AubCommandStreamReceiverTests;
|
||||||
|
|
||||||
@ -92,9 +78,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDebugSetti
|
|||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedThenMemoryManagerIsNotNull) {
|
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedThenMemoryManagerIsNotNull) {
|
||||||
HardwareInfo hwInfo;
|
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, true));
|
||||||
|
|
||||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(hwInfo, true));
|
|
||||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||||
EXPECT_NE(nullptr, memoryManager.get());
|
EXPECT_NE(nullptr, memoryManager.get());
|
||||||
aubCsr->setMemoryManager(nullptr);
|
aubCsr->setMemoryManager(nullptr);
|
||||||
@ -449,7 +433,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenDefault
|
|||||||
auto engineType = OCLRT::ENGINE_RCS;
|
auto engineType = OCLRT::ENGINE_RCS;
|
||||||
ResidencyContainer allocationsForResidency = {};
|
ResidencyContainer allocationsForResidency = {};
|
||||||
|
|
||||||
EXPECT_CALL(*aubCsr, flattenBatchBuffer(_, _)).Times(0);
|
EXPECT_CALL(*aubCsr, flattenBatchBuffer(::testing::_, ::testing::_)).Times(0);
|
||||||
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency);
|
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency);
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||||
@ -481,7 +465,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
|||||||
|
|
||||||
std::unique_ptr<void, decltype(alignedFree) *> ptr(alignedMalloc(4096, 4096), alignedFree);
|
std::unique_ptr<void, decltype(alignedFree) *> ptr(alignedMalloc(4096, 4096), alignedFree);
|
||||||
|
|
||||||
EXPECT_CALL(*aubCsr, flattenBatchBuffer(_, _)).WillOnce(Return(ptr.release()));
|
EXPECT_CALL(*aubCsr, flattenBatchBuffer(::testing::_, ::testing::_)).WillOnce(::testing::Return(ptr.release()));
|
||||||
aubCsr->flush(batchBuffer, engineType, nullptr);
|
aubCsr->flush(batchBuffer, engineType, nullptr);
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||||
@ -507,7 +491,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
|||||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 128u, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||||
auto engineType = OCLRT::ENGINE_RCS;
|
auto engineType = OCLRT::ENGINE_RCS;
|
||||||
|
|
||||||
EXPECT_CALL(*aubCsr, flattenBatchBuffer(_, _)).Times(1);
|
EXPECT_CALL(*aubCsr, flattenBatchBuffer(::testing::_, ::testing::_)).Times(1);
|
||||||
aubCsr->flush(batchBuffer, engineType, nullptr);
|
aubCsr->flush(batchBuffer, engineType, nullptr);
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||||
@ -537,7 +521,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenDispatc
|
|||||||
|
|
||||||
ResidencyContainer allocationsForResidency = {chainedBatchBuffer};
|
ResidencyContainer allocationsForResidency = {chainedBatchBuffer};
|
||||||
|
|
||||||
EXPECT_CALL(*aubCsr, flattenBatchBuffer(_, _)).Times(0);
|
EXPECT_CALL(*aubCsr, flattenBatchBuffer(::testing::_, ::testing::_)).Times(0);
|
||||||
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency);
|
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency);
|
||||||
|
|
||||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||||
|
@ -60,6 +60,8 @@ GEN8TEST_F(Gen8DeviceCaps, kmdNotifyMechanism) {
|
|||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEN8TEST_F(Gen8DeviceCaps, compression) {
|
GEN8TEST_F(Gen8DeviceCaps, compression) {
|
||||||
|
@ -89,4 +89,6 @@ BXTTEST_F(BxtUsDeviceIdTest, kmdNotifyMechanism) {
|
|||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,8 @@ CFLTEST_F(CflDeviceCaps, kmdNotifyMechanism) {
|
|||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFLTEST_F(CflDeviceCaps, GivenCFLWhenCheckftr64KBpagesThenTrue) {
|
CFLTEST_F(CflDeviceCaps, GivenCFLWhenCheckftr64KBpagesThenTrue) {
|
||||||
|
@ -78,6 +78,8 @@ GLKTEST_F(GlkUsDeviceIdTest, kmdNotifyMechanism) {
|
|||||||
EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLKTEST_F(GlkUsDeviceIdTest, GivenGLKWhenCheckftr64KBpagesThenFalse) {
|
GLKTEST_F(GlkUsDeviceIdTest, GivenGLKWhenCheckftr64KBpagesThenFalse) {
|
||||||
|
@ -38,6 +38,8 @@ KBLTEST_F(KblDeviceCaps, kmdNotifyMechanism) {
|
|||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
KBLTEST_F(KblDeviceCaps, GivenKBLWhenCheckftr64KBpagesThenTrue) {
|
KBLTEST_F(KblDeviceCaps, GivenKBLWhenCheckftr64KBpagesThenTrue) {
|
||||||
|
@ -86,6 +86,8 @@ SKLTEST_F(SklUsDeviceIdTest, kmdNotifyMechanism) {
|
|||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
|
||||||
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
|
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
|
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
SKLTEST_F(SklUsDeviceIdTest, GivenSKLWhenCheckftr64KBpagesThenTrue) {
|
SKLTEST_F(SklUsDeviceIdTest, GivenSKLWhenCheckftr64KBpagesThenTrue) {
|
||||||
|
@ -39,6 +39,7 @@ set(IGDRCL_SRCS_tests_helpers
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hw_parse.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel_commands_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/kernel_commands_tests.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/kmd_notify_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_management_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/memory_management_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/mipmap_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/mipmap_tests.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data_tests.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/per_thread_data_tests.cpp
|
||||||
|
211
unit_tests/helpers/kmd_notify_tests.cpp
Normal file
211
unit_tests/helpers/kmd_notify_tests.cpp
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Intel Corporation
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included
|
||||||
|
* in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
* OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "runtime/command_queue/command_queue.h"
|
||||||
|
|
||||||
|
#include "unit_tests/mocks/mock_device.h"
|
||||||
|
#include "unit_tests/mocks/mock_context.h"
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
using namespace OCLRT;
|
||||||
|
|
||||||
|
struct KmdNotifyTests : public ::testing::Test {
|
||||||
|
void SetUp() override {
|
||||||
|
device.reset(Device::create<MockDevice>(&localHwInfo));
|
||||||
|
cmdQ.reset(new CommandQueue(&context, device.get(), nullptr));
|
||||||
|
*device->getTagAddress() = taskCountToWait;
|
||||||
|
device->getCommandStreamReceiver().waitForFlushStamp(flushStampToWait);
|
||||||
|
overrideKmdNotifyParams(true, 2, true, 1, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void overrideKmdNotifyParams(bool kmdNotifyEnable, int64_t kmdNotifyDelay,
|
||||||
|
bool quickKmdSleepEnable, int64_t quickKmdSleepDelay,
|
||||||
|
bool quickKmdSleepEnableForSporadicWaits, int64_t quickKmdSleepDelayForSporadicWaits) {
|
||||||
|
auto &properties = localHwInfo.capabilityTable.kmdNotifyProperties;
|
||||||
|
properties.enableKmdNotify = kmdNotifyEnable;
|
||||||
|
properties.delayKmdNotifyMicroseconds = kmdNotifyDelay;
|
||||||
|
properties.enableQuickKmdSleep = quickKmdSleepEnable;
|
||||||
|
properties.delayQuickKmdSleepMicroseconds = quickKmdSleepDelay;
|
||||||
|
properties.enableQuickKmdSleepForSporadicWaits = quickKmdSleepEnableForSporadicWaits;
|
||||||
|
properties.delayQuickKmdSleepForSporadicWaitsMicroseconds = quickKmdSleepDelayForSporadicWaits;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Family>
|
||||||
|
struct MyCsr : public UltCommandStreamReceiver<Family> {
|
||||||
|
MyCsr(const HardwareInfo &hwInfo) : UltCommandStreamReceiver<Family>(hwInfo) {}
|
||||||
|
MOCK_METHOD1(waitForFlushStamp, bool(FlushStamp &flushStampToWait));
|
||||||
|
MOCK_METHOD3(waitForCompletionWithTimeout, bool(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait));
|
||||||
|
};
|
||||||
|
|
||||||
|
HardwareInfo localHwInfo = **platformDevices;
|
||||||
|
MockContext context;
|
||||||
|
std::unique_ptr<MockDevice> device;
|
||||||
|
std::unique_ptr<CommandQueue> cmdQ;
|
||||||
|
FlushStamp flushStampToWait = 1000;
|
||||||
|
uint32_t taskCountToWait = 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenTaskCountWhenWaitUntilCompletionCalledThenAlwaysTryCpuPolling) {
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 2, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
|
||||||
|
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenTaskCountAndKmdNotifyDisabledWhenWaitUntilCompletionCalledThenTryCpuPollingWithoutTimeout) {
|
||||||
|
overrideKmdNotifyParams(false, 0, false, 0, false, 0);
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 0, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
|
||||||
|
|
||||||
|
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenWaitUntilCompletionCalledThenTryCpuPollingAndKmdWait) {
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
*device->getTagAddress() = taskCountToWait - 1;
|
||||||
|
|
||||||
|
::testing::InSequence is;
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 2, taskCountToWait)).Times(1).WillOnce(::testing::Return(false));
|
||||||
|
EXPECT_CALL(*csr, waitForFlushStamp(flushStampToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, 0, taskCountToWait)).Times(1).WillOnce(::testing::Return(false));
|
||||||
|
|
||||||
|
//we have unrecoverable for this case, this will throw.
|
||||||
|
EXPECT_THROW(cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false), std::exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenReadyTaskCountWhenWaitUntilCompletionCalledThenTryCpuPollingAndDontCallKmdWait) {
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
::testing::InSequence is;
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, 2, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
|
||||||
|
|
||||||
|
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenDefaultArgumentWhenWaitUntilCompleteIsCalledThenDisableQuickKmdSleep) {
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
||||||
|
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
|
||||||
|
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenEnabledQuickSleepWhenWaitUntilCompleteIsCalledThenChangeDelayValue) {
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
||||||
|
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
|
||||||
|
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenDisabledQuickSleepWhenWaitUntilCompleteWithQuickSleepRequestIsCalledThenUseBaseDelayValue) {
|
||||||
|
overrideKmdNotifyParams(true, 1, false, 0, false, 0);
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
auto expectedTimeout = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
||||||
|
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(true, expectedTimeout, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
|
||||||
|
cmdQ->waitUntilComplete(taskCountToWait, flushStampToWait, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenNotReadyTaskCountWhenPollForCompletionCalledThenTimeout) {
|
||||||
|
*device->getTagAddress() = taskCountToWait - 1;
|
||||||
|
auto success = device->getCommandStreamReceiver().waitForCompletionWithTimeout(true, 1, taskCountToWait);
|
||||||
|
EXPECT_FALSE(success);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenZeroFlushStampWhenWaitIsCalledThenDisableTimeout) {
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
EXPECT_TRUE(device->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(false, ::testing::_, taskCountToWait)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
EXPECT_CALL(*csr, waitForFlushStamp(::testing::_)).Times(0);
|
||||||
|
|
||||||
|
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 0, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsSporadicWaitThenOverrideQuickSleepRequest) {
|
||||||
|
overrideKmdNotifyParams(true, 3, true, 2, true, 0);
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_, expectedDelay, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
|
||||||
|
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenNonQuickSleepRequestWhenItsNotSporadicWaitThenOverrideQuickSleepRequest) {
|
||||||
|
overrideKmdNotifyParams(true, 3, true, 2, true, 9999999);
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_, expectedDelay, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
|
||||||
|
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenQuickSleepRequestWhenItsSporadicWaitOptimizationIsDisabledThenDontOverrideQuickSleepRequest) {
|
||||||
|
overrideKmdNotifyParams(true, 3, true, 2, false, 0);
|
||||||
|
auto csr = new ::testing::NiceMock<MyCsr<FamilyType>>(device->getHardwareInfo());
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
auto expectedDelay = device->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
||||||
|
EXPECT_CALL(*csr, waitForCompletionWithTimeout(::testing::_, expectedDelay, ::testing::_)).Times(1).WillOnce(::testing::Return(true));
|
||||||
|
|
||||||
|
csr->waitForTaskCountWithKmdNotifyFallback(taskCountToWait, 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenInitializedThenUpdateWaitTimestamp) {
|
||||||
|
overrideKmdNotifyParams(true, 3, true, 2, true, 1);
|
||||||
|
auto csr = new UltCommandStreamReceiver<FamilyType>(localHwInfo);
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
EXPECT_NE(0, csr->lastWaitForCompletionTimestamp.time_since_epoch().count());
|
||||||
|
}
|
||||||
|
|
||||||
|
HWTEST_F(KmdNotifyTests, givenDefaultCommandStreamReceiverWhenWaitCalledThenUpdateWaitTimestamp) {
|
||||||
|
overrideKmdNotifyParams(true, 3, true, 2, true, 1);
|
||||||
|
auto csr = new UltCommandStreamReceiver<FamilyType>(localHwInfo);
|
||||||
|
device->resetCommandStreamReceiver(csr);
|
||||||
|
|
||||||
|
auto initialTime = csr->lastWaitForCompletionTimestamp.time_since_epoch().count();
|
||||||
|
|
||||||
|
csr->waitForTaskCountWithKmdNotifyFallback(0, 0, false);
|
||||||
|
|
||||||
|
auto updatedTime = csr->lastWaitForCompletionTimestamp.time_since_epoch().count();
|
||||||
|
EXPECT_NE(initialTime, updatedTime);
|
||||||
|
}
|
@ -37,6 +37,7 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
|
|||||||
using BaseClass::hwInfo;
|
using BaseClass::hwInfo;
|
||||||
using BaseClass::ihState;
|
using BaseClass::ihState;
|
||||||
using BaseClass::iohState;
|
using BaseClass::iohState;
|
||||||
|
using BaseClass::lastWaitForCompletionTimestamp;
|
||||||
using BaseClass::sshState;
|
using BaseClass::sshState;
|
||||||
using BaseClass::CommandStreamReceiver::commandStream;
|
using BaseClass::CommandStreamReceiver::commandStream;
|
||||||
using BaseClass::CommandStreamReceiver::disableL3Cache;
|
using BaseClass::CommandStreamReceiver::disableL3Cache;
|
||||||
@ -47,11 +48,11 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily> {
|
|||||||
using BaseClass::CommandStreamReceiver::lastPreemptionMode;
|
using BaseClass::CommandStreamReceiver::lastPreemptionMode;
|
||||||
using BaseClass::CommandStreamReceiver::lastSentCoherencyRequest;
|
using BaseClass::CommandStreamReceiver::lastSentCoherencyRequest;
|
||||||
using BaseClass::CommandStreamReceiver::lastSentL3Config;
|
using BaseClass::CommandStreamReceiver::lastSentL3Config;
|
||||||
using BaseClass::CommandStreamReceiver::requiredThreadArbitrationPolicy;
|
|
||||||
using BaseClass::CommandStreamReceiver::lastSentThreadArbitrationPolicy;
|
using BaseClass::CommandStreamReceiver::lastSentThreadArbitrationPolicy;
|
||||||
using BaseClass::CommandStreamReceiver::lastVmeSubslicesConfig;
|
using BaseClass::CommandStreamReceiver::lastVmeSubslicesConfig;
|
||||||
using BaseClass::CommandStreamReceiver::latestFlushedTaskCount;
|
using BaseClass::CommandStreamReceiver::latestFlushedTaskCount;
|
||||||
using BaseClass::CommandStreamReceiver::latestSentStatelessMocsConfig;
|
using BaseClass::CommandStreamReceiver::latestSentStatelessMocsConfig;
|
||||||
|
using BaseClass::CommandStreamReceiver::requiredThreadArbitrationPolicy;
|
||||||
using BaseClass::CommandStreamReceiver::taskCount;
|
using BaseClass::CommandStreamReceiver::taskCount;
|
||||||
using BaseClass::CommandStreamReceiver::taskLevel;
|
using BaseClass::CommandStreamReceiver::taskLevel;
|
||||||
|
|
||||||
|
@ -106,6 +106,8 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
|||||||
auto refDelayKmdNotifyMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
auto refDelayKmdNotifyMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds;
|
||||||
auto refEnableQuickKmdSleep = hwInfoReference->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep;
|
auto refEnableQuickKmdSleep = hwInfoReference->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep;
|
||||||
auto refDelayQuickKmdSleepMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
auto refDelayQuickKmdSleepMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds;
|
||||||
|
auto refEnableQuickKmdSleepForSporadicWaits = hwInfoReference->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits;
|
||||||
|
auto refDelayQuickKmdSleepForSporadicWaitsMicroseconds = hwInfoReference->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds;
|
||||||
DeviceFactory::releaseDevices();
|
DeviceFactory::releaseDevices();
|
||||||
|
|
||||||
DebugManager.flags.OverrideEnableKmdNotify.set(!refEnableKmdNotify);
|
DebugManager.flags.OverrideEnableKmdNotify.set(!refEnableKmdNotify);
|
||||||
@ -114,6 +116,9 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
|||||||
DebugManager.flags.OverrideEnableQuickKmdSleep.set(!refEnableQuickKmdSleep);
|
DebugManager.flags.OverrideEnableQuickKmdSleep.set(!refEnableQuickKmdSleep);
|
||||||
DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.set(static_cast<int32_t>(refDelayQuickKmdSleepMicroseconds) + 11);
|
DebugManager.flags.OverrideQuickKmdSleepDelayMicroseconds.set(static_cast<int32_t>(refDelayQuickKmdSleepMicroseconds) + 11);
|
||||||
|
|
||||||
|
DebugManager.flags.OverrideEnableQuickKmdSleepForSporadicWaits.set(!refEnableQuickKmdSleepForSporadicWaits);
|
||||||
|
DebugManager.flags.OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds.set(static_cast<int32_t>(refDelayQuickKmdSleepForSporadicWaitsMicroseconds) + 12);
|
||||||
|
|
||||||
success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices);
|
success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices);
|
||||||
ASSERT_TRUE(success);
|
ASSERT_TRUE(success);
|
||||||
|
|
||||||
@ -123,6 +128,11 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
|||||||
EXPECT_EQ(!refEnableQuickKmdSleep, hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
EXPECT_EQ(!refEnableQuickKmdSleep, hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
|
||||||
EXPECT_EQ(refDelayQuickKmdSleepMicroseconds + 11, hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
EXPECT_EQ(refDelayQuickKmdSleepMicroseconds + 11, hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
|
||||||
|
|
||||||
|
EXPECT_EQ(!refEnableQuickKmdSleepForSporadicWaits,
|
||||||
|
hwInfoOverriden->capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
|
||||||
|
EXPECT_EQ(refDelayQuickKmdSleepForSporadicWaitsMicroseconds + 12,
|
||||||
|
hwInfoOverriden->capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
|
||||||
|
|
||||||
DeviceFactory::releaseDevices();
|
DeviceFactory::releaseDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ OverrideEnableKmdNotify = -1
|
|||||||
OverrideKmdNotifyDelayMs = -1
|
OverrideKmdNotifyDelayMs = -1
|
||||||
OverrideEnableQuickKmdSleep = -1
|
OverrideEnableQuickKmdSleep = -1
|
||||||
OverrideQuickKmdSleepDelayMicroseconds = -1
|
OverrideQuickKmdSleepDelayMicroseconds = -1
|
||||||
|
OverrideEnableQuickKmdSleepForSporadicWaits = -1
|
||||||
|
OverrideDelayQuickKmdSleepForSporadicWaitsMicroseconds = -1
|
||||||
Enable64kbpages = -1
|
Enable64kbpages = -1
|
||||||
NodeOrdinal = -1
|
NodeOrdinal = -1
|
||||||
ProductFamilyOverride = unk
|
ProductFamilyOverride = unk
|
||||||
|
Reference in New Issue
Block a user