Skip to content

Commit 2990de5

Browse files
Pass correct descriptor when creating pagefault cmdList
Related-To: NEO-4978 Change-Id: Ib6631407908ad3a86b8dc734e5f3f34bef636743 Signed-off-by: Mateusz Hoppe <[email protected]>
1 parent cb5ab70 commit 2990de5

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

level_zero/core/source/device/device_imp.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,11 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, uint3
582582
}
583583

584584
if (supportDualStorageSharedMemory) {
585-
ze_command_queue_desc_t cmdQueueDesc;
585+
ze_command_queue_desc_t cmdQueueDesc = {};
586586
cmdQueueDesc.ordinal = 0;
587+
cmdQueueDesc.index = 0;
588+
cmdQueueDesc.flags = 0;
589+
cmdQueueDesc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC;
587590
cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
588591
device->pageFaultCommandList =
589592
CommandList::createImmediate(

level_zero/core/test/unit_tests/sources/device/test_device.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "test.h"
1313

14+
#include "level_zero/core/source/cmdqueue/cmdqueue_imp.h"
1415
#include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h"
1516

1617
#include "gtest/gtest.h"
@@ -20,6 +21,25 @@
2021
namespace L0 {
2122
namespace ult {
2223

24+
TEST(L0DeviceTest, GivenDualStorageSharedMemorySupportedWhenCreatingDeviceThenPageFaultCmdListImmediateWithInitializedCmdQIsCreated) {
25+
DebugManagerStateRestore restorer;
26+
NEO::DebugManager.flags.AllocateSharedAllocationsWithCpuAndGpuStorage.set(1);
27+
28+
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);
29+
auto hwInfo = *NEO::defaultHwInfo;
30+
hwInfo.featureTable.ftrLocalMemory = true;
31+
auto neoDevice = std::unique_ptr<NEO::Device>(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
32+
33+
auto device = std::unique_ptr<L0::Device>(Device::create(driverHandle.get(), neoDevice.release(), 1, false));
34+
ASSERT_NE(nullptr, device);
35+
auto deviceImp = static_cast<DeviceImp *>(device.get());
36+
ASSERT_NE(nullptr, deviceImp->pageFaultCommandList);
37+
38+
ASSERT_NE(nullptr, deviceImp->pageFaultCommandList->cmdQImmediate);
39+
EXPECT_NE(nullptr, static_cast<CommandQueueImp *>(deviceImp->pageFaultCommandList->cmdQImmediate)->getCsr());
40+
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast<CommandQueueImp *>(deviceImp->pageFaultCommandList->cmdQImmediate)->getSynchronousMode());
41+
}
42+
2343
struct DeviceTest : public ::testing::Test {
2444
void SetUp() override {
2545
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);

0 commit comments

Comments
 (0)