feature: platform interrupt support detection

Related-To: NEO-14929

Signed-off-by: Grochowski, Stanislaw <stanislaw.grochowski@intel.com>
This commit is contained in:
Grochowski, Stanislaw
2025-08-13 08:16:02 +00:00
committed by Compute-Runtime-Automation
parent d86cc127ea
commit e33865e9c2
11 changed files with 63 additions and 4 deletions

View File

@@ -184,6 +184,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
auto deviceImp = static_cast<DeviceImp *>(device);
const auto &hwInfo = device->getHwInfo();
auto &gfxCoreHelper = device->getGfxCoreHelper();
auto &productHelper = device->getProductHelper();
if (!csr) {
if (internalUsage) {
@@ -195,6 +196,11 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
engineGroupType = deviceImp->getInternalEngineGroupType();
}
} else {
if (queueProperties.interruptHint && !productHelper.isInterruptSupported()) {
returnValue = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
return commandList;
}
returnValue = device->getCsrForOrdinalAndIndex(&csr, cmdQdesc.ordinal, cmdQdesc.index, cmdQdesc.priority, queueProperties.priorityLevel, queueProperties.interruptHint);
if (returnValue != ZE_RESULT_SUCCESS) {
return commandList;
@@ -214,8 +220,6 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
commandList->isSyncModeQueue |= true;
}
auto &productHelper = device->getProductHelper();
if (!internalUsage) {
auto &rootDeviceEnvironment = device->getNEODevice()->getRootDeviceEnvironment();
bool enabledCmdListSharing = !NEO::EngineHelper::isCopyOnlyEngineType(engineGroupType);

View File

@@ -382,6 +382,10 @@ ze_result_t DeviceImp::createCommandQueue(const ze_command_queue_desc_t *desc,
auto queueProperties = CommandQueue::extractQueueProperties(*desc);
if (queueProperties.interruptHint && !neoDevice->getProductHelper().isInterruptSupported()) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
auto ret = getCsrForOrdinalAndIndex(&csr, commandQueueDesc.ordinal, commandQueueDesc.index, commandQueueDesc.priority, queueProperties.priorityLevel, queueProperties.interruptHint);
if (ret != ZE_RESULT_SUCCESS) {
return ret;

View File

@@ -765,6 +765,10 @@ ze_result_t Event::enableExtensions(const EventDescriptor &eventDescriptor) {
kmdWaitMode = (eventSyncModeDesc->syncModeFlags & ZEX_INTEL_EVENT_SYNC_MODE_EXP_FLAG_LOW_POWER_WAIT);
externalInterruptWait = (eventSyncModeDesc->syncModeFlags & ZEX_INTEL_EVENT_SYNC_MODE_EXP_FLAG_EXTERNAL_INTERRUPT_WAIT);
if (interruptMode && !device->getProductHelper().isInterruptSupported()) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
if (externalInterruptWait) {
setExternalInterruptId(eventSyncModeDesc->externalInterruptId);
UNRECOVERABLE_IF(eventSyncModeDesc->externalInterruptId > 0 && eventDescriptor.eventPoolAllocation);

View File

@@ -9,6 +9,7 @@
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_product_helper.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -2074,10 +2075,14 @@ TEST(CommandList, givenContextGroupEnabledWhenCreatingImmediateCommandListWithIn
allocateMsix.stype = ZEX_INTEL_STRUCTURE_TYPE_QUEUE_ALLOCATE_MSIX_HINT_EXP_PROPERTIES;
allocateMsix.uniqueMsix = true;
auto mockProductHelper = new MockProductHelper;
mockProductHelper->isInterruptSupportedResult = true;
device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper);
ze_command_queue_desc_t desc = {};
desc.pNext = &allocateMsix;
ze_command_list_handle_t commandListHandle1, commandListHandle2, commandListHandle3;
ze_command_list_handle_t commandListHandle1, commandListHandle2, commandListHandle3, commandListHandle4;
auto result = device->createCommandListImmediate(&desc, &commandListHandle1);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@@ -2089,6 +2094,11 @@ TEST(CommandList, givenContextGroupEnabledWhenCreatingImmediateCommandListWithIn
result = device->createCommandListImmediate(&desc, &commandListHandle3);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
allocateMsix.uniqueMsix = true;
mockProductHelper->isInterruptSupportedResult = false;
result = device->createCommandListImmediate(&desc, &commandListHandle4);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
auto commandList1 = static_cast<CommandListImp *>(L0::CommandList::fromHandle(commandListHandle1));
auto commandList2 = static_cast<CommandListImp *>(L0::CommandList::fromHandle(commandListHandle2));
auto commandList3 = static_cast<CommandListImp *>(L0::CommandList::fromHandle(commandListHandle3));

View File

@@ -20,6 +20,7 @@
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_direct_submission_hw.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/mock_product_helper.h"
#include "shared/test/common/mocks/mock_timestamp_container.h"
#include "shared/test/common/mocks/ult_device_factory.h"
@@ -85,6 +86,10 @@ HWTEST_F(InOrderCmdListTests, givenEventSyncModeDescPassedWhenCreatingEventThenE
ze_event_desc_t eventDesc = {};
eventDesc.pNext = &syncModeDesc;
auto mockProductHelper = new MockProductHelper;
mockProductHelper->isInterruptSupportedResult = true;
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper);
eventDesc.index = 0;
syncModeDesc.syncModeFlags = 0;
auto event0 = DestroyableZeUniquePtr<InOrderFixtureMockEvent>(static_cast<InOrderFixtureMockEvent *>(Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device, returnValue)));
@@ -118,6 +123,13 @@ HWTEST_F(InOrderCmdListTests, givenEventSyncModeDescPassedWhenCreatingEventThenE
eventDesc.index = 5;
syncModeDesc.syncModeFlags = ZEX_INTEL_EVENT_SYNC_MODE_EXP_FLAG_EXTERNAL_INTERRUPT_WAIT;
EXPECT_ANY_THROW(Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device, returnValue));
mockProductHelper->isInterruptSupportedResult = false;
eventDesc.index = 6;
syncModeDesc.syncModeFlags = ZEX_INTEL_EVENT_SYNC_MODE_EXP_FLAG_SIGNAL_INTERRUPT;
auto event5 = Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device, returnValue);
EXPECT_EQ(event5, nullptr);
EXPECT_EQ(returnValue, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE);
}
HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenQueueFlagWhenCreatingCmdListThenEnableRelaxedOrdering) {
@@ -6159,6 +6171,10 @@ HWTEST_F(InOrderCmdListTests, givenStandaloneCbEventWhenPassingExternalInterrupt
zex_intel_event_sync_mode_exp_desc_t syncModeDesc = {ZEX_INTEL_STRUCTURE_TYPE_EVENT_SYNC_MODE_EXP_DESC};
syncModeDesc.externalInterruptId = 123;
auto mockProductHelper = new MockProductHelper;
mockProductHelper->isInterruptSupportedResult = true;
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper);
syncModeDesc.syncModeFlags = ZEX_INTEL_EVENT_SYNC_MODE_EXP_FLAG_SIGNAL_INTERRUPT;
auto event1 = createStandaloneCbEvent(reinterpret_cast<const ze_base_desc_t *>(&syncModeDesc));
EXPECT_EQ(NEO::InterruptId::notUsed, event1->externalInterruptId);

View File

@@ -19,6 +19,7 @@
#include "shared/test/common/mocks/mock_cpu_page_fault_manager.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/mocks/mock_product_helper.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -1393,9 +1394,13 @@ TEST(CommandQueue, givenContextGroupEnabledWhenCreatingCommandQueuesWithInterrup
allocateMsix.stype = ZEX_INTEL_STRUCTURE_TYPE_QUEUE_ALLOCATE_MSIX_HINT_EXP_PROPERTIES;
allocateMsix.uniqueMsix = true;
auto mockProductHelper = new MockProductHelper;
mockProductHelper->isInterruptSupportedResult = true;
neoDevice->executionEnvironment->rootDeviceEnvironments[0]->productHelper.reset(mockProductHelper);
ze_command_queue_desc_t desc = {};
desc.pNext = &allocateMsix;
ze_command_queue_handle_t commandQueueHandle1, commandQueueHandle2, commandQueueHandle3;
ze_command_queue_handle_t commandQueueHandle1, commandQueueHandle2, commandQueueHandle3, commandQueueHandle4;
auto result = device->createCommandQueue(&desc, &commandQueueHandle1);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
@@ -1408,6 +1413,11 @@ TEST(CommandQueue, givenContextGroupEnabledWhenCreatingCommandQueuesWithInterrup
result = device->createCommandQueue(&desc, &commandQueueHandle3);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
allocateMsix.uniqueMsix = true;
mockProductHelper->isInterruptSupportedResult = false;
result = device->createCommandQueue(&desc, &commandQueueHandle4);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
auto commandQueue1 = static_cast<CommandQueueImp *>(L0::CommandQueue::fromHandle(commandQueueHandle1));
auto commandQueue2 = static_cast<CommandQueueImp *>(L0::CommandQueue::fromHandle(commandQueueHandle2));
auto commandQueue3 = static_cast<CommandQueueImp *>(L0::CommandQueue::fromHandle(commandQueueHandle3));