mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Enable copy engine in platforms which supports bcs
Releated-To: NEO-4870 Change-Id: I3ef4c91c2bf210d5e6f59df0e8bd347aa867cbe5 Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
96c0177250
commit
b539b5a3ec
@ -43,52 +43,61 @@ HWTEST2_F(DeviceQueueGroupTest, givenCommandQueuePropertiesCallThenCorrectNumber
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = device->getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_EQ(1u, count);
|
||||
auto expectedCount = 1u;
|
||||
if (device->getHwInfo().featureTable.ftrBcsInfo.test(0)) {
|
||||
expectedCount++;
|
||||
}
|
||||
EXPECT_EQ(expectedCount, count);
|
||||
|
||||
ze_command_queue_group_properties_t properties;
|
||||
res = device->getCommandQueueGroupProperties(&count, &properties);
|
||||
auto properties = std::make_unique<ze_command_queue_group_properties_t[]>(count);
|
||||
res = device->getCommandQueueGroupProperties(&count, properties.get());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties.numQueues, 1u);
|
||||
EXPECT_EQ(properties.maxMemoryFillPatternSize, sizeof(uint32_t));
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[0].numQueues, 1u);
|
||||
EXPECT_EQ(properties[0].maxMemoryFillPatternSize, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceQueueGroupTest, givenQueueGroupsReturnedThenCommandListIsCreatedCorrectly, IsGen9) {
|
||||
uint32_t count = 0;
|
||||
ze_result_t res = device->getCommandQueueGroupProperties(&count, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_EQ(1u, count);
|
||||
auto expectedCount = 1u;
|
||||
if (device->getHwInfo().featureTable.ftrBcsInfo.test(0)) {
|
||||
expectedCount++;
|
||||
}
|
||||
EXPECT_EQ(expectedCount, count);
|
||||
|
||||
ze_command_queue_group_properties_t properties;
|
||||
res = device->getCommandQueueGroupProperties(&count, &properties);
|
||||
auto properties = std::make_unique<ze_command_queue_group_properties_t[]>(count);
|
||||
res = device->getCommandQueueGroupProperties(&count, properties.get());
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties.flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties.numQueues, 1u);
|
||||
EXPECT_EQ(properties.maxMemoryFillPatternSize, sizeof(uint32_t));
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE);
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY);
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS);
|
||||
EXPECT_TRUE(properties[0].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS);
|
||||
EXPECT_EQ(properties[0].numQueues, 1u);
|
||||
EXPECT_EQ(properties[0].maxMemoryFillPatternSize, sizeof(uint32_t));
|
||||
|
||||
ze_context_handle_t hContext;
|
||||
ze_context_desc_t contextDesc;
|
||||
res = driverHandle->createContext(&contextDesc, &hContext);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
L0::Context *context = Context::fromHandle(hContext);
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
ze_command_list_desc_t listDesc = {};
|
||||
listDesc.commandQueueGroupOrdinal = i;
|
||||
ze_command_list_handle_t hCommandList = {};
|
||||
|
||||
ze_command_list_desc_t listDesc = {};
|
||||
listDesc.commandQueueGroupOrdinal = 0;
|
||||
ze_command_list_handle_t hCommandList = {};
|
||||
res = context->createCommandList(device, &listDesc, &hCommandList);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
res = context->createCommandList(device, &listDesc, &hCommandList);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
CommandList *commandList = CommandList::fromHandle(hCommandList);
|
||||
commandList->destroy();
|
||||
CommandList *commandList = CommandList::fromHandle(hCommandList);
|
||||
commandList->destroy();
|
||||
}
|
||||
|
||||
context->destroy();
|
||||
}
|
||||
|
@ -45,8 +45,9 @@ GEN11TEST_F(HwHelperTestGen11, givenGen11PlatformWhenSetupHardwareCapabilitiesIs
|
||||
}
|
||||
|
||||
GEN11TEST_F(HwHelperTestGen11, whenGetGpgpuEnginesThenReturnThreeRcsEngines) {
|
||||
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>(pDevice->getHardwareInfo());
|
||||
EXPECT_EQ(3u, pDevice->engines.size());
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.ftrBcsInfo.set(0, false);
|
||||
whenGetGpgpuEnginesThenReturnThreeRcsEngines<FamilyType>(hwInfo);
|
||||
}
|
||||
|
||||
using MemorySynchronizatiopCommandsTestsGen11 = ::testing::Test;
|
||||
|
@ -117,7 +117,7 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, givenDifferentSizesOfAllocationWhenCheckingCo
|
||||
}
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(HwHelperTestGen12Lp, givenFtrCcsNodeNotSetAndBcsInfoSetWhenGetGpgpuEnginesThenReturnThreeRcsEnginesAndOneBcsEngine) {
|
||||
GEN12LPTEST_F(HwHelperTestGen12Lp, givenFtrCcsNodeNotSetAndBcsInfoSetWhenGetGpgpuEnginesThenReturnThreeRcsEnginesEngine) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrCCSNode = false;
|
||||
hwInfo.featureTable.ftrBcsInfo = 1;
|
||||
|
@ -52,8 +52,9 @@ GEN8TEST_F(HwHelperTestGen8, givenGen8PlatformWhenSetupHardwareCapabilitiesIsCal
|
||||
}
|
||||
|
||||
GEN8TEST_F(HwHelperTestGen8, whenGetGpgpuEnginesThenReturnThreeEngines) {
|
||||
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>(pDevice->getHardwareInfo());
|
||||
EXPECT_EQ(3u, pDevice->engines.size());
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.ftrBcsInfo.set(0, false);
|
||||
whenGetGpgpuEnginesThenReturnThreeRcsEngines<FamilyType>(hwInfo);
|
||||
}
|
||||
|
||||
using MemorySynchronizatiopCommandsTestsGen8 = ::testing::Test;
|
||||
|
@ -57,8 +57,9 @@ GEN9TEST_F(HwHelperTestGen9, givenDebuggingActiveWhenSipKernelTypeIsQueriedThenD
|
||||
}
|
||||
|
||||
GEN9TEST_F(HwHelperTestGen9, whenGetGpgpuEnginesThenReturnThreeRcsEngines) {
|
||||
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>(pDevice->getHardwareInfo());
|
||||
EXPECT_EQ(3u, pDevice->engines.size());
|
||||
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
hwInfo.featureTable.ftrBcsInfo.set(0, false);
|
||||
whenGetGpgpuEnginesThenReturnThreeRcsEngines<FamilyType>(hwInfo);
|
||||
}
|
||||
|
||||
using MemorySynchronizatiopCommandsTestsGen9 = ::testing::Test;
|
||||
|
@ -12,7 +12,7 @@
|
||||
using namespace NEO;
|
||||
|
||||
template <typename FamilyType>
|
||||
void whenGetGpgpuEnginesThenReturnTwoRcsEngines(const HardwareInfo &hwInfo) {
|
||||
void whenGetGpgpuEnginesThenReturnThreeRcsEngines(const HardwareInfo &hwInfo) {
|
||||
auto gpgpuEngines = HwHelperHw<FamilyType>::get().getGpgpuEngineInstances(hwInfo);
|
||||
EXPECT_EQ(3u, gpgpuEngines.size());
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, gpgpuEngines[0].first);
|
||||
|
@ -57,17 +57,28 @@ bool HwHelperHw<Family>::obtainBlitterPreference(const HardwareInfo &hwInfo) con
|
||||
|
||||
template <typename GfxFamily>
|
||||
const HwHelper::EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
|
||||
return {
|
||||
{aub_stream::ENGINE_RCS, EngineUsage::Regular},
|
||||
{aub_stream::ENGINE_RCS, EngineUsage::LowPriority},
|
||||
{aub_stream::ENGINE_RCS, EngineUsage::Internal},
|
||||
};
|
||||
EngineInstancesContainer engines;
|
||||
|
||||
engines.push_back({aub_stream::ENGINE_RCS, EngineUsage::Regular});
|
||||
engines.push_back({aub_stream::ENGINE_RCS, EngineUsage::LowPriority});
|
||||
engines.push_back({aub_stream::ENGINE_RCS, EngineUsage::Internal});
|
||||
|
||||
if (hwInfo.featureTable.ftrBcsInfo.test(0)) {
|
||||
engines.push_back({aub_stream::ENGINE_BCS, EngineUsage::Regular});
|
||||
}
|
||||
|
||||
return engines;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void HwHelperHw<GfxFamily>::addEngineToEngineGroup(std::vector<std::vector<EngineControl>> &engineGroups,
|
||||
EngineControl &engine, const HardwareInfo &hwInfo) const {
|
||||
engineGroups[static_cast<uint32_t>(EngineGroupType::RenderCompute)].push_back(engine);
|
||||
if (engine.getEngineType() == aub_stream::ENGINE_RCS) {
|
||||
engineGroups[static_cast<uint32_t>(EngineGroupType::RenderCompute)].push_back(engine);
|
||||
}
|
||||
if (engine.getEngineType() == aub_stream::ENGINE_BCS && DebugManager.flags.EnableBlitterOperationsSupport.get() != 0) {
|
||||
engineGroups[static_cast<uint32_t>(EngineGroupType::Copy)].push_back(engine);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
@ -16,6 +16,7 @@ set(NEO_CORE_HELPERS_TESTS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dispatch_flags_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/file_io_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/hw_helper_extended_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hash_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/kernel_helpers_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/memory_leak_listener.h
|
||||
|
59
shared/test/unit_test/helpers/hw_helper_tests.cpp
Normal file
59
shared/test/unit_test/helpers/hw_helper_tests.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/unit_test/fixtures/device_fixture.h"
|
||||
#include "shared/test/unit_test/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<DeviceFixture> HwHelperTest;
|
||||
|
||||
using Platforms = IsWithinProducts<IGFX_SKYLAKE, IGFX_ICELAKE_LP>;
|
||||
|
||||
HWTEST2_F(HwHelperTest, givenHwHelperWhenGetGpgpuEnginesThenReturnThreeRcsEnginesAndOneBcs, Platforms) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.featureTable.ftrCCSNode = false;
|
||||
hwInfo.featureTable.ftrBcsInfo = 1;
|
||||
hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_RCS;
|
||||
auto gpgpuEngines = HwHelperHw<FamilyType>::get().getGpgpuEngineInstances(hwInfo);
|
||||
EXPECT_EQ(4u, gpgpuEngines.size());
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, gpgpuEngines[0].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, gpgpuEngines[1].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_RCS, gpgpuEngines[2].first);
|
||||
EXPECT_EQ(aub_stream::ENGINE_BCS, gpgpuEngines[3].first);
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, givenHwHelperWhenEnableBlitterOperationsSupportEnabledThenBcsInCopyGroupVecotr) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableBlitterOperationsSupport.set(1);
|
||||
std::unique_ptr<OsContext> bcsOsContext;
|
||||
bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
|
||||
false, false, false));
|
||||
EngineControl engineControl;
|
||||
engineControl.osContext = bcsOsContext.get();
|
||||
std::vector<std::vector<EngineControl>> engineGroups;
|
||||
engineGroups.resize(static_cast<uint32_t>(EngineGroupType::MaxEngineGroups));
|
||||
HwHelperHw<FamilyType>::get().addEngineToEngineGroup(engineGroups, engineControl, pDevice->getHardwareInfo());
|
||||
EXPECT_EQ(engineGroups[static_cast<uint32_t>(EngineGroupType::Copy)].size(), 1u);
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, givenHwHelperWhenEnableBlitterOperationsSupportDisabledThenCopyGroupVecotrIsEmpty) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.EnableBlitterOperationsSupport.set(0);
|
||||
std::unique_ptr<OsContext> bcsOsContext;
|
||||
bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
|
||||
false, false, false));
|
||||
EngineControl engineControl;
|
||||
engineControl.osContext = bcsOsContext.get();
|
||||
std::vector<std::vector<EngineControl>> engineGroups;
|
||||
engineGroups.resize(static_cast<uint32_t>(EngineGroupType::MaxEngineGroups));
|
||||
HwHelperHw<FamilyType>::get().addEngineToEngineGroup(engineGroups, engineControl, pDevice->getHardwareInfo());
|
||||
EXPECT_EQ(engineGroups[static_cast<uint32_t>(EngineGroupType::Copy)].size(), 0u);
|
||||
}
|
Reference in New Issue
Block a user