|
1 | 1 | /*
|
2 |
| - * Copyright (C) 2020-2024 Intel Corporation |
| 2 | + * Copyright (C) 2020-2025 Intel Corporation |
3 | 3 | *
|
4 | 4 | * SPDX-License-Identifier: MIT
|
5 | 5 | *
|
@@ -3346,5 +3346,86 @@ TEST_F(MetricEnumerationTest, givenValidArgumentsWhenZetGetMetricGroupProperties
|
3346 | 3346 | EXPECT_EQ(metricGroupType.type, ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER);
|
3347 | 3347 | }
|
3348 | 3348 |
|
| 3349 | +TEST_F(MetricEnumerationTest, givenValidArgumentsWhenAppendMarkerIsCalledThenReturnUnsupportedError) { |
| 3350 | + |
| 3351 | + // Metrics Discovery device. |
| 3352 | + metricsDeviceParams.ConcurrentGroupsCount = 1; |
| 3353 | + |
| 3354 | + // Metrics Discovery concurrent group. |
| 3355 | + Mock<IConcurrentGroup_1_13> metricsConcurrentGroup; |
| 3356 | + TConcurrentGroupParams_1_13 metricsConcurrentGroupParams = {}; |
| 3357 | + metricsConcurrentGroupParams.MetricSetsCount = 1; |
| 3358 | + metricsConcurrentGroupParams.SymbolName = "OA"; |
| 3359 | + metricsConcurrentGroupParams.Description = "OA description"; |
| 3360 | + metricsConcurrentGroupParams.IoMeasurementInformationCount = 1; |
| 3361 | + |
| 3362 | + Mock<MetricsDiscovery::IEquation_1_0> ioReadEquation; |
| 3363 | + MetricsDiscovery::TEquationElement_1_0 ioEquationElement = {}; |
| 3364 | + ioEquationElement.Type = MetricsDiscovery::EQUATION_ELEM_IMM_UINT64; |
| 3365 | + ioEquationElement.ImmediateUInt64 = 0; |
| 3366 | + |
| 3367 | + ioReadEquation.getEquationElement.push_back(&ioEquationElement); |
| 3368 | + |
| 3369 | + Mock<MetricsDiscovery::IInformation_1_0> ioMeasurement; |
| 3370 | + MetricsDiscovery::TInformationParams_1_0 oaInformation = {}; |
| 3371 | + oaInformation.SymbolName = "BufferOverflow"; |
| 3372 | + oaInformation.IoReadEquation = &ioReadEquation; |
| 3373 | + metricsConcurrentGroup.GetIoMeasurementInformationResult = &ioMeasurement; |
| 3374 | + ioMeasurement.GetParamsResult = &oaInformation; |
| 3375 | + |
| 3376 | + // Metrics Discovery:: metric set. |
| 3377 | + Mock<MetricsDiscovery::IMetricSet_1_13> metricsSet; |
| 3378 | + MetricsDiscovery::TMetricSetParams_1_11 metricsSetParams = {}; |
| 3379 | + metricsSetParams.ApiMask = MetricsDiscovery::API_TYPE_OCL; |
| 3380 | + metricsSetParams.MetricsCount = 0; |
| 3381 | + metricsSetParams.SymbolName = "Metric set name"; |
| 3382 | + metricsSetParams.ShortName = "Metric set description"; |
| 3383 | + |
| 3384 | + // One api: metric group handle. |
| 3385 | + zet_metric_group_handle_t metricGroupHandle = {}; |
| 3386 | + |
| 3387 | + openMetricsAdapter(); |
| 3388 | + |
| 3389 | + setupDefaultMocksForMetricDevice(metricsDevice); |
| 3390 | + |
| 3391 | + metricsDevice.getConcurrentGroupResults.push_back(&metricsConcurrentGroup); |
| 3392 | + |
| 3393 | + metricsConcurrentGroup.GetParamsResult = &metricsConcurrentGroupParams; |
| 3394 | + metricsConcurrentGroup.getMetricSetResult = &metricsSet; |
| 3395 | + |
| 3396 | + metricsSet.GetParamsResult = &metricsSetParams; |
| 3397 | + |
| 3398 | + // Metric group count. |
| 3399 | + uint32_t metricGroupCount = 0; |
| 3400 | + EXPECT_EQ(zetMetricGroupGet(device->toHandle(), &metricGroupCount, nullptr), ZE_RESULT_SUCCESS); |
| 3401 | + EXPECT_EQ(metricGroupCount, 1u); |
| 3402 | + |
| 3403 | + // Metric group handle. |
| 3404 | + EXPECT_EQ(zetMetricGroupGet(device->toHandle(), &metricGroupCount, &metricGroupHandle), ZE_RESULT_SUCCESS); |
| 3405 | + EXPECT_EQ(metricGroupCount, 1u); |
| 3406 | + EXPECT_NE(metricGroupHandle, nullptr); |
| 3407 | + |
| 3408 | + EXPECT_EQ(zetIntelCommandListAppendMarkerExp(nullptr, metricGroupHandle, 0), ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); |
| 3409 | +} |
| 3410 | + |
| 3411 | +using DriverVersionTest = Test<DeviceFixture>; |
| 3412 | + |
| 3413 | +TEST_F(DriverVersionTest, givenSupportedExtensionsWhenCheckIfAppendMarkerIsSupportedThenCorrectResultsAreReturned) { |
| 3414 | + uint32_t count = 0; |
| 3415 | + ze_result_t res = driverHandle->getExtensionProperties(&count, nullptr); |
| 3416 | + EXPECT_NE(0u, count); |
| 3417 | + EXPECT_EQ(ZE_RESULT_SUCCESS, res); |
| 3418 | + |
| 3419 | + std::vector<ze_driver_extension_properties_t> extensionProperties; |
| 3420 | + extensionProperties.resize(count); |
| 3421 | + |
| 3422 | + res = driverHandle->getExtensionProperties(&count, extensionProperties.data()); |
| 3423 | + EXPECT_EQ(ZE_RESULT_SUCCESS, res); |
| 3424 | + |
| 3425 | + auto it = std::find_if(extensionProperties.begin(), extensionProperties.end(), [](const auto &extension) { return (strcmp(extension.name, ZET_INTEL_METRIC_APPEND_MARKER_EXP_NAME) == 0); }); |
| 3426 | + EXPECT_NE(it, extensionProperties.end()); |
| 3427 | + EXPECT_EQ((*it).version, ZET_INTEL_METRIC_APPEND_MARKER_EXP_VERSION_CURRENT); |
| 3428 | +} |
| 3429 | + |
3349 | 3430 | } // namespace ult
|
3350 | 3431 | } // namespace L0
|
0 commit comments