feature: ze_intel_xe_device_exp_properties_t support 2

Related-To: NEO-10060

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-12-10 14:53:59 +00:00
committed by Compute-Runtime-Automation
parent 89fa4424a9
commit 3632984fbe
7 changed files with 79 additions and 0 deletions

View File

@@ -1074,6 +1074,8 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
} else if (extendedProperties->stype == ZE_STRUCTURE_TYPE_RECORD_REPLAY_GRAPH_EXP_PROPERTIES) {
auto recordReplayGraphProperties = reinterpret_cast<ze_record_replay_graph_exp_properties_t *>(extendedProperties);
recordReplayGraphProperties->graphFlags = getL0GfxCoreHelper().getRecordReplayGraphCapabilities(this->getNEODevice()->getRootDeviceEnvironment());
} else if (extendedProperties->stype == ZE_STRUCTURE_TYPE_INTEL_XE_DEVICE_EXP_PROPERTIES) {
getIntelXeDeviceProperties(extendedProperties);
}
getAdditionalExtProperties(extendedProperties);
extendedProperties = static_cast<ze_base_properties_t *>(extendedProperties->pNext);
@@ -2172,4 +2174,18 @@ DeviceImp::CmdListCreateFunPtrT DeviceImp::getCmdListCreateFunc(const ze_base_de
return nullptr;
}
void DeviceImp::getIntelXeDeviceProperties(ze_base_properties_t *extendedProperties) const {
auto properties = reinterpret_cast<ze_intel_xe_device_exp_properties_t *>(extendedProperties);
auto &hwInfo = this->getHwInfo();
const auto &gtSysInfo = hwInfo.gtSystemInfo;
properties->numXeStacks = std::max(gtSysInfo.MultiTileArchInfo.TileCount, static_cast<uint8_t>(1));
properties->numXeRegionsPerStack = hwInfo.featureTable.regionCount;
properties->numXeClustersPerRegion = gtSysInfo.SliceCount / properties->numXeRegionsPerStack;
properties->numXeCorePerCluster = getNumSubSlicesPerSlice(hwInfo);
properties->numExecutionEnginesPerXeCore = gtSysInfo.MaxEuPerSubSlice;
properties->maxNumHwThreadsPerExecutionEngine = getNEODevice()->getDeviceInfo().numThreadsPerEU;
properties->maxNumLanesPerHwThread = CommonConstants::maximalSimdSize;
}
} // namespace L0

View File

