Add cl_khr_device_uuid to extension list

Related-To: NEO-5681

Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com>
This commit is contained in:
Baj, Tomasz
2022-05-11 14:08:18 +00:00
committed by Compute-Runtime-Automation
parent d5b2f03dc4
commit b450d3c20b
23 changed files with 362 additions and 51 deletions

View File

@ -68,7 +68,8 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
size_t value = 0u;
ClDeviceInfoParam param{};
const void *src = nullptr;
std::array<uint8_t, HwInfoConfig::uuidSize> deviceUuid;
std::array<uint8_t, CL_UUID_SIZE_KHR> uuid;
std::array<uint8_t, CL_LUID_SIZE_KHR> luid;
// clang-format off
// please keep alphabetical order
@ -294,12 +295,36 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
retSize = srcSize = sizeof(deviceInfo.pciBusInfo);
}
break;
case CL_DEVICE_UUID_KHR: {
device.generateUuid(deviceUuid);
src = &deviceUuid;
retSize = srcSize = sizeof(deviceUuid);
case CL_DEVICE_UUID_KHR:
device.generateUuid(uuid);
src = uuid.data();
retSize = srcSize = CL_UUID_SIZE_KHR;
break;
case CL_DRIVER_UUID_KHR:
const void *tmpUuid;
getStr<CL_DRIVER_UUID_KHR>(tmpUuid, srcSize, retSize);
uuid.fill(0);
memcpy_s(uuid.data(), srcSize, tmpUuid, srcSize);
src = uuid.data();
retSize = srcSize = CL_UUID_SIZE_KHR;
break;
case CL_DEVICE_LUID_VALID_KHR:
param.boolean = device.verifyAdapterLuid();
src = &param.boolean;
retSize = srcSize = sizeof(cl_bool);
break;
case CL_DEVICE_LUID_KHR:
memcpy_s(luid.data(), CL_LUID_SIZE_KHR, paramValue, CL_LUID_SIZE_KHR);
device.getAdapterLuid(luid);
src = luid.data();
retSize = srcSize = CL_LUID_SIZE_KHR;
break;
case CL_DEVICE_NODE_MASK_KHR:
memcpy_s(&param.uint, sizeof(cl_uint), paramValue, paramValueSize);
device.getAdapterMask(param.uint);
src = &param.uint;
retSize = srcSize = sizeof(cl_uint);
break;
}
default:
if (getDeviceInfoForImage(paramName, src, srcSize, retSize) && !getSharedDeviceInfo().imageSupport) {
src = &value;

View File

@ -171,6 +171,7 @@ template<> struct Map<CL_DEVICE_TYPE > :
template<> struct Map<CL_DEVICE_VENDOR > : public ClMapBase<CL_DEVICE_VENDOR, const char *, &ClDeviceInfo::vendor> {};
template<> struct Map<CL_DEVICE_VERSION > : public ClMapBase<CL_DEVICE_VERSION, const char *, &ClDeviceInfo::clVersion> {};
template<> struct Map<CL_DRIVER_VERSION > : public ClMapBase<CL_DRIVER_VERSION, const char *, &ClDeviceInfo::driverVersion> {};
template<> struct Map<CL_DRIVER_UUID_KHR > : public ClMapBase<CL_DRIVER_UUID_KHR, const char *, &ClDeviceInfo::driverVersion> {};
template<> struct Map<CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT > : public ClMapBase<CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT, uint32_t, &ClDeviceInfo::workGroupCollectiveFunctionsSupport> {};
// clang-format on

View File

@ -255,6 +255,7 @@ TEST_F(clGetDeviceInfoTests, GivenClDeviceExtensionsParamWhenGettingDeviceInfoTh
std::string extensionString(paramValue.get());
static const char *const supportedExtensions[] = {
"cl_khr_byte_addressable_store ",
"cl_khr_device_uuid ",
"cl_khr_fp16 ",
"cl_khr_global_int32_base_atomics ",
"cl_khr_global_int32_extended_atomics ",

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2021 Intel Corporation
# Copyright (C) 2018-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@ -17,7 +17,11 @@ set(IGDRCL_SRCS_tests_device
if(WIN32)
list(APPEND IGDRCL_SRCS_tests_device
${CMAKE_CURRENT_SOURCE_DIR}/device_win_timers_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/windows/device_windows_tests.cpp
)
else()
list(APPEND IGDRCL_SRCS_tests_device
${CMAKE_CURRENT_SOURCE_DIR}/linux/device_linux_tests.cpp
)
endif()
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_device})

View File

@ -1,42 +0,0 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_ostime.h"
#include "shared/test/common/mocks/mock_ostime_win.h"
#include "shared/test/common/mocks/mock_wddm.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "gtest/gtest.h"
using namespace NEO;
namespace ULT {
typedef ::testing::Test MockOSTimeWinTest;
TEST_F(MockOSTimeWinTest, WhenCreatingTimerThenResolutionIsSetCorrectly) {
MockExecutionEnvironment executionEnvironment;
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
auto wddmMock = new WddmMock(rootDeviceEnvironment);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
wddmMock->init();
wddmMock->timestampFrequency = 1000;
std::unique_ptr<MockOSTimeWin> timeWin(new MockOSTimeWin(wddmMock));
double res = 0.0;
res = timeWin->getDynamicDeviceTimerResolution(device->getHardwareInfo());
EXPECT_EQ(res, 1e+06);
}
} // namespace ULT

View File

@ -970,6 +970,7 @@ cl_device_info deviceInfoParams[] = {
CL_DEVICE_VENDOR_ID,
CL_DEVICE_VERSION,
CL_DRIVER_VERSION,
CL_DRIVER_UUID_KHR,
};
INSTANTIATE_TEST_CASE_P(
@ -1043,7 +1044,7 @@ TEST(GetDeviceInfoTest, givenPciBusInfoIsNotAvailableWhenGettingPciBusInfoForDev
}
TEST(GetDeviceInfo, givenDeviceUuidWhenGettingDeviceInfoThenGenerateDeviceUuid) {
std::array<uint8_t, HwInfoConfig::uuidSize> generateDeviceUuid, deviceUuidKHR;
std::array<uint8_t, CL_UUID_SIZE_KHR> generateDeviceUuid, deviceUuidKHR;
size_t retSize = 0;
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
using namespace NEO;
namespace ULT {
TEST(GetDeviceInfo, givenClDeviceWhenGettingDeviceInfoThenBadAdapterLuidIsReturned) {
std::array<uint8_t, CL_LUID_SIZE_KHR> deviceLuidKHR, expectLuid = {0, 1, 2, 3, 4, 5, 6, 7};
deviceLuidKHR = expectLuid;
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto retVal = clDevice->getDeviceInfo(CL_DEVICE_LUID_KHR, CL_LUID_SIZE_KHR, deviceLuidKHR.data(), 0);
ASSERT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(deviceLuidKHR, expectLuid);
}
TEST(GetDeviceInfo, givenClDeviceWhenGettingDeviceInfoThenLuidIsInvalid) {
cl_bool isValid = true;
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto retVal = clDevice->getDeviceInfo(CL_DEVICE_LUID_VALID_KHR, sizeof(cl_bool), &isValid, 0);
ASSERT_EQ(retVal, CL_SUCCESS);
EXPECT_FALSE(isValid);
}
TEST(GetDeviceInfo, givenClDeviceWhenGettingDeviceInfoThenNodeMaskIsUnchanged) {
cl_uint nodeMask = 0x1234u;
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
auto retVal = clDevice->getDeviceInfo(CL_DEVICE_NODE_MASK_KHR, sizeof(cl_uint), &nodeMask, 0);
ASSERT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(nodeMask, 0x1234u);
}
} // namespace ULT

View File

@ -0,0 +1,79 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_ostime.h"
#include "shared/test/common/mocks/mock_ostime_win.h"
#include "shared/test/common/mocks/mock_wddm.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
using namespace NEO;
namespace ULT {
typedef ::testing::Test MockOSTimeWinTest;
TEST_F(MockOSTimeWinTest, whenCreatingTimerThenResolutionIsSetCorrectly) {
MockExecutionEnvironment executionEnvironment;
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
auto wddmMock = new WddmMock(rootDeviceEnvironment);
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
wddmMock->init();
wddmMock->timestampFrequency = 1000;
std::unique_ptr<MockOSTimeWin> timeWin(new MockOSTimeWin(wddmMock));
double res = 0.0;
res = timeWin->getDynamicDeviceTimerResolution(device->getHardwareInfo());
EXPECT_EQ(res, 1e+06);
}
TEST(GetDeviceInfo, givenClDeviceWhenGettingDeviceInfoThenCorrectAdapterLuidIsReturned) {
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
clDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
auto mockWddm = new WddmMock(*clDevice->executionEnvironment->rootDeviceEnvironments[0]);
clDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockWddm));
std::array<uint8_t, CL_LUID_SIZE_KHR> deviceLuidKHR;
auto luid = clDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Wddm>()->getAdapterLuid();
auto retVal = clDevice->getDeviceInfo(CL_DEVICE_LUID_KHR, CL_LUID_SIZE_KHR, deviceLuidKHR.data(), 0);
ASSERT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(std::memcmp(deviceLuidKHR.data(), &luid, CL_LUID_SIZE_KHR), 0);
}
TEST(GetDeviceInfo, givenClDeviceWhenVerifyAdapterLuidThenGetTrue) {
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
clDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
auto mockWddm = new WddmMock(*clDevice->executionEnvironment->rootDeviceEnvironments[0]);
clDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockWddm));
cl_bool isValid = false;
auto retVal = clDevice->getDeviceInfo(CL_DEVICE_LUID_VALID_KHR, sizeof(cl_bool), &isValid, 0);
ASSERT_EQ(retVal, CL_SUCCESS);
EXPECT_TRUE(isValid);
}
TEST(GetDeviceInfo, givenClDeviceWhenGettingDeviceInfoThenGetNodeMask) {
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
clDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
auto mockWddm = new WddmMock(*clDevice->executionEnvironment->rootDeviceEnvironments[0]);
clDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockWddm));
cl_uint nodeMask = 0b0;
auto retVal = clDevice->getDeviceInfo(CL_DEVICE_NODE_MASK_KHR, sizeof(cl_uint), &nodeMask, 0);
ASSERT_EQ(retVal, CL_SUCCESS);
EXPECT_EQ(nodeMask, 0b1);
}
} // namespace ULT

