From 859cc066178a87ff28230c1ce9bd370f1e98aa5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Alfv=C3=A9n?= Date: Fri, 28 Mar 2025 12:07:55 +0100 Subject: [PATCH] MLBEDSW-10624: MLCE: Fix MAC cycle calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix regression introduced by commit a3a1df53 that affected Ethos-U85 performance estimations. The MAC count from EstimateConvCycles was not properly captured, leading to zero MACs. - Store MAC count from EstimateConvCycles in cycles.macs. - Corrected the logic when to multiply total MACs by ifm depth Change-Id: I3a927a613e752a98dc3cbfd639d478cffce805cd Signed-off-by: Johan Alfvén --- ethosu/regor/architecture/ethosu85/ethos_u85_performance.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ethosu/regor/architecture/ethosu85/ethos_u85_performance.cpp b/ethosu/regor/architecture/ethosu85/ethos_u85_performance.cpp index 2519623d..c4f80795 100644 --- a/ethosu/regor/architecture/ethosu85/ethos_u85_performance.cpp +++ b/ethosu/regor/architecture/ethosu85/ethos_u85_performance.cpp @@ -73,6 +73,7 @@ CycleCost EthosU85Performance::MeasureCycleCost(const PerformanceQuery &query, c if ( OpUsesMacs(npuOp) ) { cycleComponents = EstimateConvCycles(query, fused); + cycles.macs = cycleComponents.macs; cycles.macs /= sparse ? 2 : 1; cycles.opCycles = cycleComponents.cycles; } @@ -283,7 +284,7 @@ EthosU85Cycles EthosU85Performance::EstimateConvCycles(const PerformanceQuery &q } int64_t totalMacs = int64_t(query.kernel->ElementsWH()) * query.ofmShape.Elements(); - if ( npuOp == EthosU85NpuOp::Depthwise || npuOp == EthosU85NpuOp::Pooling || npuOp == EthosU85NpuOp::ReduceMinMax || npuOp == EthosU85NpuOp::ArgMax ) + if ( !(npuOp == EthosU85NpuOp::Depthwise || npuOp == EthosU85NpuOp::Pooling || npuOp == EthosU85NpuOp::ReduceMinMax || npuOp == EthosU85NpuOp::ArgMax) ) { totalMacs *= query.ifmShape[0].Depth(); } -- GitLab