mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-11 16:45:25 +08:00
Create Level Zero command queue based on queue desc ordinal
And correctly return the number of engines available. Related-to: NEO-4590 Change-Id: I637b3a94473e146003ea5e1c86d38e311406ce7e Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b7e65150d3
commit
77791ba889
@@ -117,7 +117,21 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
|
||||
auto &selectorCopyEngine = this->neoDevice->getDeviceById(0)->getSelectorCopyEngine();
|
||||
csr = this->neoDevice->getDeviceById(0)->getEngine(NEO::EngineHelpers::getBcsEngineType(neoDevice->getHardwareInfo(), selectorCopyEngine), false).commandStreamReceiver;
|
||||
} else {
|
||||
csr = neoDevice->getDefaultEngine().commandStreamReceiver;
|
||||
const auto &hardwareInfo = this->neoDevice->getHardwareInfo();
|
||||
auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
|
||||
if (desc->ordinal >= NEO::HwHelper::getEnginesCount(hardwareInfo)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (desc->ordinal == 0) {
|
||||
csr = neoDevice->getEngine(0).commandStreamReceiver;
|
||||
} else {
|
||||
// Skip low-priority and internal engines in engines vector
|
||||
csr = neoDevice->getEngine(desc->ordinal + hwHelper.internalUsageEngineIndex).commandStreamReceiver;
|
||||
}
|
||||
|
||||
UNRECOVERABLE_IF(csr == nullptr);
|
||||
}
|
||||
*commandQueue = CommandQueue::create(productFamily, this, csr, desc, useBliter);
|
||||
|
||||
|
||||
@@ -49,6 +49,40 @@ TEST_F(CommandQueueCreate, whenCreatingCommandQueueThenItIsInitialized) {
|
||||
commandQueue->destroy();
|
||||
}
|
||||
|
||||
TEST_F(CommandQueueCreate, givenOrdinalThenQueueIsCreatedOnlyIfOrdinalIsLessThanNumOfAsyncComputeEngines) {
|
||||
ze_device_properties_t deviceProperties;
|
||||
ze_result_t res = device->getProperties(&deviceProperties);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
|
||||
ze_command_queue_desc_t desc = {};
|
||||
desc.version = ZE_COMMAND_QUEUE_DESC_VERSION_CURRENT;
|
||||
desc.ordinal = deviceProperties.numAsyncComputeEngines;
|
||||
|
||||
ze_command_queue_handle_t commandQueue = {};
|
||||
res = device->createCommandQueue(&desc, &commandQueue);
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, res);
|
||||
EXPECT_EQ(nullptr, commandQueue);
|
||||
|
||||
desc.ordinal = 0;
|
||||
res = device->createCommandQueue(&desc, &commandQueue);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_NE(nullptr, commandQueue);
|
||||
|
||||
L0::CommandQueue::fromHandle(commandQueue)->destroy();
|
||||
|
||||
const auto &hardwareInfo = neoDevice->getHardwareInfo();
|
||||
auto &hwHelper = NEO::HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
|
||||
|
||||
for (uint32_t i = hwHelper.internalUsageEngineIndex; i < NEO::HwHelper::getEnginesCount(hardwareInfo); i++) {
|
||||
desc.ordinal = i;
|
||||
res = device->createCommandQueue(&desc, &commandQueue);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
EXPECT_NE(nullptr, commandQueue);
|
||||
|
||||
L0::CommandQueue::fromHandle(commandQueue)->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
using CommandQueueSBASupport = IsWithinProducts<IGFX_SKYLAKE, IGFX_TIGERLAKE_LP>;
|
||||
|
||||
struct MockMemoryManagerCommandQueueSBA : public MemoryManagerMock {
|
||||
|
||||
Reference in New Issue
Block a user