Skip to content

Commit 67aa1ad

Browse files
jchodorCompute-Runtime-Automation
authored andcommitted
Refactoring HwDeviceId
Signed-off-by: Jaroslaw Chodor <jaroslaw.chodor@intel.com>
1 parent b2fae34 commit 67aa1ad

36 files changed

+126
-85
lines changed

level_zero/core/test/unit_tests/sources/driver/linux/test_driver_handle_imp_linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const uint32_t numSubDevices = 2u;
2525
constexpr int mockFd = 0;
2626
class TestDriverMockDrm : public Drm {
2727
public:
28-
TestDriverMockDrm(std::string &bdf, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd, bdf.c_str()), rootDeviceEnvironment) {}
28+
TestDriverMockDrm(std::string &bdf, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, bdf.c_str()), rootDeviceEnvironment) {}
2929
};
3030

3131
class DriverLinuxFixture : public ::testing::Test {

level_zero/tools/test/unit_tests/sources/sysman/engine/linux/mock_engine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class EngineNeoDrm : public Drm {
3434
public:
3535
using Drm::getEngineInfo;
3636
const int mockFd = 0;
37-
EngineNeoDrm(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd, ""), rootDeviceEnvironment) {}
37+
EngineNeoDrm(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, ""), rootDeviceEnvironment) {}
3838
};
3939
template <>
4040
struct Mock<EngineNeoDrm> : public EngineNeoDrm {

level_zero/tools/test/unit_tests/sources/sysman/linux/mock_sysman_fixture.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace ult {
2626
constexpr int mockFd = 0;
2727
class SysmanMockDrm : public Drm {
2828
public:
29-
SysmanMockDrm(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd, ""), rootDeviceEnvironment) {}
29+
SysmanMockDrm(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, ""), rootDeviceEnvironment) {}
3030
};
3131

3232
class PublicLinuxSysmanImp : public L0::LinuxSysmanImp {

level_zero/tools/test/unit_tests/sources/sysman/memory/linux/mock_memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MemoryNeoDrm : public Drm {
3535
public:
3636
using Drm::memoryInfo;
3737
const int mockFd = 33;
38-
MemoryNeoDrm(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(mockFd, ""), rootDeviceEnvironment) {}
38+
MemoryNeoDrm(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, ""), rootDeviceEnvironment) {}
3939
};
4040

4141
template <>

opencl/source/dll/linux/drm_neo_create.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const DeviceDescriptor deviceDescriptorTable[] = {
3131
#undef NAMEDDEVICE
3232
{0, nullptr, nullptr, GTTYPE_UNDEFINED}};
3333

