mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Add implementation for flag NodeOrdinal to l0
create method adjustCommandQueueDesc Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3efdfba41e
commit
637767500d
@@ -198,6 +198,25 @@ ze_result_t DeviceImp::createCommandListImmediate(const ze_command_queue_desc_t
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
void DeviceImp::adjustCommandQueueDesc(ze_command_queue_desc_t &desc) {
|
||||
auto nodeOrdinal = NEO::DebugManager.flags.NodeOrdinal.get();
|
||||
if (nodeOrdinal != -1) {
|
||||
const NEO::HardwareInfo &hwInfo = neoDevice->getHardwareInfo();
|
||||
const NEO::HwHelper &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
auto &engineGroups = getActiveDevice()->getRegularEngineGroups();
|
||||
|
||||
auto engineGroupTyp = hwHelper.getEngineGroupType(static_cast<aub_stream::EngineType>(nodeOrdinal), NEO::EngineUsage::Regular, hwInfo);
|
||||
uint32_t currentEngineIndex = 0u;
|
||||
for (const auto &engine : engineGroups) {
|
||||
if (engine.engineGroupType == engineGroupTyp) {
|
||||
desc.ordinal = currentEngineIndex;
|
||||
break;
|
||||
}
|
||||
currentEngineIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
|
||||
ze_command_queue_handle_t *commandQueue) {
|
||||
auto &platform = neoDevice->getHardwareInfo().platform;
|
||||
@@ -207,21 +226,24 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
|
||||
uint32_t numEngineGroups = static_cast<uint32_t>(engineGroups.size());
|
||||
auto &subDeviceEngineGroups = this->getSubDeviceCopyEngineGroups();
|
||||
|
||||
ze_command_queue_desc_t commandQueueDesc = *desc;
|
||||
adjustCommandQueueDesc(commandQueueDesc);
|
||||
|
||||
if (!this->isQueueGroupOrdinalValid(desc->ordinal)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
bool isCopyOnly = false;
|
||||
if (desc->ordinal < numEngineGroups) {
|
||||
isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType(engineGroups[desc->ordinal].engineGroupType);
|
||||
if (commandQueueDesc.ordinal < numEngineGroups) {
|
||||
isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType(engineGroups[commandQueueDesc.ordinal].engineGroupType);
|
||||
} else {
|
||||
isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType(subDeviceEngineGroups[desc->ordinal - numEngineGroups].engineGroupType);
|
||||
isCopyOnly = NEO::EngineHelper::isCopyOnlyEngineType(subDeviceEngineGroups[commandQueueDesc.ordinal - numEngineGroups].engineGroupType);
|
||||
}
|
||||
|
||||
if (desc->priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW && !isCopyOnly) {
|
||||
if (commandQueueDesc.priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW && !isCopyOnly) {
|
||||
getCsrForLowPriority(&csr);
|
||||
} else {
|
||||
auto ret = getCsrForOrdinalAndIndex(&csr, desc->ordinal, desc->index);
|
||||
auto ret = getCsrForOrdinalAndIndex(&csr, commandQueueDesc.ordinal, commandQueueDesc.index);
|
||||
if (ret != ZE_RESULT_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
@@ -230,7 +252,7 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
|
||||
UNRECOVERABLE_IF(csr == nullptr);
|
||||
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
*commandQueue = CommandQueue::create(platform.eProductFamily, this, csr, desc, isCopyOnly, false, returnValue);
|
||||
*commandQueue = CommandQueue::create(platform.eProductFamily, this, csr, &commandQueueDesc, isCopyOnly, false, returnValue);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@@ -134,6 +134,7 @@ struct DeviceImp : public Device {
|
||||
CmdListCreateFunT getCmdListCreateFunc(const ze_command_list_desc_t *desc);
|
||||
|
||||
protected:
|
||||
void adjustCommandQueueDesc(ze_command_queue_desc_t &desc);
|
||||
NEO::Device::EngineGroupsT subDeviceCopyEngineGroups{};
|
||||
|
||||
NEO::GraphicsAllocation *debugSurface = nullptr;
|
||||
|
||||
@@ -98,6 +98,7 @@ struct Mock<Device> : public Device {
|
||||
template <>
|
||||
struct Mock<L0::DeviceImp> : public L0::DeviceImp {
|
||||
using Base = L0::DeviceImp;
|
||||
using Base::adjustCommandQueueDesc;
|
||||
using Base::debugSession;
|
||||
using Base::implicitScalingCapable;
|
||||
|
||||
|
||||
@@ -1085,6 +1085,42 @@ TEST_F(DeviceTest, whenCheckingIfStatelessCompressionIsSupportedThenReturnFalse)
|
||||
EXPECT_FALSE(hwInfoConfig.allowStatelessCompression(*defaultHwInfo));
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenNodeOrdinalFlagNotSetWhenCallAdjustCommandQueueDescThenDescOrdinalIsNotModified) {
|
||||
DebugManagerStateRestore restore;
|
||||
auto nodeOrdinal = EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_RCS, *defaultHwInfo);
|
||||
DebugManager.flags.NodeOrdinal.set(nodeOrdinal);
|
||||
|
||||
auto deviceImp = static_cast<Mock<L0::DeviceImp> *>(device);
|
||||
ze_command_queue_desc_t desc = {};
|
||||
EXPECT_EQ(desc.ordinal, 0u);
|
||||
|
||||
auto &engineGroups = deviceImp->getActiveDevice()->getRegularEngineGroups();
|
||||
engineGroups.clear();
|
||||
NEO::Device::EngineGroupT engineGroupCompute{};
|
||||
engineGroupCompute.engineGroupType = NEO::EngineGroupType::Compute;
|
||||
NEO::Device::EngineGroupT engineGroupRender{};
|
||||
engineGroupRender.engineGroupType = NEO::EngineGroupType::RenderCompute;
|
||||
engineGroups.push_back(engineGroupCompute);
|
||||
engineGroups.push_back(engineGroupRender);
|
||||
|
||||
uint32_t expectedOrdinal = 1u;
|
||||
deviceImp->adjustCommandQueueDesc(desc);
|
||||
EXPECT_EQ(desc.ordinal, expectedOrdinal);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenNodeOrdinalFlagWhenCallAdjustCommandQueueDescThenDescOrdinalProperlySet) {
|
||||
DebugManagerStateRestore restore;
|
||||
int nodeOrdinal = -1;
|
||||
DebugManager.flags.NodeOrdinal.set(nodeOrdinal);
|
||||
|
||||
auto deviceImp = static_cast<Mock<L0::DeviceImp> *>(device);
|
||||
ze_command_queue_desc_t desc = {};
|
||||
EXPECT_EQ(desc.ordinal, 0u);
|
||||
|
||||
deviceImp->adjustCommandQueueDesc(desc);
|
||||
EXPECT_EQ(desc.ordinal, 0u);
|
||||
}
|
||||
|
||||
struct DeviceHwInfoTest : public ::testing::Test {
|
||||
void SetUp() override {
|
||||
executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
|
||||
Reference in New Issue
Block a user