Change notify delay to use microseconds.

- Microseconds offer better precision.
- Some workloads require threshold less then 1 millisecond to work
efficiently.

Change-Id: I1a565049340fb6eeebe5c0a61ededae9959daca8
This commit is contained in:
Mrozek, Michal
2018-02-27 07:40:15 +01:00
parent 3da9df23a9
commit cd747b7b8c
21 changed files with 33 additions and 33 deletions

View File

@@ -176,7 +176,7 @@ void CommandStreamReceiver::cleanupResources() {
} }
} }
bool CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait) { bool CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait) {
std::chrono::high_resolution_clock::time_point time1, time2; std::chrono::high_resolution_clock::time_point time1, time2;
int64_t timeDiff = 0; int64_t timeDiff = 0;
@@ -186,10 +186,10 @@ bool CommandStreamReceiver::waitForCompletionWithTimeout(bool enableTimeout, int
} }
time1 = std::chrono::high_resolution_clock::now(); time1 = std::chrono::high_resolution_clock::now();
while (*getTagAddress() < taskCountToWait && timeDiff <= timeoutMs) { while (*getTagAddress() < taskCountToWait && timeDiff <= timeoutMicroseconds) {
if (enableTimeout) { if (enableTimeout) {
time2 = std::chrono::high_resolution_clock::now(); time2 = std::chrono::high_resolution_clock::now();
timeDiff = std::chrono::duration_cast<std::chrono::milliseconds>(time2 - time1).count(); timeDiff = std::chrono::duration_cast<std::chrono::microseconds>(time2 - time1).count();
} }
} }
if (*getTagAddress() >= taskCountToWait) { if (*getTagAddress() >= taskCountToWait) {

View File

@@ -112,7 +112,7 @@ class CommandStreamReceiver {
void requestThreadArbitrationPolicy(uint32_t requiredPolicy) { this->requiredThreadArbitrationPolicy = requiredPolicy; } void requestThreadArbitrationPolicy(uint32_t requiredPolicy) { this->requiredThreadArbitrationPolicy = requiredPolicy; }
virtual void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait) = 0; virtual void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait) = 0;
MOCKABLE_VIRTUAL bool waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMs, uint32_t taskCountToWait); MOCKABLE_VIRTUAL bool waitForCompletionWithTimeout(bool enableTimeout, int64_t timeoutMicroseconds, uint32_t taskCountToWait);
// returns size of block that needs to be reserved at the beginning of each instruction heap for CommandStreamReceiver // returns size of block that needs to be reserved at the beginning of each instruction heap for CommandStreamReceiver
MOCKABLE_VIRTUAL size_t getInstructionHeapCmdStreamReceiverReservedSize() const; MOCKABLE_VIRTUAL size_t getInstructionHeapCmdStreamReceiverReservedSize() const;

View File

@@ -550,11 +550,11 @@ inline void CommandStreamReceiverHw<GfxFamily>::emitNoop(LinearStream &commandSt
template <typename GfxFamily> template <typename GfxFamily>
inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait) { inline void CommandStreamReceiverHw<GfxFamily>::waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait) {
auto status = waitForCompletionWithTimeout(this->hwInfo.capabilityTable.enableKmdNotify, this->hwInfo.capabilityTable.delayKmdNotifyMs, taskCountToWait); auto status = waitForCompletionWithTimeout(this->hwInfo.capabilityTable.enableKmdNotify, this->hwInfo.capabilityTable.delayKmdNotifyMicroseconds, 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, this->hwInfo.capabilityTable.delayKmdNotifyMs, taskCountToWait); waitForCompletionWithTimeout(false, this->hwInfo.capabilityTable.delayKmdNotifyMicroseconds, taskCountToWait);
} }
UNRECOVERABLE_IF(*getTagAddress() < taskCountToWait); UNRECOVERABLE_IF(*getTagAddress() < taskCountToWait);

View File

@@ -70,7 +70,7 @@ const RuntimeCapabilityTable BDW::capabilityTable{
true, true,
true, // forceStatelessCompilationFor32Bit true, // forceStatelessCompilationFor32Bit
false, // EnableKmdNotify false, // EnableKmdNotify
30, // delayKmdNotifyMs 30000, // delayKmdNotifyMicroseconds
false, // ftr64KBpages false, // ftr64KBpages
EngineType::ENGINE_RCS // defaultEngineType EngineType::ENGINE_RCS // defaultEngineType
}; };

