Change order of command queue groups

Resolves: NEO-6257
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-09-16 14:53:49 +00:00
committed by Compute-Runtime-Automation
parent 4fbabed397
commit eace896ec8
7 changed files with 66 additions and 12 deletions

View File

@@ -211,14 +211,14 @@ HWTEST2_F(DeviceQueueGroupTest,
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
for (uint32_t i = 0; i < count; i++) {
if (i == static_cast<uint32_t>(NEO::EngineGroupType::RenderCompute)) {
if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(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 == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
} else if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(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);
@@ -253,14 +253,14 @@ HWTEST2_F(DeviceQueueGroupTest,
L0::Context *context = Context::fromHandle(hContext);
for (uint32_t i = 0; i < count; i++) {
if (i == static_cast<uint32_t>(NEO::EngineGroupType::RenderCompute)) {
if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(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 == static_cast<uint32_t>(NEO::EngineGroupType::Copy)) {
} else if (i == neoMockDevice->getIndexOfNonEmptyEngineGroup(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);

View File

@@ -211,7 +211,8 @@ HWTEST2_F(CommandQueueGroupMultiDevice,
L0::CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
L0::DeviceImp *deviceImp = reinterpret_cast<L0::DeviceImp *>(device);
auto expectedCSR = deviceImp->neoDevice->getNearestGenericSubDevice(0)->getEngineGroups()[queueGroupOrdinal][queueGroupIndex].commandStreamReceiver;
const auto rcsIndex = static_cast<size_t>(NEO::EngineGroupType::RenderCompute);
auto expectedCSR = deviceImp->neoDevice->getNearestGenericSubDevice(0)->getEngineGroups()[rcsIndex][queueGroupIndex].commandStreamReceiver;
EXPECT_EQ(cmdQueue->getCsr(), expectedCSR);
}

View File

@@ -1677,7 +1677,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenBcsFamilySelectedWhenCreatingQu
EXPECT_EQ(properties[3], queueBcs.getQueueIndexWithinFamily());
}
HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenCreatingQueueThenInitializeOsContext) {
HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedRcsOsContextWhenCreatingQueueThenInitializeOsContext) {
DebugManagerStateRestore restore{};
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_RCS));
DebugManager.flags.DeferOsContextInitialization.set(1);
@@ -1689,7 +1689,27 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenC
OsContext &osContext = *context.getDevice(0)->getEngine(aub_stream::ENGINE_CCS, EngineUsage::Regular).osContext;
EXPECT_FALSE(osContext.isInitialized());
fillProperties(properties, 1, 0);
const auto ccsFamilyIndex = static_cast<cl_uint>(context.getDevice(0)->getDevice().getIndexOfNonEmptyEngineGroup(EngineGroupType::Compute));
fillProperties(properties, ccsFamilyIndex, 0);
MockCommandQueueHw<FamilyType> queue(&context, context.getDevice(0), properties);
ASSERT_EQ(&osContext, queue.gpgpuEngine->osContext);
EXPECT_TRUE(osContext.isInitialized());
}
HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenCreatingQueueThenInitializeOsContext) {
DebugManagerStateRestore restore{};
DebugManager.flags.NodeOrdinal.set(static_cast<int32_t>(aub_stream::EngineType::ENGINE_CCS));
DebugManager.flags.DeferOsContextInitialization.set(1);
auto raiiHwHelper = overrideHwHelper<FamilyType, MockHwHelper<FamilyType, 1, 1, 1>>();
MockContext context{};
cl_command_queue_properties properties[5] = {};
OsContext &osContext = *context.getDevice(0)->getEngine(aub_stream::ENGINE_RCS, EngineUsage::Regular).osContext;
EXPECT_FALSE(osContext.isInitialized());
const auto rcsFamilyIndex = static_cast<cl_uint>(context.getDevice(0)->getDevice().getIndexOfNonEmptyEngineGroup(EngineGroupType::RenderCompute));
fillProperties(properties, rcsFamilyIndex, 0);
MockCommandQueueHw<FamilyType> queue(&context, context.getDevice(0), properties);
ASSERT_EQ(&osContext, queue.gpgpuEngine->osContext);
EXPECT_TRUE(osContext.isInitialized());

View File

@@ -219,7 +219,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, GetCommandQueueFamilyInfoTests, givenFamilyIdWhenGe
clReleaseContext(context);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, GetCommandQueueFamilyInfoTests, givenFamilyIdWhenCreatingCommandQueueForRootDeviceWithMultipleSubDevicesThenInvalidValueIsReturned) {
HWCMDTEST_F(IGFX_XE_HP_CORE, GetCommandQueueFamilyInfoTests, givenNonZeroFamilyIdWhenCreatingCommandQueueForRootDeviceWithMultipleSubDevicesThenInvalidValueIsReturned) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);
initPlatform();
@@ -228,7 +228,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, GetCommandQueueFamilyInfoTests, givenFamilyIdWhenCr
const cl_device_id deviceId = rootDevice;
auto context = clCreateContext(nullptr, 1, &deviceId, nullptr, nullptr, nullptr);
cl_command_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, static_cast<uint32_t>(EngineGroupType::Compute), CL_QUEUE_INDEX_INTEL, 0, 0};
cl_command_queue_properties properties[] = {CL_QUEUE_FAMILY_INTEL, 1u, CL_QUEUE_INDEX_INTEL, 0, 0};
EXPECT_EQ(2u, rootDevice->getNumGenericSubDevices());
cl_int retVal;
auto commandQueue = clCreateCommandQueueWithProperties(context, rootDevice, properties, &retVal);
@@ -266,4 +266,4 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, MultiEngineQueueHwTests, givenLimitedNumberOfCcsWhe
EXPECT_EQ(CL_SUCCESS, retVal);
clReleaseCommandQueue(clCommandQueue);
}
}
}

