mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
Do not use max power saving mode in VA sharing scenarios.
-This can be achieved by passing CL_QUEUE_THROTTLE_LOW_KHR as throttle hint to command queue. - This gives much better control about the granularity of this feature instead of triggering this for the whole context user may still have power saving mode queues. Change-Id: I066729f963119ddc1f62ad2785c342af2fea588e Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
cadc461712
commit
bc35cd250a
@@ -146,10 +146,6 @@ class CommandStreamReceiver {
|
||||
bool initializeTagAllocation();
|
||||
MOCKABLE_VIRTUAL std::unique_lock<MutexType> obtainUniqueOwnership();
|
||||
|
||||
KmdNotifyHelper *peekKmdNotifyHelper() {
|
||||
return kmdNotifyHelper.get();
|
||||
}
|
||||
|
||||
bool peekTimestampPacketWriteEnabled() const { return timestampPacketWriteEnabled; }
|
||||
|
||||
size_t defaultSshSize;
|
||||
|
||||
@@ -170,9 +170,6 @@ bool Context::createImpl(const cl_context_properties *properties,
|
||||
if (memoryManager->isAsyncDeleterEnabled()) {
|
||||
memoryManager->getDeferredDeleter()->addClient();
|
||||
}
|
||||
if (this->sharingFunctions[SharingType::VA_SHARING]) {
|
||||
device->initMaxPowerSavingMode();
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &device : devices) {
|
||||
|
||||
@@ -275,12 +275,6 @@ bool Device::isSourceLevelDebuggerActive() const {
|
||||
return deviceInfo.sourceLevelDebuggerActive;
|
||||
}
|
||||
|
||||
void Device::initMaxPowerSavingMode() {
|
||||
for (auto &engine : engines) {
|
||||
engine.commandStreamReceiver->peekKmdNotifyHelper()->initMaxPowerSavingMode();
|
||||
}
|
||||
}
|
||||
|
||||
EngineControl &Device::getEngine(aub_stream::EngineType engineType, bool lowPriority) {
|
||||
for (auto &engine : engines) {
|
||||
if (engine.osContext->getEngineType() == engineType &&
|
||||
|
||||
@@ -65,7 +65,6 @@ class Device : public BaseObject<_cl_device_id> {
|
||||
DeviceInfo *getMutableDeviceInfo();
|
||||
MOCKABLE_VIRTUAL const WorkaroundTable *getWaTable() const;
|
||||
|
||||
void initMaxPowerSavingMode();
|
||||
void *getSLMWindowStartAddress();
|
||||
void prepareSLMWindow();
|
||||
void setForce32BitAddressing(bool value) {
|
||||
|
||||
@@ -35,9 +35,7 @@ bool KmdNotifyHelper::obtainTimeoutParams(int64_t &timeoutValueOutput,
|
||||
|
||||
quickKmdSleepRequest |= applyQuickKmdSleepForSporadicWait();
|
||||
|
||||
if (maxPowerSavingMode) {
|
||||
timeoutValueOutput = 1;
|
||||
} else if (!properties->enableKmdNotify && !acLineConnected) {
|
||||
if (!properties->enableKmdNotify && !acLineConnected) {
|
||||
timeoutValueOutput = KmdNotifyConstants::timeoutInMicrosecondsForDisconnectedAcLine;
|
||||
} else if (quickKmdSleepRequest && properties->enableQuickKmdSleep) {
|
||||
timeoutValueOutput = properties->delayQuickKmdSleepMicroseconds;
|
||||
|
||||
@@ -50,10 +50,6 @@ class KmdNotifyHelper {
|
||||
static void overrideFromDebugVariable(int32_t debugVariableValue, int64_t &destination);
|
||||
static void overrideFromDebugVariable(int32_t debugVariableValue, bool &destination);
|
||||
|
||||
void initMaxPowerSavingMode() {
|
||||
maxPowerSavingMode = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool applyQuickKmdSleepForSporadicWait() const;
|
||||
int64_t getBaseTimeout(const int64_t &multiplier) const;
|
||||
@@ -62,6 +58,5 @@ class KmdNotifyHelper {
|
||||
const KmdNotifyProperties *properties = nullptr;
|
||||
std::atomic<int64_t> lastWaitForCompletionTimestampUs{0};
|
||||
std::atomic<bool> acLineConnected{true};
|
||||
bool maxPowerSavingMode = false;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -48,7 +48,6 @@ struct KmdNotifyTests : public ::testing::Test {
|
||||
using KmdNotifyHelper::acLineConnected;
|
||||
using KmdNotifyHelper::getMicrosecondsSinceEpoch;
|
||||
using KmdNotifyHelper::lastWaitForCompletionTimestampUs;
|
||||
using KmdNotifyHelper::maxPowerSavingMode;
|
||||
using KmdNotifyHelper::properties;
|
||||
|
||||
MockKmdNotifyHelper() = delete;
|
||||
@@ -348,25 +347,6 @@ TEST_F(KmdNotifyTests, givenDisabledKmdNotifyMechanismWhenAcLineIsDisconnectedTh
|
||||
EXPECT_EQ(10000, KmdNotifyConstants::timeoutInMicrosecondsForDisconnectedAcLine);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenKmdNotifyEnabledWhenInitMaxPowerSavingModeIsCalledThenObtainReturnOneAsWaitValue) {
|
||||
localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = true;
|
||||
MockKmdNotifyHelper helper(&(localHwInfo.capabilityTable.kmdNotifyProperties));
|
||||
|
||||
EXPECT_FALSE(helper.maxPowerSavingMode);
|
||||
|
||||
int64_t timeout = 0;
|
||||
bool timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, 2, false);
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
EXPECT_EQ(2, timeout);
|
||||
|
||||
helper.initMaxPowerSavingMode();
|
||||
EXPECT_TRUE(helper.maxPowerSavingMode);
|
||||
timeoutEnabled = helper.obtainTimeoutParams(timeout, false, 1, 2, 2, false);
|
||||
EXPECT_TRUE(timeoutEnabled);
|
||||
|
||||
EXPECT_EQ(1, timeout);
|
||||
}
|
||||
|
||||
TEST_F(KmdNotifyTests, givenEnabledKmdNotifyMechanismWhenAcLineIsDisconnectedThenDontChangeTimeoutValue) {
|
||||
localHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify = true;
|
||||
localHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds = 5;
|
||||
|
||||
@@ -235,59 +235,3 @@ TEST(Context, givenMockSharingBuilderWhenContextWithInvalidPropertiesThenContext
|
||||
context.reset(Context::create<Context>(validProperties, deviceVector, nullptr, nullptr, retVal));
|
||||
EXPECT_NE(nullptr, context.get());
|
||||
};
|
||||
|
||||
TEST(Context, GivenVaContextWhenItIsCreatedItInitializesPowerSavingMode) {
|
||||
SharingFactoryStateRestore stateRestore;
|
||||
stateRestore.clearCurrentState();
|
||||
stateRestore.registerSharing<VAMockSharingBuilderFactory>(SharingType::VA_SHARING);
|
||||
|
||||
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
||||
cl_device_id clDevice = static_cast<cl_device_id>(device.get());
|
||||
cl_int retVal;
|
||||
|
||||
cl_platform_id platformId[] = {platform()};
|
||||
|
||||
auto &commandStreamReceiver = device->getCommandStreamReceiver();
|
||||
auto kmdNotifyHelper = commandStreamReceiver.peekKmdNotifyHelper();
|
||||
|
||||
int64_t timeout = 0;
|
||||
kmdNotifyHelper->obtainTimeoutParams(timeout, true, 1, 10, 2, false);
|
||||
EXPECT_NE(1, timeout);
|
||||
|
||||
cl_context_properties validProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)platformId[0],
|
||||
clContextPropertyMock, mockContextPassFinalize, 0};
|
||||
|
||||
std::unique_ptr<MockContext> ctx(Context::create<MockContext>(validProperties, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, ctx);
|
||||
kmdNotifyHelper->obtainTimeoutParams(timeout, true, 1, 10, 2, false);
|
||||
EXPECT_EQ(1, timeout);
|
||||
}
|
||||
|
||||
TEST(Context, GivenNonVaContextWhenItIsCreatedItInitializesPowerSavingMode) {
|
||||
SharingFactoryStateRestore stateRestore;
|
||||
stateRestore.clearCurrentState();
|
||||
stateRestore.registerSharing<MockSharingBuilderFactory>(SharingType::CLGL_SHARING);
|
||||
|
||||
auto device = std::make_unique<MockDevice>(*platformDevices[0]);
|
||||
cl_device_id clDevice = static_cast<cl_device_id>(device.get());
|
||||
cl_int retVal;
|
||||
|
||||
cl_platform_id platformId[] = {platform()};
|
||||
|
||||
auto &commandStreamReceiver = device->getCommandStreamReceiver();
|
||||
auto kmdNotifyHelper = commandStreamReceiver.peekKmdNotifyHelper();
|
||||
|
||||
int64_t timeout = 0;
|
||||
kmdNotifyHelper->obtainTimeoutParams(timeout, true, 1, 10, 2, false);
|
||||
EXPECT_NE(1, timeout);
|
||||
|
||||
cl_context_properties validProperties[5] = {CL_CONTEXT_PLATFORM, (cl_context_properties)platformId[0],
|
||||
clContextPropertyMock, mockContextPassFinalize, 0};
|
||||
|
||||
std::unique_ptr<MockContext> ctx(Context::create<MockContext>(validProperties, DeviceVector(&clDevice, 1), nullptr, nullptr, retVal));
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_NE(nullptr, ctx);
|
||||
kmdNotifyHelper->obtainTimeoutParams(timeout, true, 1, 10, 2, false);
|
||||
EXPECT_NE(1, timeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user