View File

@ -16,6 +16,7 @@
namespace NEO {
const char *deviceExtensionsList = "cl_khr_byte_addressable_store "
"cl_khr_device_uuid "
"cl_khr_fp16 "
"cl_khr_global_int32_base_atomics "
"cl_khr_global_int32_extended_atomics "

View File

@ -16,6 +16,15 @@ set(NEO_CORE_DEVICE
${CMAKE_CURRENT_SOURCE_DIR}/sub_device.h
${CMAKE_CURRENT_SOURCE_DIR}/device_get_device_name.cpp
)
if(WIN32)
list(APPEND NEO_CORE_DEVICE
${CMAKE_CURRENT_SOURCE_DIR}/windows/device_windows.cpp
)
else()
list(APPEND NEO_CORE_DEVICE
${CMAKE_CURRENT_SOURCE_DIR}/linux/device_linux.cpp
)
endif()
set_property(GLOBAL PROPERTY NEO_CORE_DEVICE ${NEO_CORE_DEVICE})
add_subdirectories()

View File

@ -715,6 +715,12 @@ void Device::generateUuid(std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) {
memcpy_s(&uuid[8], sizeof(uint32_t), &rootDeviceIndex, sizeof(rootDeviceIndex));
}
void Device::getAdapterMask(uint32_t &nodeMask) {
if (verifyAdapterLuid()) {
nodeMask = 1;
}
}
void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
DEBUG_BREAK_IF(rtDispatchGlobals.size() < maxBvhLevels + 1);
DEBUG_BREAK_IF(rtDispatchGlobals[maxBvhLevels] != nullptr);

View File

@ -138,6 +138,9 @@ class Device : public ReferenceTrackedObject<Device> {
const std::vector<SubDevice *> getSubDevices() const { return subdevices; }
bool getUuid(std::array<uint8_t, HwInfoConfig::uuidSize> &uuid);
void generateUuid(std::array<uint8_t, HwInfoConfig::uuidSize> &uuid);
void getAdapterLuid(std::array<uint8_t, HwInfoConfig::luidSize> &luid);
MOCKABLE_VIRTUAL bool verifyAdapterLuid();
void getAdapterMask(uint32_t &nodeMask);
protected:
Device() = delete;

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device/device.h"
namespace NEO {
void Device::getAdapterLuid(std::array<uint8_t, HwInfoConfig::luidSize> &luid) {}
bool Device::verifyAdapterLuid() { return false; }
} // namespace NEO

View File

@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device/device.h"
#include "shared/source/os_interface/windows/wddm/wddm.h"
namespace NEO {
void Device::getAdapterLuid(std::array<uint8_t, HwInfoConfig::luidSize> &luid) {
const LUID adapterLuid = getRootDeviceEnvironment().osInterface->getDriverModel()->as<Wddm>()->getAdapterLuid();
memcpy_s(&luid, HwInfoConfig::luidSize, &adapterLuid, sizeof(luid));
}
bool Device::verifyAdapterLuid() {
const LUID adapterLuid = getRootDeviceEnvironment().osInterface->getDriverModel()->as<Wddm>()->getAdapterLuid();
return getRootDeviceEnvironment().osInterface->getDriverModel()->as<Wddm>()->verifyAdapterLuid(adapterLuid);
}
} // namespace NEO

View File

@ -45,6 +45,7 @@ class HwInfoConfig {
return hwInfoConfigFactory[product];
}
static constexpr uint32_t uuidSize = 16u;
static constexpr uint32_t luidSize = 8u;
int configureHwInfoWddm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface);
int configureHwInfoDrm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, OSInterface *osIface);
virtual int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) = 0;

