Skip to content

Commit bc4b8dc

Browse files
feature: DecodeCalculate API name and signature change
Related-To: NEO-15766 Signed-off-by: Shreyas Kunder <shreyas.kunder@intel.com>
1 parent 5677d4b commit bc4b8dc

File tree

6 files changed

+29
-44
lines changed

6 files changed

+29
-44
lines changed

level_zero/api/driver_experimental/public/zex_metric.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,12 @@ ze_result_t ZE_APICALL zetIntelMetricCalculateValuesExp(const size_t rawDataSize
110110
pTotalMetricReportsCount, pMetricResults);
111111
}
112112

113-
ze_result_t ZE_APICALL zetIntelMetricDecodeCalculateMultipleValuesExp(zet_intel_metric_decoder_exp_handle_t hMetricDecoder,
114-
const size_t rawDataSize, size_t *offset, const uint8_t *pRawData,
115-
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation,
116-
uint32_t *pSetCount, uint32_t *pMetricReportCountPerSet,
117-
uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults) {
118-
return L0::metricDecodeCalculateMultipleValues(hMetricDecoder, rawDataSize, offset, pRawData, hCalculationOperation,
119-
pSetCount, pMetricReportCountPerSet, pTotalMetricReportCount, pMetricResults);
113+
ze_result_t ZE_APICALL zetIntelMetricTracerDecodeCalculateValuesExp(zet_intel_metric_decoder_exp_handle_t hMetricDecoder,
114+
const size_t rawDataSize, size_t *usedDataSize, const uint8_t *pRawData,
115+
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation,
116+
uint32_t *pTotalMetricReportsCount, zet_intel_metric_result_exp_t *pMetricResults) {
117+
return L0::metricTracerDecodeCalculateValues(hMetricDecoder, rawDataSize, usedDataSize, pRawData, hCalculationOperation,
118+
pTotalMetricReportsCount, pMetricResults);
120119
}
121120

122121
ze_result_t ZE_APICALL zetIntelMetricScopesGetExp(zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t *pMetricScopesCount, zet_intel_metric_scope_exp_handle_t *phMetricScopes) {
@@ -271,13 +270,11 @@ ze_result_t ZE_APICALL zetIntelMetricCalculateValuesExp(const size_t rawDataSize
271270
pTotalMetricReportsCount, pMetricResults);
272271
}
273272

274-
ze_result_t ZE_APICALL zetIntelMetricDecodeCalculateMultipleValuesExp(zet_metric_decoder_exp_handle_t hMetricDecoder, const size_t rawDataSize,
275-
size_t *offset, const uint8_t *pRawData, zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation,
276-
uint32_t *pSetCount, uint32_t *pMetricReportCountPerSet, uint32_t *pTotalMetricReportCount,
277-
zet_intel_metric_result_exp_t *pMetricResults) {
278-
return L0::zetIntelMetricDecodeCalculateMultipleValuesExp(
279-
hMetricDecoder, rawDataSize, offset, pRawData, hCalculationOperation, pSetCount,
280-
pMetricReportCountPerSet, pTotalMetricReportCount, pMetricResults);
273+
ze_result_t ZE_APICALL zetIntelMetricTracerDecodeCalculateValuesExp(zet_metric_decoder_exp_handle_t hMetricDecoder, const size_t rawDataSize,
274+
size_t *usedDataSize, const uint8_t *pRawData, zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation,
275+
uint32_t *pTotalMetricReportsCount, zet_intel_metric_result_exp_t *pMetricResults) {
276+
return L0::zetIntelMetricTracerDecodeCalculateValuesExp(
277+
hMetricDecoder, rawDataSize, usedDataSize, pRawData, hCalculationOperation, pTotalMetricReportsCount, pMetricResults);
281278
}
282279

283280
ze_result_t ZE_APICALL zetIntelMetricScopesGetExp(zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t *pMetricScopesCount, zet_intel_metric_scope_exp_handle_t *phMetricScopes) {

level_zero/core/source/driver/extension_function_address.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void *ExtensionFunctionAddressHelper::getExtensionFunctionAddress(const std::str
129129
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculationOperationDestroyExp);
130130
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculationOperationGetExcludedMetricsExp);
131131
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculationOperationGetReportFormatExp);
132-
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricDecodeCalculateMultipleValuesExp);
132+
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricTracerDecodeCalculateValuesExp);
133133
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricCalculateValuesExp);
134134
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricTracerDecodeExp2);
135135
RETURN_FUNC_PTR_IF_EXIST(zetIntelMetricScopesGetExp);

