mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Refactor Device::engineGroups to store only available engine groups
Simplify logic around engine groups. Remove no longer needed code. Ensure correct device is used when verifying engine groups. Related-To: NEO-6219 Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a1121ccb6b
commit
2098b0c3fa
@@ -99,8 +99,8 @@ HWTEST2_F(DeviceCopyQueueGroupTest,
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
EXPECT_NE(i, static_cast<uint32_t>(NEO::EngineGroupType::Copy));
|
||||
for (auto &engineGroup : neoMockDevice->getEngineGroups()) {
|
||||
EXPECT_NE(NEO::EngineGroupType::Copy, engineGroup.engineGroupType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,21 +125,22 @@ HWTEST2_F(DeviceQueueGroupTest,
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (i == static_cast<uint32_t>(NEO::EngineGroupType::RenderCompute)) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::RenderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Compute)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Compute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t));
|
||||
@@ -170,21 +171,22 @@ HWTEST2_F(DeviceQueueGroupTest,
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_EQ(2u, count);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (i == static_cast<uint32_t>(NEO::EngineGroupType::RenderCompute)) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::RenderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Compute)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Compute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t));
|
||||
@@ -212,15 +214,16 @@ HWTEST2_F(DeviceQueueGroupTest,
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(NEO::EngineGroupType::RenderCompute)) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::RenderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
} else if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(NEO::EngineGroupType::Copy)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t));
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
@@ -254,15 +257,16 @@ HWTEST2_F(DeviceQueueGroupTest,
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
L0::Context *context = Context::fromHandle(hContext);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(NEO::EngineGroupType::RenderCompute)) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::RenderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
} else if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(NEO::EngineGroupType::Copy)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t));
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
|
||||
@@ -212,8 +212,9 @@ HWTEST2_F(CommandQueueGroupMultiDevice,
|
||||
|
||||
L0::CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
|
||||
L0::DeviceImp *deviceImp = reinterpret_cast<L0::DeviceImp *>(device);
|
||||
const auto rcsIndex = static_cast<size_t>(NEO::EngineGroupType::RenderCompute);
|
||||
auto expectedCSR = deviceImp->neoDevice->getNearestGenericSubDevice(0)->getEngineGroups()[rcsIndex][queueGroupIndex].commandStreamReceiver;
|
||||
auto &nearestSubDevice = *deviceImp->neoDevice->getNearestGenericSubDevice(0);
|
||||
const auto rcsIndex = nearestSubDevice.getEngineGroupIndexFromEngineGroupType(NEO::EngineGroupType::RenderCompute);
|
||||
auto expectedCSR = nearestSubDevice.getEngineGroups()[rcsIndex].engines[queueGroupIndex].commandStreamReceiver;
|
||||
EXPECT_EQ(cmdQueue->getCsr(), expectedCSR);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ struct Mock<Device> : public Device {
|
||||
ADDMETHOD_NOBASE(getSysmanHandle, SysmanDevice *, nullptr, ());
|
||||
ADDMETHOD_NOBASE(getCsrForOrdinalAndIndex, ze_result_t, ZE_RESULT_SUCCESS, (NEO::CommandStreamReceiver * *csr, uint32_t ordinal, uint32_t index));
|
||||
ADDMETHOD_NOBASE(getCsrForLowPriority, ze_result_t, ZE_RESULT_SUCCESS, (NEO::CommandStreamReceiver * *csr));
|
||||
ADDMETHOD_NOBASE(mapOrdinalForAvailableEngineGroup, ze_result_t, ZE_RESULT_SUCCESS, (uint32_t * ordinal));
|
||||
ADDMETHOD_NOBASE(getDebugProperties, ze_result_t, ZE_RESULT_SUCCESS, (zet_device_debug_properties_t * properties));
|
||||
ADDMETHOD_NOBASE(getDebugSession, DebugSession *, nullptr, (const zet_debug_config_t &config));
|
||||
ADDMETHOD_NOBASE_VOIDRETURN(removeDebugSession, ());
|
||||
|
||||
@@ -1224,17 +1224,9 @@ TEST_F(CommandListCreate, whenInvokingAppendMemoryCopyFromContextForImmediateCom
|
||||
}
|
||||
|
||||
TEST_F(CommandListCreate, givenQueueDescriptionwhenCreatingImmediateCommandListForEveryEnigneThenItHasImmediateCommandQueueCreated) {
|
||||
auto &engines = neoDevice->getEngineGroups();
|
||||
uint32_t numaAvailableEngineGroups = 0;
|
||||
for (uint32_t ordinal = 0; ordinal < CommonConstants::engineGroupCount; ordinal++) {
|
||||
if (engines[ordinal].size()) {
|
||||
numaAvailableEngineGroups++;
|
||||
}
|
||||
}
|
||||
for (uint32_t ordinal = 0; ordinal < numaAvailableEngineGroups; ordinal++) {
|
||||
uint32_t engineGroupIndex = ordinal;
|
||||
device->mapOrdinalForAvailableEngineGroup(&engineGroupIndex);
|
||||
for (uint32_t index = 0; index < engines[engineGroupIndex].size(); index++) {
|
||||
auto &engineGroups = neoDevice->getEngineGroups();
|
||||
for (uint32_t ordinal = 0; ordinal < engineGroups.size(); ordinal++) {
|
||||
for (uint32_t index = 0; index < engineGroups[ordinal].engines.size(); index++) {
|
||||
ze_command_queue_desc_t desc = {};
|
||||
desc.ordinal = ordinal;
|
||||
desc.index = index;
|
||||
|
||||
@@ -1217,17 +1217,9 @@ TEST_F(CommandListCreate, whenCreatingImmCmdListWithASyncModeAndAppendEventReset
|
||||
}
|
||||
|
||||
TEST_F(CommandListCreateWithBcs, givenQueueDescriptionwhenCreatingImmediateCommandListForCopyEnigneThenItHasImmediateCommandQueueCreated) {
|
||||
auto &engines = neoDevice->getEngineGroups();
|
||||
uint32_t numaAvailableEngineGroups = 0;
|
||||
for (uint32_t ordinal = 0; ordinal < CommonConstants::engineGroupCount; ordinal++) {
|
||||
if (engines[ordinal].size()) {
|
||||
numaAvailableEngineGroups++;
|
||||
}
|
||||
}
|
||||
for (uint32_t ordinal = 0; ordinal < numaAvailableEngineGroups; ordinal++) {
|
||||
uint32_t engineGroupIndex = ordinal;
|
||||
device->mapOrdinalForAvailableEngineGroup(&engineGroupIndex);
|
||||
for (uint32_t index = 0; index < engines[engineGroupIndex].size(); index++) {
|
||||
auto &engineGroups = neoDevice->getEngineGroups();
|
||||
for (uint32_t ordinal = 0; ordinal < engineGroups.size(); ordinal++) {
|
||||
for (uint32_t index = 0; index < engineGroups[ordinal].engines.size(); index++) {
|
||||
ze_command_queue_desc_t desc = {};
|
||||
desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
|
||||
desc.ordinal = ordinal;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
@@ -923,14 +924,7 @@ HWTEST_F(CommandListCreate, WhenReservingSpaceThenCommandsAddedToBatchBuffer) {
|
||||
}
|
||||
|
||||
TEST_F(CommandListCreate, givenOrdinalBiggerThanAvailableEnginesWhenCreatingCommandListThenInvalidArgumentErrorIsReturned) {
|
||||
auto &engineGroups = neoDevice->getEngineGroups();
|
||||
uint32_t numAvailableEngineGroups = 0;
|
||||
for (uint32_t ordinal = 0; ordinal < CommonConstants::engineGroupCount; ordinal++) {
|
||||
if (engineGroups[ordinal].size()) {
|
||||
numAvailableEngineGroups++;
|
||||
}
|
||||
}
|
||||
|
||||
auto numAvailableEngineGroups = static_cast<uint32_t>(neoDevice->getEngineGroups().size());
|
||||
ze_command_list_handle_t commandList = nullptr;
|
||||
ze_command_list_desc_t desc = {ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC};
|
||||
desc.commandQueueGroupOrdinal = numAvailableEngineGroups;
|
||||
@@ -952,5 +946,46 @@ TEST_F(CommandListCreate, givenOrdinalBiggerThanAvailableEnginesWhenCreatingComm
|
||||
EXPECT_EQ(nullptr, commandList);
|
||||
}
|
||||
|
||||
TEST_F(CommandListCreate, givenRootDeviceAndImplicitScalingDisabledWhenCreatingCommandListThenValidateQueueOrdinalUsingSubDeviceEngines) {
|
||||
NEO::UltDeviceFactory deviceFactory{1, 2};
|
||||
auto &rootDevice = *deviceFactory.rootDevices[0];
|
||||
auto &subDevice0 = *deviceFactory.subDevices[0];
|
||||
rootDevice.engineGroups.resize(1);
|
||||
subDevice0.getEngineGroups().push_back(NEO::Device::EngineGroupT{});
|
||||
subDevice0.getEngineGroups().back().engineGroupType = EngineGroupType::Compute;
|
||||
subDevice0.getEngineGroups().back().engines.resize(1);
|
||||
subDevice0.getEngineGroups().back().engines[0].commandStreamReceiver = &rootDevice.getGpgpuCommandStreamReceiver();
|
||||
auto ordinal = static_cast<uint32_t>(subDevice0.getEngineGroups().size() - 1);
|
||||
Mock<L0::DeviceImp> l0RootDevice(&rootDevice, rootDevice.getExecutionEnvironment());
|
||||
|
||||
ze_command_list_handle_t commandList = nullptr;
|
||||
ze_command_list_desc_t cmdDesc = {ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC};
|
||||
cmdDesc.commandQueueGroupOrdinal = ordinal;
|
||||
ze_command_queue_desc_t queueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
|
||||
queueDesc.ordinal = ordinal;
|
||||
queueDesc.index = 0;
|
||||
|
||||
l0RootDevice.multiDeviceCapable = true;
|
||||
auto returnValue = l0RootDevice.createCommandList(&cmdDesc, &commandList);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, returnValue);
|
||||
EXPECT_EQ(nullptr, commandList);
|
||||
|
||||
returnValue = l0RootDevice.createCommandListImmediate(&queueDesc, &commandList);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, returnValue);
|
||||
EXPECT_EQ(nullptr, commandList);
|
||||
|
||||
l0RootDevice.multiDeviceCapable = false;
|
||||
returnValue = l0RootDevice.createCommandList(&cmdDesc, &commandList);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
EXPECT_NE(nullptr, commandList);
|
||||
L0::CommandList::fromHandle(commandList)->destroy();
|
||||
commandList = nullptr;
|
||||
|
||||
returnValue = l0RootDevice.createCommandListImmediate(&queueDesc, &commandList);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
EXPECT_NE(nullptr, commandList);
|
||||
L0::CommandList::fromHandle(commandList)->destroy();
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/test/common/libult/ult_command_stream_receiver.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/mock_memory_operations_handler.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
@@ -37,17 +38,9 @@ TEST_F(ContextCreateCommandQueueTest, givenCallToContextCreateCommandQueueThenCa
|
||||
|
||||
HWTEST_F(ContextCreateCommandQueueTest, givenEveryPossibleGroupIndexWhenCreatingCommandQueueThenCommandQueueIsCreated) {
|
||||
ze_command_queue_handle_t commandQueue = {};
|
||||
auto &engines = neoDevice->getEngineGroups();
|
||||
uint32_t numaAvailableEngineGroups = 0;
|
||||
for (uint32_t ordinal = 0; ordinal < CommonConstants::engineGroupCount; ordinal++) {
|
||||
if (engines[ordinal].size()) {
|
||||
numaAvailableEngineGroups++;
|
||||
}
|
||||
}
|
||||
for (uint32_t ordinal = 0; ordinal < numaAvailableEngineGroups; ordinal++) {
|
||||
uint32_t engineGroupIndex = ordinal;
|
||||
device->mapOrdinalForAvailableEngineGroup(&engineGroupIndex);
|
||||
for (uint32_t index = 0; index < engines[engineGroupIndex].size(); index++) {
|
||||
auto &engineGroups = neoDevice->getEngineGroups();
|
||||
for (uint32_t ordinal = 0; ordinal < engineGroups.size(); ordinal++) {
|
||||
for (uint32_t index = 0; index < engineGroups[ordinal].engines.size(); index++) {
|
||||
ze_command_queue_desc_t desc = {};
|
||||
desc.ordinal = ordinal;
|
||||
desc.index = index;
|
||||
@@ -60,17 +53,11 @@ HWTEST_F(ContextCreateCommandQueueTest, givenEveryPossibleGroupIndexWhenCreating
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(ContextCreateCommandQueueTest, givenOrdinalBigerThanAvailableEnginesWhenCreatingCommandQueueThenInvalidArgReturned) {
|
||||
HWTEST_F(ContextCreateCommandQueueTest, givenOrdinalBiggerThanAvailableEnginesWhenCreatingCommandQueueThenInvalidArgumentErrorIsReturned) {
|
||||
ze_command_queue_handle_t commandQueue = {};
|
||||
auto &engines = neoDevice->getEngineGroups();
|
||||
uint32_t numaAvailableEngineGroups = 0;
|
||||
for (uint32_t ordinal = 0; ordinal < CommonConstants::engineGroupCount; ordinal++) {
|
||||
if (engines[ordinal].size()) {
|
||||
numaAvailableEngineGroups++;
|
||||
}
|
||||
}
|
||||
ze_command_queue_desc_t desc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
|
||||
desc.ordinal = numaAvailableEngineGroups;
|
||||
auto &engineGroups = neoDevice->getEngineGroups();
|
||||
ze_command_queue_desc_t desc = {};
|
||||
desc.ordinal = static_cast<uint32_t>(engineGroups.size());
|
||||
desc.index = 0;
|
||||
ze_result_t res = context->createCommandQueue(device, &desc, &commandQueue);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, res);
|
||||
@@ -83,6 +70,35 @@ HWTEST_F(ContextCreateCommandQueueTest, givenOrdinalBigerThanAvailableEnginesWhe
|
||||
EXPECT_EQ(nullptr, commandQueue);
|
||||
}
|
||||
|
||||
HWTEST_F(ContextCreateCommandQueueTest, givenRootDeviceAndImplicitScalingDisabledWhenCreatingCommandQueueThenValidateQueueOrdinalUsingSubDeviceEngines) {
|
||||
NEO::UltDeviceFactory deviceFactory{1, 2};
|
||||
auto &rootDevice = *deviceFactory.rootDevices[0];
|
||||
auto &subDevice0 = *deviceFactory.subDevices[0];
|
||||
rootDevice.engineGroups.resize(1);
|
||||
subDevice0.getEngineGroups().push_back(NEO::Device::EngineGroupT{});
|
||||
subDevice0.getEngineGroups().back().engineGroupType = EngineGroupType::Compute;
|
||||
subDevice0.getEngineGroups().back().engines.resize(1);
|
||||
subDevice0.getEngineGroups().back().engines[0].commandStreamReceiver = &rootDevice.getGpgpuCommandStreamReceiver();
|
||||
auto ordinal = static_cast<uint32_t>(subDevice0.getEngineGroups().size() - 1);
|
||||
Mock<L0::DeviceImp> l0RootDevice(&rootDevice, rootDevice.getExecutionEnvironment());
|
||||
|
||||
ze_command_queue_handle_t commandQueue = nullptr;
|
||||
ze_command_queue_desc_t desc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
|
||||
desc.ordinal = ordinal;
|
||||
desc.index = 0;
|
||||
|
||||
l0RootDevice.multiDeviceCapable = true;
|
||||
ze_result_t res = context->createCommandQueue(l0RootDevice.toHandle(), &desc, &commandQueue);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, res);
|
||||
EXPECT_EQ(nullptr, commandQueue);
|
||||
|
||||
l0RootDevice.multiDeviceCapable = false;
|
||||
res = context->createCommandQueue(l0RootDevice.toHandle(), &desc, &commandQueue);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_NE(nullptr, commandQueue);
|
||||
L0::CommandQueue::fromHandle(commandQueue)->destroy();
|
||||
}
|
||||
|
||||
using AubCsrTest = Test<AubCsrFixture>;
|
||||
|
||||
HWTEST_TEMPLATED_F(AubCsrTest, givenAubCsrWhenCallingExecuteCommandListsThenPollForCompletionIsCalled) {
|
||||
|
||||
@@ -80,22 +80,23 @@ HWTEST2_F(DeviceQueueGroupTest, givenBlitterSupportAndCCSThenThreeQueueGroupsAre
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (i == static_cast<uint32_t>(NEO::EngineGroupType::RenderCompute)) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::RenderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Compute)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Compute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
uint32_t numerOfCCSEnabled = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
|
||||
EXPECT_EQ(properties[i].numQueues, numerOfCCSEnabled);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, hwInfo.featureTable.ftrBcsInfo.count());
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t));
|
||||
@@ -137,8 +138,8 @@ HWTEST2_F(DeviceCopyQueueGroupTest,
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
EXPECT_NE(i, static_cast<uint32_t>(NEO::EngineGroupType::Copy));
|
||||
for (auto &engineGroup : neoMockDevice->getEngineGroups()) {
|
||||
EXPECT_NE(NEO::EngineGroupType::Copy, engineGroup.engineGroupType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,22 +60,23 @@ HWTEST2_F(DeviceQueueGroupTest, givenBlitterSupportAndCCSThenThreeQueueGroupsAre
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
auto &engineGroups = neoMockDevice->getEngineGroups();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
if (i == static_cast<uint32_t>(NEO::EngineGroupType::RenderCompute)) {
|
||||
if (engineGroups[i].engineGroupType == NEO::EngineGroupType::RenderCompute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[i].numQueues, 1u);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Compute)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Compute) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
uint32_t numerOfCCSEnabled = hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
|
||||
EXPECT_EQ(properties[i].numQueues, numerOfCCSEnabled);
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, std::numeric_limits<size_t>::max());
|
||||
} else if (i == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
|
||||
} else if (engineGroups[i].engineGroupType == NEO::EngineGroupType::Copy) {
|
||||
EXPECT_TRUE(properties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_EQ(properties[i].numQueues, hwInfo.featureTable.ftrBcsInfo.count());
|
||||
EXPECT_EQ(properties[i].maxMemoryFillPatternSize, 4 * sizeof(uint32_t));
|
||||
@@ -117,8 +118,8 @@ HWTEST2_F(DeviceCopyQueueGroupTest,
|
||||
res = deviceImp.getCommandQueueGroupProperties(&count, properties.data());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
EXPECT_NE(i, static_cast<uint32_t>(NEO::EngineGroupType::Copy));
|
||||
for (auto &engineGroup : neoMockDevice->getEngineGroups()) {
|
||||
EXPECT_NE(NEO::EngineGroupType::Copy, engineGroup.engineGroupType);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user