@@ -205,6 +205,7 @@ struct DeviceImp : public Device, NEO::NonCopyableAndNonMovableClass {
void getP2PPropertiesDirectFabricConnection(DeviceImp *peerDeviceImp,
ze_device_p2p_bandwidth_exp_properties_t *bandwidthPropertiesDesc);
bool tryAssignSecondaryContext(aub_stream::EngineType engineType, NEO::EngineUsage engineUsage, std::optional<int> priorityLevel, NEO::CommandStreamReceiver **csr, bool allocateInterrupt);
void getIntelXeDeviceProperties(ze_base_properties_t *extendedProperties) const;
NEO::EngineGroupsT subDeviceCopyEngineGroups{};
SysmanDevice *pSysmanDevice = nullptr;

View File

@@ -67,6 +67,7 @@ const std::vector<std::pair<std::string, uint32_t>> DriverHandleImp::extensionsS
{ZE_INTEL_GET_DRIVER_VERSION_STRING_EXP_NAME, ZE_INTEL_GET_DRIVER_VERSION_STRING_EXP_VERSION_1_0},
{ZE_INTEL_KERNEL_GET_PROGRAM_BINARY_EXP_NAME, ZE_INTEL_KERNEL_GET_PROGRAM_BINARY_EXP_VERSION_1_0},
{ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_NAME, ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_VERSION_1_0},
{ZE_INTEL_XE_DEVICE_PROPERTIES_EXP_NAME, ZE_INTEL_XE_DEVICE_EXP_PROPERTIES_VERSION_1_0},
// Metrics experimental extensions
{ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_NAME, ZET_METRICS_RUNTIME_ENABLE_DISABLE_EXP_VERSION_1_0},

View File

@@ -73,6 +73,32 @@ extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[NEO::maxCoreEnumValu
namespace L0 {
namespace ult {
TEST(L0DeviceTest, givenExtensionStructureToXeDevicePropertiesThenCorrectValuesAreRetrieved) {
ze_intel_xe_device_exp_properties_t xeDeviceProperties{};
xeDeviceProperties.stype = ZE_STRUCTURE_TYPE_INTEL_XE_DEVICE_EXP_PROPERTIES;
ze_device_properties_t deviceProperties{};
deviceProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;
deviceProperties.pNext = &xeDeviceProperties;
NEO::HardwareInfo hwInfo = *NEO::defaultHwInfo;
hwInfo.featureTable.regionCount = 3;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0);
auto mockDeviceImp = std::make_unique<MockDeviceImp>(neoMockDevice);
EXPECT_NE(nullptr, mockDeviceImp);
auto deviceImp = static_cast<L0::DeviceImp *>(mockDeviceImp.get());
EXPECT_EQ(ZE_RESULT_SUCCESS, deviceImp->getProperties(&deviceProperties));
EXPECT_EQ(xeDeviceProperties.numXeStacks, std::max(NEO::defaultHwInfo->gtSystemInfo.MultiTileArchInfo.TileCount, static_cast<uint8_t>(1)));
EXPECT_EQ(xeDeviceProperties.numXeRegionsPerStack, hwInfo.featureTable.regionCount);
EXPECT_EQ(xeDeviceProperties.numXeClustersPerRegion, NEO::defaultHwInfo->gtSystemInfo.SliceCount / xeDeviceProperties.numXeRegionsPerStack);
EXPECT_EQ(xeDeviceProperties.numXeCorePerCluster, getNumSubSlicesPerSlice(*NEO::defaultHwInfo));
EXPECT_EQ(xeDeviceProperties.numExecutionEnginesPerXeCore, NEO::defaultHwInfo->gtSystemInfo.MaxEuPerSubSlice);
EXPECT_EQ(xeDeviceProperties.maxNumHwThreadsPerExecutionEngine, neoMockDevice->getDeviceInfo().numThreadsPerEU);
EXPECT_NE(0u, xeDeviceProperties.maxNumHwThreadsPerExecutionEngine);
EXPECT_EQ(xeDeviceProperties.maxNumLanesPerHwThread, CommonConstants::maximalSimdSize);
}
TEST(L0DeviceTest, GivenCreatedDeviceHandleWhenCallingdeviceReinitThenNewDeviceHandleIsNotCreated) {
ze_result_t returnValue = ZE_RESULT_SUCCESS;
std::unique_ptr<DriverHandleImp> driverHandle(new DriverHandleImp);

View File

@@ -1965,6 +1965,7 @@ TEST_F(DriverExtensionsTest, givenDriverHandleWhenAskingForExtensionsThenReturnC
verifyExtensionDefinition(ZE_INTEL_GET_DRIVER_VERSION_STRING_EXP_NAME, ZE_INTEL_GET_DRIVER_VERSION_STRING_EXP_VERSION_CURRENT);
verifyExtensionDefinition(ZE_INTEL_KERNEL_GET_PROGRAM_BINARY_EXP_NAME, ZE_INTEL_KERNEL_GET_PROGRAM_BINARY_EXP_VERSION_CURRENT);
verifyExtensionDefinition(ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_NAME, ZEX_INTEL_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_VERSION_CURRENT);
verifyExtensionDefinition(ZE_INTEL_XE_DEVICE_PROPERTIES_EXP_NAME, ZE_INTEL_XE_DEVICE_EXP_PROPERTIES_VERSION_CURRENT);
}
} // namespace ult

View File

@@ -570,6 +570,39 @@ typedef struct _ze_queue_priority_desc_t {
int priority; ///< [in] priority of the queue
} ze_queue_priority_desc_t;
///////////////////////////////////////////////////////////////////////////////
#ifndef ZE_INTEL_XE_DEVICE_PROPERTIES_EXP_NAME
/// @brief Intel Xe device properties driver extension name
#define ZE_INTEL_XE_DEVICE_PROPERTIES_EXP_NAME "ZE_intel_experimental_xe_device_properties"
#endif // ZE_INTEL_XE_DEVICE_PROPERTIES_EXP_NAME
///////////////////////////////////////////////////////////////////////////////
/// @brief Intel Xe device compute unit properties extension Version(s)
typedef enum _ze_intel_xe_device_exp_properties_version_t {
ZE_INTEL_XE_DEVICE_EXP_PROPERTIES_VERSION_1_0 = ZE_MAKE_VERSION(1, 0), ///< version 1.0
ZE_INTEL_XE_DEVICE_EXP_PROPERTIES_VERSION_CURRENT = ZE_MAKE_VERSION(1, 0), ///< latest known version
ZE_INTEL_XE_DEVICE_EXP_PROPERTIES_VERSION_FORCE_UINT32 = 0x7fffffff
} ze_intel_xe_device_exp_properties_version_t;
///////////////////////////////////////////////////////////////////////////////
/// @brief Intel Xe device compute unit properties
///
/// @details
/// - This structure should be passed to ::zeDeviceGetProperties, via the `pNext` member of ::ze_device_properties_t
typedef struct _ze_intel_xe_device_exp_properties_t {
ze_structure_type_ext_t stype; ///< [in] type of this structure
void *pNext; ///< [in][optional] must be null or a pointer to extension-specific structure
uint32_t numXeStacks; ///< [out] number of Stacks (Tiles)
uint32_t numXeRegionsPerStack; ///< [out] number of Regions per stack
uint32_t numXeClustersPerRegion; ///< [out] number of Clusters (Slices) per Region
uint32_t numXeCorePerCluster; ///< [out] number of XE Cores per Cluster
uint32_t numExecutionEnginesPerXeCore; ///< [out] number of Execution Engines (EUs) per XE Core
uint32_t maxNumHwThreadsPerExecutionEngine; ///< [out] maximal number of HW threads per Execution Engine
uint32_t maxNumLanesPerHwThread; ///< [out] maximal number of lanes (virtual SIMD size) per HW thread
} ze_intel_xe_device_exp_properties_t;
#if defined(__cplusplus)
} // extern "C"
#endif

View File

@@ -40,6 +40,7 @@ using zes_structure_type_ext_t = uint32_t;
#define ZEX_INTEL_STRUCTURE_TYPE_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_PROPERTIES static_cast<ze_structure_type_ext_t>(0x0003001B)
#define ZEX_STRUCTURE_COUNTER_BASED_EVENT_DESC static_cast<ze_structure_type_ext_t>(0x0003001C)
#define ZEX_STRUCTURE_COUNTER_BASED_EVENT_EXTERNAL_SYNC_ALLOC_PROPERTIES static_cast<ze_structure_type_ext_t>(0x0003001D)
#define ZE_STRUCTURE_TYPE_INTEL_XE_DEVICE_EXP_PROPERTIES static_cast<ze_structure_type_ext_t>(0x00030021)
#define ZEX_STRUCTURE_COUNTER_BASED_EVENT_EXTERNAL_STORAGE_ALLOC_PROPERTIES static_cast<ze_structure_type_ext_t>(0x00030027)
#define ZE_STRUCTURE_TYPE_QUEUE_PRIORITY_DESC static_cast<ze_structure_type_ext_t>(0x00030028)
#ifndef ZE_RECORD_REPLAY_GRAPH_EXP_NAME