Support for L0 to read Device LUID from the WDDM driver using ext Properties

- Added Support for reading the Device LUID of the given device used in
Windows WDDM.
- Added inital support for passing back the NodeMask of 1.

Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
This commit is contained in:
Spruit, Neil R
2022-07-15 01:28:43 +00:00
committed by Compute-Runtime-Automation
parent 35aff13178
commit 8124bff387
16 changed files with 432 additions and 1 deletions

View File

@@ -61,6 +61,38 @@ struct WddmFixture : public Test<MockExecutionEnvironmentGmmFixture> {
MockWddmResidentAllocationsContainer *mockTemporaryResources;
};
struct WddmFixtureLuid : public Test<MockExecutionEnvironmentGmmFixture> {
void SetUp() override {
MockExecutionEnvironmentGmmFixture::SetUp();
rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
osEnvironment = new OsEnvironmentWin();
gdi = new MockGdi();
osEnvironment->gdi.reset(gdi);
executionEnvironment->osEnvironment.reset(osEnvironment);
wddm = static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment));
rootDeviceEnvironment->osInterface = std::make_unique<OSInterface>();
rootDeviceEnvironment->osInterface->setDriverModel(std::unique_ptr<DriverModel>(wddm));
rootDeviceEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
osInterface = rootDeviceEnvironment->osInterface.get();
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo);
wddm->init();
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
auto engine = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0u, EngineDescriptorHelper::getDefaultDescriptor(engine, preemptionMode));
osContext->ensureContextInitialized();
mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(wddm->temporaryResources.get());
}
WddmMock *wddm = nullptr;
OSInterface *osInterface;
RootDeviceEnvironment *rootDeviceEnvironment = nullptr;
OsEnvironmentWin *osEnvironment = nullptr;
std::unique_ptr<OsContextWin> osContext;
MockGdi *gdi = nullptr;
MockWddmResidentAllocationsContainer *mockTemporaryResources;
};
struct WddmFixtureWithMockGdiDll : public GdiDllFixture, public MockExecutionEnvironmentGmmFixture {
void SetUp() override {
MockExecutionEnvironmentGmmFixture::SetUp();

View File

@@ -10,6 +10,7 @@
#include "shared/test/common/test_macros/hw_test.h"
namespace NEO {
std::unique_ptr<HwDeviceIdWddm> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin &osEnvironment, LUID adapterLuid);
using WddmTests = WddmTestWithMockGdiDll;
@@ -122,6 +123,18 @@ TEST_F(WddmTests, whenGetAdapterLuidThenLuidIsReturned) {
EXPECT_TRUE(luid.HighPart == 0 && luid.LowPart == 0);
}
using WddmOsContextDeviceLuidTests = WddmFixtureLuid;
TEST_F(WddmFixtureLuid, givenValidOsContextAndLuidDataRequestThenValidDataReturned) {
LUID adapterLuid = {0x12, 0x1234};
wddm->hwDeviceId = NEO::createHwDeviceIdFromAdapterLuid(*osEnvironment, adapterLuid);
std::vector<uint8_t> luidData;
size_t arraySize = 8;
osContext->getDeviceLuidArray(luidData, arraySize);
uint64_t luid = 0;
std::memcpy(&luid, luidData.data(), luidData.size() * sizeof(uint8_t));
EXPECT_NE(luid, (uint64_t)0);
}
uint64_t waitForSynchronizationObjectFromCpuCounter = 0u;
NTSTATUS __stdcall waitForSynchronizationObjectFromCpuNoOp(const D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU *waitStruct) {