View File

@@ -66,7 +66,7 @@ const RuntimeCapabilityTable BXT::capabilityTable{
true, true,
false, // forceStatelessCompilationFor32Bit false, // forceStatelessCompilationFor32Bit
false, // EnableKmdNotify false, // EnableKmdNotify
30, // delayKmdNotifyMs 30000, // delayKmdNotifyMicroseconds
false, // ftr64KBpages false, // ftr64KBpages
EngineType::ENGINE_RCS // defaultEngineType EngineType::ENGINE_RCS // defaultEngineType
}; };

View File

@@ -61,7 +61,7 @@ const RuntimeCapabilityTable CFL::capabilityTable{
true, true,
true, // forceStatelessCompilationFor32Bit true, // forceStatelessCompilationFor32Bit
false, // EnableKmdNotify false, // EnableKmdNotify
30, // delayKmdNotifyMs 30000, // delayKmdNotifyMicroseconds
true, // ftr64KBpages true, // ftr64KBpages
EngineType::ENGINE_RCS // defaultEngineType EngineType::ENGINE_RCS // defaultEngineType
}; };

View File

@@ -61,7 +61,7 @@ const RuntimeCapabilityTable GLK::capabilityTable{
true, true,
false, // forceStatelessCompilationFor32Bit false, // forceStatelessCompilationFor32Bit
true, // EnableKmdNotify true, // EnableKmdNotify
30, // delayKmdNotifyMs 30000, // delayKmdNotifyMicroseconds
false, // ftr64KBpages false, // ftr64KBpages
EngineType::ENGINE_RCS // defaultEngineType EngineType::ENGINE_RCS // defaultEngineType
}; };

View File

@@ -61,7 +61,7 @@ const RuntimeCapabilityTable KBL::capabilityTable{
true, true,
true, // forceStatelessCompilationFor32Bit true, // forceStatelessCompilationFor32Bit
false, // EnableKmdNotify false, // EnableKmdNotify
30, // delayKmdNotifyMs 30000, // delayKmdNotifyMicroseconds
true, // ftr64KBpages true, // ftr64KBpages
EngineType::ENGINE_RCS // defaultEngineType EngineType::ENGINE_RCS // defaultEngineType
}; };

View File

@@ -69,7 +69,7 @@ const RuntimeCapabilityTable SKL::capabilityTable{
true, true,
true, // forceStatelessCompilationFor32Bit true, // forceStatelessCompilationFor32Bit
false, // EnableKmdNotify false, // EnableKmdNotify
30, // delayKmdNotifyMs 30000, // delayKmdNotifyMicroseconds
true, // ftr64KBpages true, // ftr64KBpages
EngineType::ENGINE_RCS // defaultEngineType EngineType::ENGINE_RCS // defaultEngineType
}; };

View File

