L0 Metrics: Fix bytes to be read to be a multiple of raw report size

If raw report size is not a multiple of OaBufferSize, then
make sure the bytes to be read (by zetMetricStreamerReadData)
is always a multiple of raw report size.

Related-To: LOCI-3335

Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
Joshua Santosh Ranjan
2022-08-10 07:51:49 +00:00
committed by Compute-Runtime-Automation
parent 0101e80b00
commit cf67f1aa8b
2 changed files with 81 additions and 3 deletions

View File

@@ -232,9 +232,9 @@ uint32_t OaMetricStreamerImp::getRequiredBufferSize(const uint32_t maxReportCoun
DEBUG_BREAK_IF(rawReportSize == 0);
uint32_t maxOaBufferReportCount = oaBufferSize / rawReportSize;
// Trim to OA buffer size if needed.
return maxReportCount > maxOaBufferReportCount ? oaBufferSize
: maxReportCount * rawReportSize;
// Trim report count if needed.
const auto reportCount = std::min(maxOaBufferReportCount, maxReportCount);
return reportCount * rawReportSize;
}
ze_result_t OaMetricGroupImp::openForDevice(Device *pDevice, zet_metric_streamer_desc_t &desc,