feature: support to query wait on memory data size

Related-To: NEO-8145

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz 2023-12-08 15:41:23 +00:00 committed by Compute-Runtime-Automation
parent 6d91859a43
commit 81aba9362a
8 changed files with 48 additions and 6 deletions

View File

@ -937,6 +937,9 @@ ze_result_t DeviceImp::getProperties(ze_device_properties_t *pDeviceProperties)
rtasProperties->rtasFormat = ZE_RTAS_FORMAT_EXP_INVALID;
}
}
} else if (extendedProperties->stype == ZE_INTEL_STRUCTURE_TYPE_DEVICE_COMMAND_LIST_WAIT_ON_MEMORY_DATA_SIZE_EXP_DESC) {
auto cmdListWaitOnMemDataSize = reinterpret_cast<ze_intel_device_command_list_wait_on_memory_data_size_exp_desc_t *>(extendedProperties);
cmdListWaitOnMemDataSize->cmdListWaitOnMemoryDataSizeInBytes = l0GfxCoreHelper.getCmdListWaitOnMemoryDataSize();
}
extendedProperties = static_cast<ze_base_properties_t *>(extendedProperties->pNext);
}

View File

@ -31,5 +31,7 @@ const std::vector<std::pair<std::string, uint32_t>> DriverHandleImp::extensionsS
// Driver experimental extensions
{ZE_INTEL_DEVICE_MODULE_DP_PROPERTIES_EXP_NAME, ZE_INTEL_DEVICE_MODULE_DP_PROPERTIES_EXP_VERSION_CURRENT},
{ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME, ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_CURRENT}};
{ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME, ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_CURRENT},
{ZE_INTEL_COMMAND_LIST_MEMORY_SYNC, ZE_INTEL_COMMAND_LIST_MEMORY_SYNC_EXP_VERSION_CURRENT},
};
} // namespace L0

View File

@ -87,6 +87,7 @@ class L0GfxCoreHelper : public NEO::ApiGfxCoreHelper {
virtual ze_rtas_format_exp_t getSupportedRTASFormat() const = 0;
virtual bool platformSupportsImmediateComputeFlushTask() const = 0;
virtual zet_debug_regset_type_intel_gpu_t getRegsetTypeForLargeGrfDetection() const = 0;
virtual uint32_t getCmdListWaitOnMemoryDataSize() const = 0;
protected:
L0GfxCoreHelper() = default;
@ -125,6 +126,7 @@ class L0GfxCoreHelperHw : public L0GfxCoreHelper {
ze_rtas_format_exp_t getSupportedRTASFormat() const override;
bool platformSupportsImmediateComputeFlushTask() const override;
zet_debug_regset_type_intel_gpu_t getRegsetTypeForLargeGrfDetection() const override;
uint32_t getCmdListWaitOnMemoryDataSize() const override;
protected:
L0GfxCoreHelperHw() = default;

View File

@ -44,4 +44,13 @@ zet_debug_regset_type_intel_gpu_t L0GfxCoreHelperHw<Family>::getRegsetTypeForLar
return ZET_DEBUG_REGSET_TYPE_INVALID_INTEL_GPU;
}
template <typename Family>
uint32_t L0GfxCoreHelperHw<Family>::getCmdListWaitOnMemoryDataSize() const {
if constexpr (Family::isQwordInOrderCounter) {
return sizeof(uint64_t);
} else {
return sizeof(uint32_t);
}
}
} // namespace L0

View File