34-
Drm *Drm::create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
34+
Drm *Drm::create(std::unique_ptr<HwDeviceIdDrm> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
3535
std::unique_ptr<Drm> drmObject;
3636
if (DebugManager.flags.EnableNullHardware.get() == true) {
3737
drmObject.reset(new DrmNullDevice(std::move(hwDeviceId), rootDeviceEnvironment));

opencl/test/unit_test/fixtures/windows/memory_allocator_multi_device_fixture_windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void MemoryAllocatorMultiDeviceSystemSpecificFixture::SetUp(ExecutionEnvironment
2727
for (auto i = 0u; i < executionEnvironment.rootDeviceEnvironments.size(); i++) {
2828
gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[i]->getGmmClientContext(), nullptr, 0, 0, false);
2929
auto wddm = static_cast<WddmMock *>(executionEnvironment.rootDeviceEnvironments[i]->osInterface->getDriverModel()->as<Wddm>());
30-
wddm->hwDeviceId = std::make_unique<HwDeviceId>(ADAPTER_HANDLE, LUID{}, osEnvironment, std::make_unique<UmKmDataTranslator>());
30+
wddm->hwDeviceId = std::make_unique<HwDeviceIdWddm>(ADAPTER_HANDLE, LUID{}, osEnvironment, std::make_unique<UmKmDataTranslator>());
3131
wddm->callBaseMapGpuVa = false;
3232

3333
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();

opencl/test/unit_test/linux/drm_wrap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 Intel Corporation
2+
* Copyright (C) 2019-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -9,6 +9,7 @@
99

1010
#include "shared/source/execution_environment/root_device_environment.h"
1111
#include "shared/source/os_interface/linux/drm_neo.h"
12+
#include "shared/source/os_interface/linux/hw_device_id.h"
1213
#include "shared/source/os_interface/os_interface.h"
1314

1415
#include "drm/i915_drm.h"
@@ -20,7 +21,7 @@ class DrmWrap : public NEO::Drm {
2021
static std::unique_ptr<NEO::Drm> createDrm(RootDeviceEnvironment &rootDeviceEnvironment) {
2122
auto hwDeviceIds = OSInterface::discoverDevices(rootDeviceEnvironment.executionEnvironment);
2223
if (!hwDeviceIds.empty()) {
23-
return std::unique_ptr<Drm>{NEO::Drm::create(std::move(hwDeviceIds[0]), rootDeviceEnvironment)};
24+
return std::unique_ptr<Drm>{NEO::Drm::create(std::unique_ptr<HwDeviceIdDrm>(hwDeviceIds[0].release()->as<HwDeviceIdDrm>()), rootDeviceEnvironment)};
2425
}
2526
return nullptr;
2627
}

opencl/test/unit_test/linux/main_linux_dll.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,16 @@ TEST(DrmTest, GivenSelectedExistingDeviceWhenOpenDirSuccedsThenHwDeviceIdsHavePr
122122
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
123123
EXPECT_EQ(1u, hwDeviceIds.size());
124124
EXPECT_NE(nullptr, hwDeviceIds[0].get());
125-
EXPECT_STREQ("test1", hwDeviceIds[0]->getPciPath());
125+
EXPECT_STREQ("test1", hwDeviceIds[0]->as<HwDeviceIdDrm>()->getPciPath());
126126

127127
entryIndex = 0;
128128
openCounter = 2;
129129
hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
130130
EXPECT_EQ(2u, hwDeviceIds.size());
131131
EXPECT_NE(nullptr, hwDeviceIds[0].get());
132-
EXPECT_STREQ("test1", hwDeviceIds[0]->getPciPath());
132+
EXPECT_STREQ("test1", hwDeviceIds[0]->as<HwDeviceIdDrm>()->getPciPath());
133133
EXPECT_NE(nullptr, hwDeviceIds[1].get());
134-
EXPECT_STREQ("test2", hwDeviceIds[1]->getPciPath());
134+
EXPECT_STREQ("test2", hwDeviceIds[1]->as<HwDeviceIdDrm>()->getPciPath());
135135
}
136136

137137
TEST(DrmTest, GivenSelectedExistingDeviceWhenOpenDirFailsThenRetryOpeningRenderDevices) {
@@ -146,16 +146,16 @@ TEST(DrmTest, GivenSelectedExistingDeviceWhenOpenDirFailsThenRetryOpeningRenderD
146146
EXPECT_STREQ("/dev/dri/renderD128", lastOpenedPath.c_str());
147147
EXPECT_EQ(1u, hwDeviceIds.size());
148148
EXPECT_NE(nullptr, hwDeviceIds[0].get());
149-
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->getPciPath());
149+
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->as<HwDeviceIdDrm>()->getPciPath());
150150

151151
openCounter = 2;
152152
hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
153153
EXPECT_STREQ("/dev/dri/renderD129", lastOpenedPath.c_str());
154154
EXPECT_EQ(2u, hwDeviceIds.size());
155155
EXPECT_NE(nullptr, hwDeviceIds[0].get());
156-
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->getPciPath());
156+
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->as<HwDeviceIdDrm>()->getPciPath());
157157
EXPECT_NE(nullptr, hwDeviceIds[1].get());
158-
EXPECT_STREQ("00:03.0", hwDeviceIds[1]->getPciPath());
158+
EXPECT_STREQ("00:03.0", hwDeviceIds[1]->as<HwDeviceIdDrm>()->getPciPath());
159159
}
160160

161161
TEST(DrmTest, givenPrintIoctlEntriesWhenCallIoctlThenIoctlIsPrinted) {
@@ -286,9 +286,9 @@ TEST(DrmTest, GivenFailingOpenDirAndMultipleAvailableDevicesWhenCreateMultipleRo
286286
EXPECT_STREQ("/dev/dri/renderD129", lastOpenedPath.c_str());
287287
EXPECT_EQ(requestedNumRootDevices, hwDeviceIds.size());
288288
EXPECT_NE(nullptr, hwDeviceIds[0].get());
289-
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->getPciPath());
289+
EXPECT_STREQ("00:02.0", hwDeviceIds[0]->as<HwDeviceIdDrm>()->getPciPath());
290290
EXPECT_NE(nullptr, hwDeviceIds[1].get());
291-
EXPECT_STREQ("00:03.0", hwDeviceIds[1]->getPciPath());
291+
EXPECT_STREQ("00:03.0", hwDeviceIds[1]->as<HwDeviceIdDrm>()->getPciPath());
292292
}
293293

294294
TEST(DrmTest, GivenMultipleAvailableDevicesWhenCreateMultipleRootDevicesFlagIsSetThenTheFlagIsRespected) {
@@ -304,9 +304,9 @@ TEST(DrmTest, GivenMultipleAvailableDevicesWhenCreateMultipleRootDevicesFlagIsSe
304304
EXPECT_STREQ("/dev/dri/by-path/pci-0000:test2-render", lastOpenedPath.c_str());
305305
EXPECT_EQ(requestedNumRootDevices, hwDeviceIds.size());
306306
EXPECT_NE(nullptr, hwDeviceIds[0].get());
307-
EXPECT_STREQ("test1", hwDeviceIds[0]->getPciPath());
307+
EXPECT_STREQ("test1", hwDeviceIds[0]->as<HwDeviceIdDrm>()->getPciPath());
308308
EXPECT_NE(nullptr, hwDeviceIds[1].get());
309-
EXPECT_STREQ("test2", hwDeviceIds[1]->getPciPath());
309+
EXPECT_STREQ("test2", hwDeviceIds[1]->as<HwDeviceIdDrm>()->getPciPath());
310310
}
311311

312312
TEST(DrmTest, GivenSelectedIncorectDeviceWhenGetDeviceFdThenFail) {

opencl/test/unit_test/mocks/mock_wddm.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222

2323
using namespace NEO;
2424

25-
struct mockHwDeviceId : public HwDeviceId {
26-
using HwDeviceId::osEnvironment;
25+
struct mockHwDeviceId : public HwDeviceIdWddm {
26+
using HwDeviceIdWddm::osEnvironment;
2727
};
2828

29-
WddmMock::WddmMock(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::make_unique<HwDeviceId>(ADAPTER_HANDLE, LUID{}, rootDeviceEnvironment.executionEnvironment.osEnvironment.get(), std::make_unique<UmKmDataTranslator>()), rootDeviceEnvironment) {
29+
WddmMock::WddmMock(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::make_unique<HwDeviceIdWddm>(ADAPTER_HANDLE, LUID{}, rootDeviceEnvironment.executionEnvironment.osEnvironment.get(), std::make_unique<UmKmDataTranslator>()), rootDeviceEnvironment) {
3030
if (!rootDeviceEnvironment.executionEnvironment.osEnvironment.get()) {
3131
rootDeviceEnvironment.executionEnvironment.osEnvironment = std::make_unique<OsEnvironmentWin>();
3232
}

opencl/test/unit_test/mocks/mock_wddm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class WddmMock : public Wddm {
4848
using Wddm::timestampFrequency;
4949
using Wddm::wddmInterface;
5050

51-
WddmMock(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::move(hwDeviceId), rootDeviceEnvironment) {}
51+
WddmMock(std::unique_ptr<HwDeviceIdWddm> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::move(hwDeviceId), rootDeviceEnvironment) {}
5252
WddmMock(RootDeviceEnvironment &rootDeviceEnvironment);
5353
~WddmMock();
5454

opencl/test/unit_test/mt_tests/os_interface/linux/drm_memory_manager_mt_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ using namespace NEO;
2525
TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFromMultipleThreadsThenSingleBoIsReused) {
2626
class MockDrm : public Drm {
2727
public:
28-
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd, ""), rootDeviceEnvironment) {}
28+
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(fd, ""), rootDeviceEnvironment) {}
2929

3030
int ioctl(unsigned long request, void *arg) override {
3131
if (request == DRM_IOCTL_PRIME_FD_TO_HANDLE) {
@@ -77,7 +77,7 @@ TEST(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSharedAllocationIsCreatedFro
7777
TEST(DrmMemoryManagerTest, givenMultipleThreadsWhenSharedAllocationIsCreatedThenPrimeFdToHandleDoesNotRaceWithClose) {
7878
class MockDrm : public Drm {
7979
public:
80-
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd, ""), rootDeviceEnvironment) {
80+
MockDrm(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(fd, ""), rootDeviceEnvironment) {
8181
primeFdHandle = 1;
8282
closeHandle = 1;
8383
}

opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
using NEO::constructPlatform;
2929
using NEO::Drm;
30-
using NEO::HwDeviceId;
30+
using NEO::HwDeviceIdDrm;
3131
using NEO::RootDeviceEnvironment;
3232

3333
static const int mockFd = 33;
@@ -36,22 +36,22 @@ static const char *mockPciPath = "";
3636
class DrmMockImpl : public Drm {
3737
public:
3838
DrmMockImpl(int fd) : DrmMockImpl(fd, *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]){};
39-
DrmMockImpl(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd, mockPciPath), rootDeviceEnvironment){};
39+
DrmMockImpl(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(fd, mockPciPath), rootDeviceEnvironment){};
4040

4141
MOCK_METHOD2(ioctl, int(unsigned long request, void *arg));
4242
};
4343

4444
class DrmMockSuccess : public Drm {
4545
public:
4646
DrmMockSuccess() : DrmMockSuccess(mockFd, *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {}
47-
DrmMockSuccess(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd, mockPciPath), rootDeviceEnvironment) {}
47+
DrmMockSuccess(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(fd, mockPciPath), rootDeviceEnvironment) {}
4848

4949
int ioctl(unsigned long request, void *arg) override { return 0; };
5050
};
5151

5252
class DrmMockFail : public Drm {
5353
public:
54-
DrmMockFail() : Drm(std::make_unique<HwDeviceId>(mockFd, mockPciPath), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {}
54+
DrmMockFail() : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, mockPciPath), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {}
5555

5656
int ioctl(unsigned long request, void *arg) override { return -1; };
5757
};
@@ -334,7 +334,7 @@ class DrmMockCustom : public Drm {
334334
ioctl_res_ext = &NONE;
335335
}
336336

337-
DrmMockCustom() : Drm(std::make_unique<HwDeviceId>(mockFd, mockPciPath), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
337+
DrmMockCustom() : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, mockPciPath), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
338338
reset();
339339
ioctl_expected.contextCreate = static_cast<int>(NEO::HwHelper::get(NEO::defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*NEO::defaultHwInfo).size());
340340
ioctl_expected.contextDestroy = ioctl_expected.contextCreate.load();

opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DrmMockForWorker : public Drm {
3737
std::atomic<int> gem_close_cnt;
3838
std::atomic<int> gem_close_expected;
3939
std::atomic<std::thread::id> ioctl_caller_thread_id;
40-
DrmMockForWorker() : Drm(std::make_unique<HwDeviceId>(mockFd, mockPciPath), *platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
40+
DrmMockForWorker() : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, mockPciPath), *platform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) {
4141
}
4242
int ioctl(unsigned long request, void *arg) override {
4343
if (_IOC_TYPE(request) == DRM_IOCTL_BASE) {

opencl/test/unit_test/os_interface/linux/drm_mock.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class DrmMock : public Drm {
4848
using Drm::translateTopologyInfo;
4949
using Drm::virtualMemoryIds;
5050

51-
DrmMock(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceId>(fd, ""), rootDeviceEnvironment) {
51+
DrmMock(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(fd, ""), rootDeviceEnvironment) {
5252
sliceCountChangeSupported = true;
5353

5454
if (rootDeviceEnvironment.executionEnvironment.isDebuggingEnabled()) {
@@ -88,11 +88,11 @@ class DrmMock : public Drm {
8888
}
8989

9090
void setFileDescriptor(int fd) {
91-
hwDeviceId = std::make_unique<HwDeviceId>(fd, "");
91+
hwDeviceId = std::make_unique<HwDeviceIdDrm>(fd, "");
9292
}
9393

9494
void setPciPath(const char *pciPath) {
95-
hwDeviceId = std::make_unique<HwDeviceId>(getFileDescriptor(), pciPath);
95+
hwDeviceId = std::make_unique<HwDeviceIdDrm>(getFileDescriptor(), pciPath);
9696
}
9797

9898
void setDeviceID(int deviceId) { this->deviceId = deviceId; }

opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DrmMockDefault : public DrmMock {
3131
Drm **pDrmToReturnFromCreateFunc = nullptr;
3232
bool disableBindDefaultInTests = true;
3333

34-
Drm *Drm::create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
34+
Drm *Drm::create(std::unique_ptr<HwDeviceIdDrm> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
3535
rootDeviceEnvironment.setHwInfo(defaultHwInfo.get());
3636
if (pDrmToReturnFromCreateFunc) {
3737
return *pDrmToReturnFromCreateFunc;

opencl/test/unit_test/os_interface/linux/drm_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ TEST(HwDeviceId, whenHwDeviceIdIsDestroyedThenFileDescriptorIsClosed) {
440440
SysCalls::closeFuncCalled = 0;
441441
int fileDescriptor = 0x1234;
442442
{
443-
HwDeviceId hwDeviceId(fileDescriptor, "");
443+
HwDeviceIdDrm hwDeviceId(fileDescriptor, "");
444444
}
445445
EXPECT_EQ(1u, SysCalls::closeFuncCalled);
446446
EXPECT_EQ(fileDescriptor, SysCalls::closeFuncArgPassed);

opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace SysCalls {
4545
extern const wchar_t *currentLibraryPath;
4646
}
4747
extern uint32_t numRootDevicesToEnum;
48-
std::unique_ptr<HwDeviceId> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin &osEnvironment, LUID adapterLuid);
48+
std::unique_ptr<HwDeviceIdWddm> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin &osEnvironment, LUID adapterLuid);
4949
} // namespace NEO
5050

5151
using namespace NEO;
@@ -100,7 +100,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp
100100

101101
TEST(WddmDiscoverDevices, WhenNoHwDeviceIdIsProvidedToWddmThenWddmIsNotCreated) {
102102
struct MockWddm : public Wddm {
103-
MockWddm(std::unique_ptr<HwDeviceId> hwDeviceIdIn, RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::move(hwDeviceIdIn), rootDeviceEnvironment) {}
103+
MockWddm(std::unique_ptr<HwDeviceIdWddm> hwDeviceIdIn, RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::move(hwDeviceIdIn), rootDeviceEnvironment) {}
104104
};
105105

106106
MockExecutionEnvironment executionEnvironment;
@@ -1114,7 +1114,8 @@ TEST(WddmGfxPartitionTests, WhenInitializingGfxPartitionThen64KBHeapsAreUsed) {
11141114
struct MockWddm : public Wddm {
11151115
using Wddm::gfxPartition;
11161116

1117-
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment) : Wddm(std::move(OSInterface::discoverDevices(rootDeviceEnvironment.executionEnvironment)[0]), rootDeviceEnvironment) {}
1117+
MockWddm(RootDeviceEnvironment &rootDeviceEnvironment)
1118+
: Wddm(std::unique_ptr<HwDeviceIdWddm>(OSInterface::discoverDevices(rootDeviceEnvironment.executionEnvironment)[0].release()->as<HwDeviceIdWddm>()), rootDeviceEnvironment) {}
11181119
};
11191120

11201121
MockExecutionEnvironment executionEnvironment;
@@ -1357,7 +1358,7 @@ TEST(HwDeviceId, whenHwDeviceIdIsDestroyedThenAdapterIsClosed) {
13571358

13581359
D3DKMT_HANDLE adapter = 0x1234;
13591360
{
1360-
HwDeviceId hwDeviceId{adapter, {}, osEnv.get(), std::make_unique<UmKmDataTranslator>()};
1361+
HwDeviceIdWddm hwDeviceId{adapter, {}, osEnv.get(), std::make_unique<UmKmDataTranslator>()};
13611362
}
13621363
EXPECT_EQ(1u, GdiWithMockedCloseFunc::closeAdapterCalled);
13631364
EXPECT_EQ(adapter, GdiWithMockedCloseFunc::closeAdapterCalledArgPassed);

opencl/test/unit_test/os_interface/windows/wddm_create.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "opencl/test/unit_test/mocks/mock_wddm.h"
99

1010
namespace NEO {
11-
Wddm *Wddm::createWddm(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
11+
Wddm *Wddm::createWddm(std::unique_ptr<HwDeviceIdWddm> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
1212
return new WddmMock(rootDeviceEnvironment);
1313
}
1414
} // namespace NEO

opencl/test/unit_test/os_interface/windows/wddm_kmdaf_listener_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class WddmWithKmDafMock : public Wddm {
3030
using Wddm::mapGpuVirtualAddress;
3131

3232
WddmWithKmDafMock(RootDeviceEnvironment &rootDeviceEnvironment)
33-
: Wddm(std::make_unique<HwDeviceId>(ADAPTER_HANDLE, LUID{}, rootDeviceEnvironment.executionEnvironment.osEnvironment.get(), std::make_unique<UmKmDataTranslator>()),
33+
: Wddm(std::make_unique<HwDeviceIdWddm>(ADAPTER_HANDLE, LUID{}, rootDeviceEnvironment.executionEnvironment.osEnvironment.get(), std::make_unique<UmKmDataTranslator>()),
3434
rootDeviceEnvironment) {
3535
kmDafListener.reset(new KmDafListenerMock);
3636
}

opencl/test/unit_test/windows/wddm_create_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ TEST(wddmCreateTests, givenInputVersionWhenCreatingThenCreateRequestedObject) {
2222
MockExecutionEnvironment executionEnvironment;
2323
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
2424
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
25-
std::unique_ptr<Wddm> wddm(Wddm::createWddm(std::move(hwDeviceIds[0]), rootDeviceEnvironment));
25+
std::unique_ptr<Wddm> wddm(Wddm::createWddm(std::unique_ptr<HwDeviceIdWddm>(hwDeviceIds[0].release()->as<HwDeviceIdWddm>()), rootDeviceEnvironment));
2626
EXPECT_NE(nullptr, wddm);
2727
}

shared/source/os_interface/driver_info.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ struct HardwareInfo;
1717
class OSInterface;
1818

1919
struct PhysicalDevicePciBusInfo {
20+
PhysicalDevicePciBusInfo() = default;
21+
2022
PhysicalDevicePciBusInfo(uint32_t domain, uint32_t bus, uint32_t device, uint32_t function)
2123
: pciDomain(domain), pciBus(bus), pciDevice(device), pciFunction(function) {}
2224

23-
uint32_t pciDomain;
24-
uint32_t pciBus;
25-
uint32_t pciDevice;
26-
uint32_t pciFunction;
25+
static constexpr uint32_t InvalidValue = std::numeric_limits<uint32_t>::max();
26+
static constexpr PhysicalDevicePciBusInfo invalid() { return {}; }
2727

28-
static const uint32_t InvalidValue = std::numeric_limits<uint32_t>::max();
28+
uint32_t pciDomain = InvalidValue;
29+
uint32_t pciBus = InvalidValue;
30+
uint32_t pciDevice = InvalidValue;
31+
uint32_t pciFunction = InvalidValue;
2932
};
3033

3134
class DriverInfo {

0 commit comments

Comments
 (0)