level_zero/include/level_zero/zet_intel_gpu_metric.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -389,32 +389,23 @@ ze_result_t ZE_APICALL zetIntelMetricCalculationOperationGetExcludedMetricsExp(
389389
zet_metric_handle_t *phMetrics); ///< [out][optional] [range(0, pMetricsCount)] array of metrics handles
390390
///< excluded from the output report of calculation operations
391391
ze_result_t ZE_APICALL
392-
zetIntelMetricDecodeCalculateMultipleValuesExp(
392+
zetIntelMetricTracerDecodeCalculateValuesExp(
393393
zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object
394394
const size_t rawDataSize, ///< [in] size in bytes of raw data buffer.
395-
size_t *offset, ///< [in,out] On input, the offset from the beginning of pRawData to decode
396-
///< and calculate. On output, the number raw bytes processed
395+
size_t *usedDataSize, ///< [out] the number raw bytes processed. User is expected to advance pRawData pointer
396+
///< by this amount if calling this function subsequently with the same data.
397+
///< Note that appending new data to existing is allowed.
397398
const uint8_t *pRawData, ///< [in,out][range(0, *rawDataSize)] buffer containing tracer
398399
///< data in raw format
399400
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation, ///< [in] Calculation operation handle
400-
uint32_t *pSetCount, ///< [in,out] pointer to number of metric sets. if count is zero, then the
401-
///< driver shall update the value with the total number of metric sets to
402-
///< be decoded and calculated. If count is greater than the number available
403-
///< in the raw data buffer, then the driver shall update the value with the
404-
///< actual number of metric sets to be decoded and calculated. There is a
405-
///< 1:1 relationship between the number of sets and the number sub-devices
406-
///< metrics results that can be calculated from the provided data
407-
uint32_t *pMetricReportCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric reports counts
408-
///< per metric set, one value per set
409-
uint32_t *pTotalMetricReportCount, ///< [in,out] [optional] pointer to the total number of metric reports decoded and
401+
uint32_t *pTotalMetricReportsCount, ///< [in,out] [optional] pointer to the total number of metric reports decoded and
410402
///< calculated, for all metric sets. If count is zero, then the driver shall update
411403
///< the value with the total number of metric reports to be decoded and calculated.
412404
///< If count is greater than zero but less than the total number of reports available
413405
///< in the raw data, then only that number of reports will be decoded and calculated.
414406
///< If count is greater than the number of reports available in the raw data buffer,
415407
///< then the driver shall update the value with the actual number of metric reports
416-
///< decoded and calculated. If set to null, then driver will only update the value
417-
///< of pSetCount
408+
///< decoded and calculated.
418409
zet_intel_metric_result_exp_t *pMetricResults); ///< [in,out][optional][range(0, *pTotalMetricResultsCount)] buffer of decoded and
419410
///< calculated metrics results.
420411

level_zero/tools/source/metrics/metric.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -638,11 +638,10 @@ ze_result_t metricCalculateMultipleValues(const size_t rawDataSize, size_t *offs
638638
uint32_t *pSetCount, uint32_t *pMetricsReportCountPerSet,
639639
uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults);
640640

641-
ze_result_t metricDecodeCalculateMultipleValues(zet_intel_metric_decoder_exp_handle_t hMetricDecoder,
642-
const size_t rawDataSize, size_t *offset, const uint8_t *pRawData,
643-
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation,
644-
uint32_t *pSetCount, uint32_t *pMetricReportCountPerSet,
645-
uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults);
641+
ze_result_t metricTracerDecodeCalculateValues(zet_intel_metric_decoder_exp_handle_t hMetricDecoder,
642+
const size_t rawDataSize, size_t *usedDataSize, const uint8_t *pRawData,
643+
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation,
644+
uint32_t *pTotalMetricReportCount, zet_intel_metric_result_exp_t *pMetricResults);
646645

647646
ze_result_t metricsEnable(zet_device_handle_t hDevice);
648647
ze_result_t metricsDisable(zet_device_handle_t hDevice);

level_zero/tools/source/metrics/metric_device_context_create.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,15 @@ ze_result_t metricTracerDecode2(
9696
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
9797
}
9898

99-
ze_result_t metricDecodeCalculateMultipleValues(
99+
ze_result_t metricTracerDecodeCalculateValues(
100100
zet_intel_metric_decoder_exp_handle_t hMetricDecoder,
101101
const size_t rawDataSize,
102-
size_t *offset,
102+
size_t *usedDataSize,
103103
const uint8_t *pRawData,
104104
zet_intel_metric_calculation_operation_exp_handle_t hCalculationOperation,
105-
uint32_t *pSetCount,
106-
uint32_t *pMetricReportCountPerSet,
107105
uint32_t *pTotalMetricReportCount,
108106
zet_intel_metric_result_exp_t *pMetricResults) {
109107
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
110108
}
111109

112-
} // namespace L0
110+
} // namespace L0

level_zero/tools/test/unit_tests/sources/metrics/test_metric_tracer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ TEST(MetricTracerTest, WhenTracerRelatedApisAreCalledThenReturnUnsupportedFeatur
2727
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetMetricDecoderGetDecodableMetricsExp(nullptr, nullptr, nullptr));
2828
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetMetricTracerDecodeExp(nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr));
2929
size_t rawDataSize = 0;
30-
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricDecodeCalculateMultipleValuesExp(nullptr,
31-
rawDataSize, nullptr, nullptr, nullptr,
32-
nullptr, nullptr, nullptr, nullptr));
30+
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricTracerDecodeCalculateValuesExp(nullptr,
31+
rawDataSize, nullptr, nullptr, nullptr,
32+
nullptr, nullptr));
3333
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, zetIntelMetricTracerDecodeExp2(nullptr, rawDataSize, nullptr, 0, nullptr, 0, nullptr, 0, 0, nullptr));
3434
}
3535

3636
} // namespace ult
37-
} // namespace L0
37+
} // namespace L0

0 commit comments

Comments
 (0)