Max reduction operation bug fix & support reduction for derived counters (#1085)

* Max reduction operation bug fix & support reduction for derived counters

* CHANGELOG

* Added missing new line

---------

Co-authored-by: Gopesh Bhardwaj <gopesh.bhardwaj@amd.com>
Tento commit je obsažen v:
venkat1361
2024-10-22 12:19:51 -05:00
odevzdal GitHub
rodič 3f91d90bbc
revize 9d3d5cc07c
3 změnil soubory, kde provedl 102 přidání a 6 odebrání
+2 -6
Zobrazit soubor
@@ -78,7 +78,7 @@ perform_reduction(ReduceOperation reduce_op, std::vector<rocprofiler_record_coun
{
result =
*std::max_element(input_array->begin(), input_array->end(), [](auto& a, auto& b) {
return a.counter_value > b.counter_value;
return a.counter_value < b.counter_value;
});
break;
}
@@ -669,11 +669,7 @@ EvaluateAST::evaluate(
break;
case REDUCE_NODE:
{
auto* result = rocprofiler::common::get_val(results_map, _children[0]._metric.id());
if(!result)
throw std::runtime_error(fmt::format("Unable to lookup results for metric {}",
_children[0]._metric.name()));
auto* result = _children.at(0).evaluate(results_map, cache);
if(_reduce_op == REDUCE_NONE)
throw std::runtime_error(fmt::format("Invalid Second argument to reduce(): {}",
static_cast<int>(_reduce_op)));