L0Debug Win: initialize device with empty submission

In case of debuggable context device should be additionally
initialized by early empty submission issue.

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2022-09-19 13:34:14 +00:00
committed by Compute-Runtime-Automation
parent 56cb1f757b
commit 43676ed02a
11 changed files with 66 additions and 3 deletions

View File

@ -168,6 +168,7 @@ class MockCommandStreamReceiver : public CommandStreamReceiver {
}
return isLocked;
}
void initializeDeviceWithFirstSubmission() override {}
static constexpr size_t tagSize = 256;
static volatile uint32_t mockTagAddress[tagSize];

View File

@ -11,6 +11,7 @@
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_host_ptr_manager.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include "shared/test/common/test_macros/mock_method_macros.h"
namespace NEO {
@ -392,6 +393,19 @@ class MockMemoryManagerOsAgnosticContext : public MockMemoryManager {
}
};
class MockMemoryManagerWithDebuggableOsContext : public MockMemoryManager {
public:
MockMemoryManagerWithDebuggableOsContext(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver,
const EngineDescriptor &engineDescriptor) override {
auto osContext = new MockOsContext(0, engineDescriptor);
osContext->debuggableContext = true;
osContext->incRefInternal();
registeredEngines.emplace_back(commandStreamReceiver, osContext);
return osContext;
}
};
class MockMemoryManagerWithCapacity : public MockMemoryManager {
public:
MockMemoryManagerWithCapacity(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(executionEnvironment) {}

View File

@ -12,6 +12,7 @@ namespace NEO {
class MockOsContext : public OsContext {
public:
using OsContext::checkDirectSubmissionSupportsEngine;
using OsContext::debuggableContext;
using OsContext::engineType;
using OsContext::engineUsage;
using OsContext::getDeviceBitfield;
@ -20,4 +21,5 @@ class MockOsContext : public OsContext {
: OsContext(contextId, engineDescriptorHelper) {}
};
static_assert(sizeof(OsContext) == sizeof(MockOsContext));
} // namespace NEO
} // namespace NEO

View File

@ -536,3 +536,32 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZexNumberOfCssEnvVariableSetAmbig
EXPECT_EQ(defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled, computeEngineGroup.engines.size());
}
}
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenDebuggableOsContextWhenDeviceCreatesEnginesThenDeviceIsInitializedWithFirstSubmission) {
auto hwInfo = *defaultHwInfo;
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, 0);
MockExecutionEnvironment executionEnvironment(&hwInfo);
executionEnvironment.memoryManager.reset(new MockMemoryManagerWithDebuggableOsContext(executionEnvironment));
executionEnvironment.incRefInternal();
UltDeviceFactory deviceFactory{1, 0, executionEnvironment};
auto device = deviceFactory.rootDevices[0];
auto csr = device->allEngines[device->defaultEngineIndex].commandStreamReceiver;
EXPECT_EQ(1u, csr->peekLatestSentTaskCount());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenNonDebuggableOsContextWhenDeviceCreatesEnginesThenDeviceIsNotInitializedWithFirstSubmission) {
auto hwInfo = *defaultHwInfo;
hardwareInfoSetup[hwInfo.platform.eProductFamily](&hwInfo, true, 0);
MockExecutionEnvironment executionEnvironment(&hwInfo);
executionEnvironment.incRefInternal();
UltDeviceFactory deviceFactory{1, 0, executionEnvironment};
auto device = deviceFactory.rootDevices[0];
auto csr = device->allEngines[device->defaultEngineIndex].commandStreamReceiver;
EXPECT_EQ(0u, csr->peekLatestSentTaskCount());
}