Profiler - Add all required metrics
Change-Id: Iea3938df9407789c061c3a6ead9167a69069d6e6 Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
이 커밋은 다음에 포함됨:
1 부모
383c0b19e8
커밋
c3a4c899d5
5 파일이 변경됨
+69
-41
검색과 일치하는 파일 없음
@@ -26,7 +26,9 @@ THE SOFTWARE.
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
// #include "hsa.h"
|
||||
#include "rdc/rdc.h"
|
||||
@@ -114,7 +116,7 @@ bool createHsaQueue(hsa_queue_t** queue, hsa_agent_t gpu_agent) {
|
||||
return (status == HSA_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
int RdcRocpBase::run_profiler(const char* feature_name, hsa_queue_t** queues) {
|
||||
int RdcRocpBase::run_profiler(const char* feature_name) {
|
||||
const char* events[features_count] = {feature_name};
|
||||
|
||||
// initialize hsa. hsa_init() will also load the profiler libs under the hood
|
||||
@@ -176,14 +178,39 @@ int RdcRocpBase::run_profiler(const char* feature_name, hsa_queue_t** queues) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
RdcRocpBase::RdcRocpBase() {
|
||||
// populate monitored fields
|
||||
const std::map<rdc_field_t, const char*> counter_map_k = {
|
||||
{RDC_FI_PROF_TA_BUSY_AVR, "TA_BUSY_avr"},
|
||||
};
|
||||
std::cout << "Size of counter_map_k: " << counter_map_k.size() << "\n";
|
||||
const char* RdcRocpBase::get_field_id_from_name(rdc_field_t field) {
|
||||
return counter_map_k.at(field);
|
||||
}
|
||||
|
||||
const std::vector<rdc_field_t> RdcRocpBase::get_field_ids() {
|
||||
std::vector<rdc_field_t> field_ids;
|
||||
for (auto& [k, v] : counter_map_k) {
|
||||
metrics[v] = 0.0;
|
||||
field_ids.push_back(k);
|
||||
}
|
||||
return field_ids;
|
||||
}
|
||||
|
||||
RdcRocpBase::RdcRocpBase() {
|
||||
counter_map_k = {
|
||||
{RDC_FI_PROF_CU_UTILIZATION, "CU_UTILIZATION"},
|
||||
{RDC_FI_PROF_CU_OCCUPANCY, "CU_OCCUPANCY"},
|
||||
{RDC_FI_PROF_FLOPS_16, "FLOPS_16"},
|
||||
{RDC_FI_PROF_FLOPS_32, "FLOPS_32"},
|
||||
{RDC_FI_PROF_FLOPS_64, "FLOPS_64"},
|
||||
{RDC_FI_PROF_ACTIVE_CYCLES, "ACTIVE_CYCLES"},
|
||||
{RDC_FI_PROF_ACTIVE_WAVES, "ACTIVE_WAVES"},
|
||||
{RDC_FI_PROF_ELAPSED_CYCLES, "ELAPSED_CYCLES"},
|
||||
};
|
||||
|
||||
// populate monitored fields
|
||||
std::cout << "Size of counter_map_k: " << counter_map_k.size() << "\n";
|
||||
|
||||
for (auto& k : counter_map_k) {
|
||||
printf("metric %d = %s\n", k.first, k.second);
|
||||
}
|
||||
for (auto& [k, v] : counter_map_k) {
|
||||
const char* str = v;
|
||||
metrics.emplace(std::make_pair(str, 0.0));
|
||||
}
|
||||
assert(metrics.size() == counter_map_k.size());
|
||||
|
||||
@@ -253,8 +280,7 @@ rdc_status_t RdcRocpBase::rocp_lookup(pair_gpu_field_t gpu_field, double* value)
|
||||
}
|
||||
switch (gpu_field.second) {
|
||||
default:
|
||||
run_profiler("TA_BUSY_avr", queues);
|
||||
// read_features(contexts[gpu_field.first], features_count);
|
||||
run_profiler(counter_map_k.at(gpu_field.second));
|
||||
*value = metrics[counter_map_k.at(gpu_field.second)];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ THE SOFTWARE.
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -42,11 +43,8 @@ rdc_status_t rdc_module_init(uint64_t flags) { return RDC_ST_OK; }
|
||||
// TODO: Query fields with rocprofiler
|
||||
rdc_status_t rdc_telemetry_fields_query(uint32_t field_ids[MAX_NUM_FIELDS], uint32_t* field_count) {
|
||||
// extract all keys from counter_map
|
||||
std::vector<uint32_t> counter_keys;
|
||||
counter_keys.reserve(amd::rdc::counter_map_k.size());
|
||||
for (auto it : amd::rdc::counter_map_k) {
|
||||
counter_keys.push_back(it.first);
|
||||
}
|
||||
std::vector<rdc_field_t> fields = rocp.get_field_ids();
|
||||
std::vector<uint32_t> counter_keys(fields.begin(), fields.end());
|
||||
|
||||
*field_count = counter_keys.size();
|
||||
// copy from vector into array
|
||||
|
||||
새 이슈에서 참조
사용자 차단