@@ -65,7 +65,7 @@ struct RuntimeCapabilityTable {
bool forceStatelessCompilationFor32Bit; bool forceStatelessCompilationFor32Bit;
bool enableKmdNotify; bool enableKmdNotify;
int64_t delayKmdNotifyMs; int64_t delayKmdNotifyMicroseconds;
bool ftr64KBpages; bool ftr64KBpages;
EngineType defaultEngineType; EngineType defaultEngineType;

View File

@@ -73,7 +73,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, Enable64kbpages, -1, "-1: default behaviour, 0 D
DECLARE_DEBUG_VARIABLE(bool, EnableComputeWorkSizeND, true, "Enables diffrent algorithm to compute local work size") DECLARE_DEBUG_VARIABLE(bool, EnableComputeWorkSizeND, true, "Enables diffrent algorithm to compute local work size")
DECLARE_DEBUG_VARIABLE(bool, EnableComputeWorkSizeSquared, false, "Enables algorithm to compute the most squared work group as possible") DECLARE_DEBUG_VARIABLE(bool, EnableComputeWorkSizeSquared, false, "Enables algorithm to compute the most squared work group as possible")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideEnableKmdNotify, -1, "-1: dont override, 0: disable, 1: enable") DECLARE_DEBUG_VARIABLE(int32_t, OverrideEnableKmdNotify, -1, "-1: dont override, 0: disable, 1: enable")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideKmdNotifyDelayMs, -1, "-1: dont override, 0: infinite timeout, >0: timeout in ms") DECLARE_DEBUG_VARIABLE(int32_t, OverrideKmdNotifyDelayMicroseconds, -1, "-1: dont override, 0: infinite timeout, >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*/

View File

@@ -185,9 +185,9 @@ int HwInfoConfig::configureHwInfo(const HardwareInfo *inHwInfo, HardwareInfo *ou
? !!DebugManager.flags.OverrideEnableKmdNotify.get() ? !!DebugManager.flags.OverrideEnableKmdNotify.get()
: outHwInfo->capabilityTable.enableKmdNotify; : outHwInfo->capabilityTable.enableKmdNotify;
outHwInfo->capabilityTable.delayKmdNotifyMs = DebugManager.flags.OverrideKmdNotifyDelayMs.get() >= 0 outHwInfo->capabilityTable.delayKmdNotifyMicroseconds = DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get() >= 0
? static_cast<int64_t>(DebugManager.flags.OverrideKmdNotifyDelayMs.get()) ? static_cast<int64_t>(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get())
: outHwInfo->capabilityTable.delayKmdNotifyMs; : outHwInfo->capabilityTable.delayKmdNotifyMicroseconds;
pPlatform.release(); pPlatform.release();
pSkuTable.release(); pSkuTable.release();

View File

@@ -90,9 +90,9 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
? !!DebugManager.flags.OverrideEnableKmdNotify.get() ? !!DebugManager.flags.OverrideEnableKmdNotify.get()
: tempHwInfos[devNum].capabilityTable.enableKmdNotify; : tempHwInfos[devNum].capabilityTable.enableKmdNotify;
tempHwInfos[devNum].capabilityTable.delayKmdNotifyMs = DebugManager.flags.OverrideKmdNotifyDelayMs.get() >= 0 tempHwInfos[devNum].capabilityTable.delayKmdNotifyMicroseconds = DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get() >= 0
? static_cast<int64_t>(DebugManager.flags.OverrideKmdNotifyDelayMs.get()) ? static_cast<int64_t>(DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.get())
: tempHwInfos[devNum].capabilityTable.delayKmdNotifyMs; : tempHwInfos[devNum].capabilityTable.delayKmdNotifyMicroseconds;
numDevices = 1; numDevices = 1;
*pHWInfos = tempHwInfos; *pHWInfos = tempHwInfos;

View File

@@ -666,7 +666,7 @@ struct KmdNotifyTests : public ::testing::Test {
} }
DebugManagerStateRestore stateRestore; DebugManagerStateRestore stateRestore;
DebugManager.flags.OverrideEnableKmdNotify.set(overrideEnable); DebugManager.flags.OverrideEnableKmdNotify.set(overrideEnable);
DebugManager.flags.OverrideKmdNotifyDelayMs.set(overrideTimeout); DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.set(overrideTimeout);
size_t numDevices; size_t numDevices;
HardwareInfo *hwInfo = nullptr; HardwareInfo *hwInfo = nullptr;
DeviceFactory::getDevices(&hwInfo, numDevices); DeviceFactory::getDevices(&hwInfo, numDevices);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -57,7 +57,7 @@ GEN8TEST_F(Gen8DeviceCaps, whitelistedRegister) {
GEN8TEST_F(Gen8DeviceCaps, kmdNotifyMechanism) { GEN8TEST_F(Gen8DeviceCaps, kmdNotifyMechanism) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify);
EXPECT_EQ(30, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMs); EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMicroseconds);
} }
GEN8TEST_F(Gen8DeviceCaps, compression) { GEN8TEST_F(Gen8DeviceCaps, compression) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -86,5 +86,5 @@ BXTTEST_F(BxtUsDeviceIdTest, isSimulationCap) {
BXTTEST_F(BxtUsDeviceIdTest, kmdNotifyMechanism) { BXTTEST_F(BxtUsDeviceIdTest, kmdNotifyMechanism) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify);
EXPECT_EQ(30, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMs); EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMicroseconds);
} }

View File