View File

@@ -11,6 +11,7 @@
#include "shared/source/indirect_heap/indirect_heap.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/helpers/variable_backup.h"
@@ -21,6 +22,7 @@
#include "opencl/source/platform/platform.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/helpers/raii_hw_helper.h"
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_csr.h"
@@ -557,6 +559,36 @@ HWTEST_F(DeviceHwTest, givenDeviceCreationWhenCsrFailsToCreateGlobalSyncAllocati
EXPECT_EQ(nullptr, mockDevice);
}
HWTEST_F(DeviceHwTest, givenBothCcsAndRcsEnginesInDeviceWhenGettingFirstEngineGroupsThenReturnCcs) {
struct MyHwHelper : HwHelperHw<FamilyType> {
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const {
if (engineType == aub_stream::ENGINE_RCS) {
return EngineGroupType::RenderCompute;
}
if (EngineHelpers::isCcs(engineType)) {
return EngineGroupType::Compute;
}
UNRECOVERABLE_IF(true);
}
};
RAIIHwHelperFactory<MyHwHelper> overrideHwHelper{::defaultHwInfo->platform.eRenderCoreFamily};
MockOsContext rcsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_RCS, EngineUsage::Regular}));
EngineControl rcsEngine{nullptr, &rcsContext};
MockOsContext ccsContext(1, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_CCS, EngineUsage::Regular}));
EngineControl ccsEngine{nullptr, &ccsContext};
MockDevice device{};
ASSERT_EQ(nullptr, device.getNonEmptyEngineGroup(0u));
device.addEngineToEngineGroup(rcsEngine);
device.addEngineToEngineGroup(ccsEngine);
const auto firstGroup = device.getNonEmptyEngineGroup(0u);
EXPECT_EQ(1u, firstGroup->size());
EXPECT_EQ(aub_stream::EngineType::ENGINE_CCS, firstGroup->at(0).getEngineType());
}
TEST(DeviceGetEngineTest, givenHwCsrModeWhenGetEngineThenDedicatedForInternalUsageEngineIsReturned) {
auto device = std::unique_ptr<Device>(MockDevice::createWithNewExecutionEnvironment<Device>(nullptr));

View File

@@ -12,8 +12,8 @@
namespace NEO {
enum class EngineGroupType : uint32_t {
RenderCompute = 0,
Compute,
Compute = 0,
RenderCompute,
Copy,
MaxEngineGroups
};

View File

@@ -46,6 +46,7 @@ struct MockSubDevice : public SubDevice {
class MockDevice : public RootDevice {
public:
using Device::addEngineToEngineGroup;
using Device::commandStreamReceivers;
using Device::createDeviceInternals;
using Device::createEngine;