documentation and cleanup, public metrics only

Change-Id: I8213d193ce2ba632adf133e630fd91baf9e81ddd


[ROCm/rocprofiler commit: ca5c0e8928]
Цей коміт міститься в:
Evgeny
2018-06-21 13:01:15 -05:00
джерело e4f873df29
коміт 32b472e246
5 змінених файлів з 30 додано та 37 видалено
+3 -3
Переглянути файл
@@ -1,8 +1,8 @@
ROC Profiler library. ROC Profiler library.
Profiling with metrics and traces based perfcounters (PMC) and SQ threadtraces (SQTT) Profiling with metrics and traces based on perfcounters (PMC) and SQ threadtraces (SQTT).
and AqlProfile HSA extension. Implementation is based on AqlProfile HSA extension.
Library supports GFX8/GFX9.
Library supports GFX8/GFX9 APIs.
The library source tree: The library source tree:
- doc - Documentation - doc - Documentation
- inc/rocprofiler.h - Library public API - inc/rocprofiler.h - Library public API
+6 -1
Переглянути файл
@@ -17,6 +17,10 @@
#include "util/hsa_rsrc_factory.h" #include "util/hsa_rsrc_factory.h"
#include "util/logger.h" #include "util/logger.h"
#ifndef AQL_PROFILE_READ_API_ENABLE
#define AQL_PROFILE_READ_API_ENABLE 0
#endif
namespace rocprofiler { namespace rocprofiler {
struct rocprofiler_contex_t; struct rocprofiler_contex_t;
class Context; class Context;
@@ -310,7 +314,8 @@ class Context {
submit_queue->Submit(&stop_packets[0], stop_packets.size()); submit_queue->Submit(&stop_packets[0], stop_packets.size());
} }
void Read(const uint32_t& group_index, Queue* const queue = NULL) { void Read(const uint32_t& group_index, Queue* const queue = NULL) {
const pkt_vector_t& read_packets = StopPackets(group_index); const pkt_vector_t& read_packets = ReadPackets(group_index);
if (read_packets.size() == 0) EXC_RAISING(HSA_STATUS_ERROR, "Read API disabled");
Queue* const submit_queue = (queue != NULL) ? queue : queue_; Queue* const submit_queue = (queue != NULL) ? queue : queue_;
submit_queue->Submit(&read_packets[0], read_packets.size()); submit_queue->Submit(&read_packets[0], read_packets.size());
} }
+21 -20
Переглянути файл
@@ -10,10 +10,6 @@
#include "util/exception.h" #include "util/exception.h"
#include "util/hsa_rsrc_factory.h" #include "util/hsa_rsrc_factory.h"
#ifndef AQL_PROFILE_READ_API_ENABLE
#define AQL_PROFILE_READ_API_ENABLE 0
#endif
namespace rocprofiler { namespace rocprofiler {
struct profile_info_t { struct profile_info_t {
const event_t* event; const event_t* event;
@@ -86,6 +82,7 @@ class Profile {
completion_signal_ = {}; completion_signal_ = {};
is_legacy_ = (strncmp(agent_info->name, "gfx8", 4) == 0); is_legacy_ = (strncmp(agent_info->name, "gfx8", 4) == 0);
} }
virtual ~Profile() { virtual ~Profile() {
info_vector_.clear(); info_vector_.clear();
if (profile_.command_buffer.ptr) util::HsaRsrcFactory::FreeMemory(profile_.command_buffer.ptr); if (profile_.command_buffer.ptr) util::HsaRsrcFactory::FreeMemory(profile_.command_buffer.ptr);
@@ -115,18 +112,18 @@ class Profile {
if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_start(NULL)"); if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_start(NULL)");
status = Allocate(rsrc); status = Allocate(rsrc);
if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "Allocate()"); if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "Allocate()");
// Generate start/stop profiling packets
// Generate start/stop/read profiling packets
status = api->hsa_ven_amd_aqlprofile_start(&profile_, &start); status = api->hsa_ven_amd_aqlprofile_start(&profile_, &start);
if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_start"); if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_start");
status = api->hsa_ven_amd_aqlprofile_stop(&profile_, &stop); status = api->hsa_ven_amd_aqlprofile_stop(&profile_, &stop);
if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_stop"); if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_stop");
hsa_status_t rd_status = api->hsa_ven_amd_aqlprofile_read(&profile_, &read);
#if 0 // Read API returns error if disabled
if (rd_status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_read");
#endif
#if AQL_PROFILE_READ_API_ENABLE // Set completion signal
status = api->hsa_ven_amd_aqlprofile_read(&profile_, &read);
if (status != HSA_STATUS_SUCCESS) AQL_EXC_RAISING(status, "aqlprofile_read");
#endif // AQL_PROFILE_READ_API_ENABLE
// Set completion signals
hsa_signal_t dummy_signal{}; hsa_signal_t dummy_signal{};
dummy_signal.handle = 0; dummy_signal.handle = 0;
start.completion_signal = dummy_signal; start.completion_signal = dummy_signal;
@@ -137,6 +134,7 @@ class Profile {
read.completion_signal = post_signal; read.completion_signal = post_signal;
completion_signal_ = post_signal; completion_signal_ = post_signal;
// Fill packet vectors
if (is_legacy_) { if (is_legacy_) {
const uint32_t start_index = start_vector.size(); const uint32_t start_index = start_vector.size();
const uint32_t stop_index = stop_vector.size(); const uint32_t stop_index = stop_vector.size();
@@ -148,23 +146,26 @@ class Profile {
&start, reinterpret_cast<void*>(&start_vector[start_index])); &start, reinterpret_cast<void*>(&start_vector[start_index]));
if (status != HSA_STATUS_SUCCESS) if (status != HSA_STATUS_SUCCESS)
AQL_EXC_RAISING(status, "hsa_ven_amd_aqlprofile_legacy_get_pm4"); AQL_EXC_RAISING(status, "hsa_ven_amd_aqlprofile_legacy_get_pm4");
status = api->hsa_ven_amd_aqlprofile_legacy_get_pm4( status = api->hsa_ven_amd_aqlprofile_legacy_get_pm4(
&stop, reinterpret_cast<void*>(&stop_vector[stop_index])); &stop, reinterpret_cast<void*>(&stop_vector[stop_index]));
if (status != HSA_STATUS_SUCCESS) if (status != HSA_STATUS_SUCCESS)
AQL_EXC_RAISING(status, "hsa_ven_amd_aqlprofile_legacy_get_pm4"); AQL_EXC_RAISING(status, "hsa_ven_amd_aqlprofile_legacy_get_pm4");
#if AQL_PROFILE_READ_API_ENABLE if (rd_status == HSA_STATUS_SUCCESS) {
const uint32_t read_index = read_vector.size(); const uint32_t read_index = read_vector.size();
read_vector.insert(read_vector.end(), LEGACY_SLOT_SIZE_PKT, packet_t{}); read_vector.insert(read_vector.end(), LEGACY_SLOT_SIZE_PKT, packet_t{});
status = api->hsa_ven_amd_aqlprofile_legacy_get_pm4( status = api->hsa_ven_amd_aqlprofile_legacy_get_pm4(
&read, reinterpret_cast<void*>(&read_vector[read_index])); &read, reinterpret_cast<void*>(&read_vector[read_index]));
if (status != HSA_STATUS_SUCCESS) if (status != HSA_STATUS_SUCCESS)
AQL_EXC_RAISING(status, "hsa_ven_amd_aqlprofile_legacy_get_pm4"); AQL_EXC_RAISING(status, "hsa_ven_amd_aqlprofile_legacy_get_pm4");
#endif // AQL_PROFILE_READ_API_ENABLE }
} else { } else {
start_vector.push_back(start); start_vector.push_back(start);
stop_vector.push_back(stop); stop_vector.push_back(stop);
read_vector.push_back(read); if (rd_status == HSA_STATUS_SUCCESS) {
read_vector.push_back(read);
}
} }
} }
-6
Переглянути файл
@@ -44,10 +44,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string> #include <string>
#include <vector> #include <vector>
#ifndef AQL_PROFILE_READ_API_ENABLE
#define AQL_PROFILE_READ_API_ENABLE 0
#endif
namespace rocprofiler { namespace rocprofiler {
namespace util { namespace util {
@@ -166,10 +162,8 @@ hsa_status_t HsaRsrcFactory::LoadAqlProfileLib(aqlprofile_pfn_t* api) {
(decltype(::hsa_ven_amd_aqlprofile_start)*)dlsym(handle, "hsa_ven_amd_aqlprofile_start"); (decltype(::hsa_ven_amd_aqlprofile_start)*)dlsym(handle, "hsa_ven_amd_aqlprofile_start");
api->hsa_ven_amd_aqlprofile_stop = api->hsa_ven_amd_aqlprofile_stop =
(decltype(::hsa_ven_amd_aqlprofile_stop)*)dlsym(handle, "hsa_ven_amd_aqlprofile_stop"); (decltype(::hsa_ven_amd_aqlprofile_stop)*)dlsym(handle, "hsa_ven_amd_aqlprofile_stop");
#if AQL_PROFILE_READ_API_ENABLE
api->hsa_ven_amd_aqlprofile_read = api->hsa_ven_amd_aqlprofile_read =
(decltype(::hsa_ven_amd_aqlprofile_read)*)dlsym(handle, "hsa_ven_amd_aqlprofile_read"); (decltype(::hsa_ven_amd_aqlprofile_read)*)dlsym(handle, "hsa_ven_amd_aqlprofile_read");
#endif // AQL_PROFILE_READ_API_ENABLE
api->hsa_ven_amd_aqlprofile_legacy_get_pm4 = api->hsa_ven_amd_aqlprofile_legacy_get_pm4 =
(decltype(::hsa_ven_amd_aqlprofile_legacy_get_pm4)*)dlsym( (decltype(::hsa_ven_amd_aqlprofile_legacy_get_pm4)*)dlsym(
handle, "hsa_ven_amd_aqlprofile_legacy_get_pm4"); handle, "hsa_ven_amd_aqlprofile_legacy_get_pm4");
-7
Переглянути файл
@@ -44,11 +44,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string> #include <string>
#include <vector> #include <vector>
#ifndef AQL_PROFILE_READ_API_ENABLE
#define AQL_PROFILE_READ_API_ENABLE 0
#endif
// Callback function to get available in the system agents // Callback function to get available in the system agents
hsa_status_t HsaRsrcFactory::GetHsaAgentsCallback(hsa_agent_t agent, void* data) { hsa_status_t HsaRsrcFactory::GetHsaAgentsCallback(hsa_agent_t agent, void* data) {
hsa_status_t status = HSA_STATUS_ERROR; hsa_status_t status = HSA_STATUS_ERROR;
@@ -164,10 +159,8 @@ hsa_status_t HsaRsrcFactory::LoadAqlProfileLib(aqlprofile_pfn_t* api) {
(decltype(::hsa_ven_amd_aqlprofile_start)*)dlsym(handle, "hsa_ven_amd_aqlprofile_start"); (decltype(::hsa_ven_amd_aqlprofile_start)*)dlsym(handle, "hsa_ven_amd_aqlprofile_start");
api->hsa_ven_amd_aqlprofile_stop = api->hsa_ven_amd_aqlprofile_stop =
(decltype(::hsa_ven_amd_aqlprofile_stop)*)dlsym(handle, "hsa_ven_amd_aqlprofile_stop"); (decltype(::hsa_ven_amd_aqlprofile_stop)*)dlsym(handle, "hsa_ven_amd_aqlprofile_stop");
#if AQL_PROFILE_READ_API_ENABLE
api->hsa_ven_amd_aqlprofile_read = api->hsa_ven_amd_aqlprofile_read =
(decltype(::hsa_ven_amd_aqlprofile_read)*)dlsym(handle, "hsa_ven_amd_aqlprofile_read"); (decltype(::hsa_ven_amd_aqlprofile_read)*)dlsym(handle, "hsa_ven_amd_aqlprofile_read");
#endif // AQL_PROFILE_READ_API_ENABLE
api->hsa_ven_amd_aqlprofile_legacy_get_pm4 = api->hsa_ven_amd_aqlprofile_legacy_get_pm4 =
(decltype(::hsa_ven_amd_aqlprofile_legacy_get_pm4)*)dlsym( (decltype(::hsa_ven_amd_aqlprofile_legacy_get_pm4)*)dlsym(
handle, "hsa_ven_amd_aqlprofile_legacy_get_pm4"); handle, "hsa_ven_amd_aqlprofile_legacy_get_pm4");