@@ -35,7 +35,7 @@ CFLTEST_F(CflDeviceCaps, reportsOcl21) {
CFLTEST_F(CflDeviceCaps, kmdNotifyMechanism) { CFLTEST_F(CflDeviceCaps, kmdNotifyMechanism) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify);
EXPECT_EQ(30, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMs); EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMicroseconds);
} }
CFLTEST_F(CflDeviceCaps, GivenCFLWhenCheckftr64KBpagesThenTrue) { CFLTEST_F(CflDeviceCaps, GivenCFLWhenCheckftr64KBpagesThenTrue) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -75,7 +75,7 @@ GLKTEST_F(GlkUsDeviceIdTest, isSimulationCap) {
GLKTEST_F(GlkUsDeviceIdTest, kmdNotifyMechanism) { GLKTEST_F(GlkUsDeviceIdTest, kmdNotifyMechanism) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify); EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify);
EXPECT_EQ(30, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMs); EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMicroseconds);
} }
GLKTEST_F(GlkUsDeviceIdTest, GivenGLKWhenCheckftr64KBpagesThenFalse) { GLKTEST_F(GlkUsDeviceIdTest, GivenGLKWhenCheckftr64KBpagesThenFalse) {

View File

@@ -35,7 +35,7 @@ KBLTEST_F(KblDeviceCaps, reportsOcl21) {
KBLTEST_F(KblDeviceCaps, kmdNotifyMechanism) { KBLTEST_F(KblDeviceCaps, kmdNotifyMechanism) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify);
EXPECT_EQ(30, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMs); EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMicroseconds);
} }
KBLTEST_F(KblDeviceCaps, GivenKBLWhenCheckftr64KBpagesThenTrue) { KBLTEST_F(KblDeviceCaps, GivenKBLWhenCheckftr64KBpagesThenTrue) {

View File

@@ -83,7 +83,7 @@ SKLTEST_F(SklUsDeviceIdTest, isSimulationCap) {
SKLTEST_F(SklUsDeviceIdTest, kmdNotifyMechanism) { SKLTEST_F(SklUsDeviceIdTest, kmdNotifyMechanism) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify); EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.enableKmdNotify);
EXPECT_EQ(30, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMs); EXPECT_EQ(30000, pDevice->getHardwareInfo().capabilityTable.delayKmdNotifyMicroseconds);
} }
SKLTEST_F(SklUsDeviceIdTest, GivenSKLWhenCheckftr64KBpagesThenTrue) { SKLTEST_F(SklUsDeviceIdTest, GivenSKLWhenCheckftr64KBpagesThenTrue) {

View File

@@ -102,17 +102,17 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
bool success = DeviceFactory::getDevices(&hwInfoReference, numDevices); bool success = DeviceFactory::getDevices(&hwInfoReference, numDevices);
ASSERT_TRUE(success); ASSERT_TRUE(success);
auto refEnableKmdNotify = hwInfoReference->capabilityTable.enableKmdNotify; auto refEnableKmdNotify = hwInfoReference->capabilityTable.enableKmdNotify;
auto refDelayKmdNotifyMs = hwInfoReference->capabilityTable.delayKmdNotifyMs; auto refDelayKmdNotifyMicroseconds = hwInfoReference->capabilityTable.delayKmdNotifyMicroseconds;
DeviceFactory::releaseDevices(); DeviceFactory::releaseDevices();
DebugManager.flags.OverrideEnableKmdNotify.set(!refEnableKmdNotify); DebugManager.flags.OverrideEnableKmdNotify.set(!refEnableKmdNotify);
DebugManager.flags.OverrideKmdNotifyDelayMs.set(static_cast<int32_t>(refDelayKmdNotifyMs) + 10); DebugManager.flags.OverrideKmdNotifyDelayMicroseconds.set(static_cast<int32_t>(refDelayKmdNotifyMicroseconds) + 10);
success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices); success = DeviceFactory::getDevices(&hwInfoOverriden, numDevices);
ASSERT_TRUE(success); ASSERT_TRUE(success);
EXPECT_EQ(!refEnableKmdNotify, hwInfoOverriden->capabilityTable.enableKmdNotify); EXPECT_EQ(!refEnableKmdNotify, hwInfoOverriden->capabilityTable.enableKmdNotify);
EXPECT_EQ(refDelayKmdNotifyMs + 10, hwInfoOverriden->capabilityTable.delayKmdNotifyMs); EXPECT_EQ(refDelayKmdNotifyMicroseconds + 10, hwInfoOverriden->capabilityTable.delayKmdNotifyMicroseconds);
DeviceFactory::releaseDevices(); DeviceFactory::releaseDevices();
} }