diff --git a/source/lib/rocprofiler-sdk/counters/core.cpp b/source/lib/rocprofiler-sdk/counters/core.cpp index a8b07cd0cc..912fc0c05e 100644 --- a/source/lib/rocprofiler-sdk/counters/core.cpp +++ b/source/lib/rocprofiler-sdk/counters/core.cpp @@ -206,7 +206,16 @@ counter_callback_info::setup_profile_config(const hsa::AgentCache& age return ROCPROFILER_STATUS_ERROR_AST_NOT_FOUND; } config.asts.push_back(*counter_ast); - config.asts.back().set_dimensions(); + + try + { + config.asts.back().set_dimensions(); + } catch(std::runtime_error& e) + { + LOG(ERROR) << metric.name() << " has improper dimensions" + << " " << e.what(); + return ROCPROFILER_STATUS_ERROR_AST_NOT_FOUND; + } } profile->pkt_generator = std::make_unique( diff --git a/source/lib/rocprofiler-sdk/counters/dimensions.cpp b/source/lib/rocprofiler-sdk/counters/dimensions.cpp index 792182f8f5..db7ce834da 100644 --- a/source/lib/rocprofiler-sdk/counters/dimensions.cpp +++ b/source/lib/rocprofiler-sdk/counters/dimensions.cpp @@ -117,10 +117,18 @@ get_dimension_cache() const auto& asts = counters::get_ast_map(); for(const auto& [gfx, metrics] : asts) { - for(const auto& [_, ast] : metrics) + for(const auto& [metric, ast] : metrics) { auto ast_copy = ast; - dims.emplace(ast.out_id().handle, ast_copy.set_dimensions()); + try + { + dims.emplace(ast.out_id().handle, ast_copy.set_dimensions()); + } catch(std::runtime_error& e) + { + LOG(ERROR) << metric << " has improper dimensions" + << " " << e.what(); + throw; + } } } return dims;