View File

@ -98,6 +98,12 @@ void MockDevice::resetCommandStreamReceiver(CommandStreamReceiver *newCsr, uint3
}
}
bool MockDevice::verifyAdapterLuid() {
if (callBaseVerifyAdapterLuid)
return Device::verifyAdapterLuid();
return verifyAdapterLuidReturnValue;
}
bool MockSubDevice::createEngine(uint32_t deviceCsrIndex, EngineTypeUsage engineTypeUsage) {
if (failOnCreateEngine) {
return false;

View File

@ -163,11 +163,15 @@ class MockDevice : public RootDevice {
return isDebuggerActiveReturn;
}
bool verifyAdapterLuid() override;
static decltype(&createCommandStream) createCommandStreamReceiverFunc;
bool isDebuggerActiveParentCall = true;
bool isDebuggerActiveReturn = false;
bool callBaseGetMaxParameterSizeFromIGC = false;
bool callBaseVerifyAdapterLuid = true;
bool verifyAdapterLuidReturnValue = true;
size_t maxParameterSizeFromIGC = 0u;
};

View File

@ -94,6 +94,7 @@ class WddmMock : public Wddm {
}
return verifyAdapterLuidReturnValue;
}
LUID getAdapterLuid() { return hwDeviceId->getAdapterLuid(); }
bool setAllocationPriority(const D3DKMT_HANDLE *handles, uint32_t allocationCount, uint32_t priority) override;
bool configureDeviceAddressSpace() {
@ -164,6 +165,7 @@ class WddmMock : public Wddm {
NTSTATUS createAllocationStatus = STATUS_SUCCESS;
bool verifyAdapterLuidReturnValue = true;
bool callBaseVerifyAdapterLuid = false;
LUID mockAdaperLuid = {0, 0};
bool mapGpuVaStatus = true;
bool callBaseDestroyAllocations = true;
bool failOpenSharedHandle = false;

View File

@ -0,0 +1,13 @@
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(UNIX)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/neo_device_linux_tests.cpp
)
endif()
add_subdirectories()

View File

@ -0,0 +1,41 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device/device.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h"
using DeviceTest = Test<DeviceFixture>;
TEST_F(DeviceTest, GivenDeviceWhenGetAdapterLuidThenLuidIsNotSet) {
std::array<uint8_t, HwInfoConfig::luidSize> luid, expectedLuid;
expectedLuid.fill(-1);
luid = expectedLuid;
pDevice->getAdapterLuid(luid);
EXPECT_EQ(expectedLuid, luid);
}
TEST_F(DeviceTest, GivenDeviceWhenVerifyAdapterLuidThenFalseIsReturned) {
EXPECT_FALSE(pDevice->verifyAdapterLuid());
}
TEST_F(DeviceTest, GivenDeviceWhenGetAdapterMaskThenMaskIsNotSet) {
uint32_t nodeMask = 0x1234u;
pDevice->getAdapterMask(nodeMask);
EXPECT_EQ(nodeMask, 0x1234u);
}
TEST_F(DeviceTest, GivenCallBaseVerifyAdapterLuidWhenGetAdapterMaskThenMaskIsSet) {
uint32_t nodeMask = 0x1234u;
pDevice->callBaseVerifyAdapterLuid = false;
pDevice->getAdapterMask(nodeMask);
EXPECT_EQ(nodeMask, 1u);
}

View File

@ -0,0 +1,13 @@
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(WIN32)
target_sources(${TARGET_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/neo_device_windows_tests.cpp
)
endif()
add_subdirectories()

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device/device.h"
#include "shared/source/os_interface/windows/wddm/wddm.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_wddm.h"
#include "shared/test/common/test_macros/test.h"
using DeviceTest = Test<DeviceFixture>;
TEST_F(DeviceTest, GivenDeviceWhenGetAdapterLuidThenLuidIsSet) {
std::array<uint8_t, HwInfoConfig::luidSize> luid, expectedLuid;
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
auto mockWddm = new WddmMock(*pDevice->executionEnvironment->rootDeviceEnvironments[0]);
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockWddm));
memcpy_s(expectedLuid.data(), HwInfoConfig::luidSize, &mockWddm->mockAdaperLuid, sizeof(LUID));
pDevice->getAdapterLuid(luid);
EXPECT_EQ(expectedLuid, luid);
}
TEST_F(DeviceTest, GivenDeviceWhenVerifyAdapterLuidThenTrueIsReturned) {
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
auto mockWddm = new WddmMock(*pDevice->executionEnvironment->rootDeviceEnvironments[0]);
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockWddm));
EXPECT_TRUE(pDevice->verifyAdapterLuid());
}
TEST_F(DeviceTest, GivenFailingVerifyAdapterLuidWhenGetAdapterMaskThenMaskIsNotSet) {
uint32_t nodeMask = 0x1234u;
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
auto mockWddm = new WddmMock(*pDevice->executionEnvironment->rootDeviceEnvironments[0]);
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockWddm));
pDevice->callBaseVerifyAdapterLuid = false;
pDevice->verifyAdapterLuidReturnValue = false;
pDevice->getAdapterMask(nodeMask);
EXPECT_EQ(nodeMask, 0x1234u);
}
TEST_F(DeviceTest, GivenDeviceWhenGetAdapterMaskThenMaskIsSet) {
uint32_t nodeMask = 0x1234u;
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new NEO::OSInterface);
auto mockWddm = new WddmMock(*pDevice->executionEnvironment->rootDeviceEnvironments[0]);
pDevice->executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(mockWddm));
pDevice->getAdapterMask(nodeMask);
EXPECT_EQ(nodeMask, 1u);
}

View File

@ -114,6 +114,14 @@ TEST(WddmPciSpeedInfoTest, WhenGetPciSpeedInfoIsCalledThenUnknownIsReturned) {
EXPECT_EQ(-1, speedInfo.maxBandwidth);
}
TEST_F(WddmTests, whenGetAdapterLuidThenLuidIsReturned) {
HwDeviceIdWddm *hwDeviceId = new HwDeviceIdWddm(0, {0, 0}, executionEnvironment->osEnvironment.get(), nullptr);
wddm->hwDeviceId.reset(hwDeviceId);
auto luid = wddm->getAdapterLuid();
EXPECT_TRUE(luid.HighPart == 0 && luid.LowPart == 0);
}
uint64_t waitForSynchronizationObjectFromCpuCounter = 0u;
NTSTATUS __stdcall waitForSynchronizationObjectFromCpuNoOp(const D3DKMT_WAITFORSYNCHRONIZATIONOBJECTFROMCPU *waitStruct) {