@ -870,7 +870,7 @@ bool InOrderCmdListTests::verifyInOrderDependency(GenCmdList::iterator &cmd, uin
cmd++;
return true;
}
HWTEST2_F(InOrderCmdListTests, givenDriverHandleWhenAskingForExtensionsThenReturnCounterBasedEventExtension, IsAtLeastSkl) {
HWTEST2_F(InOrderCmdListTests, givenDriverHandleWhenAskingForExtensionsThenReturnCorrectVersions, IsAtLeastSkl) {
uint32_t count = 0;
ze_result_t res = driverHandle->getExtensionProperties(&count, nullptr);
EXPECT_NE(0u, count);
@ -885,6 +885,10 @@ HWTEST2_F(InOrderCmdListTests, givenDriverHandleWhenAskingForExtensionsThenRetur
auto it = std::find_if(extensionProperties.begin(), extensionProperties.end(), [](const auto &extension) { return (strcmp(extension.name, ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME) == 0); });
EXPECT_NE(it, extensionProperties.end());
EXPECT_EQ((*it).version, ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_CURRENT);
it = std::find_if(extensionProperties.begin(), extensionProperties.end(), [](const auto &extension) { return (strcmp(extension.name, ZE_INTEL_COMMAND_LIST_MEMORY_SYNC) == 0); });
EXPECT_NE(it, extensionProperties.end());
EXPECT_EQ((*it).version, ZE_INTEL_COMMAND_LIST_MEMORY_SYNC_EXP_VERSION_CURRENT);
}
HWTEST2_F(InOrderCmdListTests, givenCmdListWhenAskingForQwordDataSizeThenReturnFalse, IsAtLeastSkl) {

View File

@ -4868,6 +4868,19 @@ TEST_F(DeviceTest, GivenValidDeviceWhenQueryingKernelTimestampsProptertiesThenCo
EXPECT_NE(0u, tsProps.flags & ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_SYNCHRONIZED);
}
TEST_F(DeviceTest, givenDeviceWhenQueryingCmdListMemWaitOnMemDataSizeThenReturnValueFromHelper) {
ze_device_properties_t devProps;
ze_intel_device_command_list_wait_on_memory_data_size_exp_desc_t sizeProps = {ZE_INTEL_STRUCTURE_TYPE_DEVICE_COMMAND_LIST_WAIT_ON_MEMORY_DATA_SIZE_EXP_DESC};
devProps.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;
devProps.pNext = &sizeProps;
auto &l0GfxCoreHelper = this->neoDevice->getRootDeviceEnvironment().getHelper<L0GfxCoreHelper>();
EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGetProperties(device, &devProps));
EXPECT_EQ(l0GfxCoreHelper.getCmdListWaitOnMemoryDataSize(), sizeProps.cmdListWaitOnMemoryDataSizeInBytes);
}
struct RTASDeviceTest : public ::testing::Test {
void SetUp() override {
debugManager.flags.CreateMultipleRootDevices.set(numRootDevices);

View File

@ -58,6 +58,15 @@ HWTEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenAskingForImageCompressionS
EXPECT_FALSE(l0GfxCoreHelper.imageCompressionSupported(*NEO::defaultHwInfo));
}
HWTEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenAskingForCmdListWaitOnMemDataSizeThenReturnCorrectSize) {
MockExecutionEnvironment executionEnvironment;
auto &l0GfxCoreHelper = executionEnvironment.rootDeviceEnvironments[0]->getHelper<L0GfxCoreHelper>();
uint32_t expectedSize = FamilyType::isQwordInOrderCounter ? sizeof(uint64_t) : sizeof(uint32_t);
EXPECT_EQ(expectedSize, l0GfxCoreHelper.getCmdListWaitOnMemoryDataSize());
}
HWTEST_F(L0GfxCoreHelperTest, givenL0GfxCoreHelperWhenAskingForUsmCompressionSupportThenReturnFalse) {
DebugManagerStateRestore restore;

View File

@ -87,10 +87,10 @@ typedef enum _ze_intel_command_list_memory_sync_exp_version_t {
/// - Implementation must support ::ZE_intel_experimental_command_list_memory_sync extension
/// - May be passed to ze_device_properties_t through pNext.
typedef struct _ze_intel_device_command_list_wait_on_memory_data_size_exp_desc_t {
ze_structure_type_t stype = ZE_INTEL_STRUCTURE_TYPE_DEVICE_COMMAND_LIST_WAIT_ON_MEMORY_DATA_SIZE_EXP_DESC; ///< [in] type of this structure
const void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific
///< structure (i.e. contains stype and pNext).
uint32_t cmdListWaitOnMemoryDataSizeInBytes; /// <out> Defines supported data size for zexCommandListAppendWaitOnMemory[64] API
ze_structure_type_t stype; ///< [in] type of this structure
const void *pNext; ///< [in][optional] must be null or a pointer to an extension-specific
///< structure (i.e. contains stype and pNext).
uint32_t cmdListWaitOnMemoryDataSizeInBytes; /// <out> Defines supported data size for zexCommandListAppendWaitOnMemory[64] API
} ze_intel_device_command_list_wait_on_memory_data_size_exp_desc_t;
#ifndef ZE_INTEL_EVENT_SYNC_MODE