Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface proposal : pull request 4 #60

Open
wants to merge 15 commits into
base: rocm-4.3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ set ( PUBLIC_HEADERS
roctracer_kfd.h
roctracer_roctx.h
roctracer_cb_table.h
roctracer_trace_entries.h
ext/prof_protocol.h
ext/hsa_rt_utils.hpp
)
Expand Down
89 changes: 89 additions & 0 deletions inc/roctracer_trace_entries.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#ifndef INC_ROCTRACER_TRACE_ENTRIES_H_
#define INC_ROCTRACER_TRACE_ENTRIES_H_

#include <atomic>
#include <cstdint>

#include <roctracer.h>
#include <roctracer_roctx.h>
#include <roctracer_hsa.h>
#include <roctracer_hip.h>
#include <roctracer_kfd.h>
#include <ext/prof_protocol.h>
#include <ext/hsa_rt_utils.hpp>

typedef hsa_rt_utils::Timer::timestamp_t timestamp_t;

namespace roctracer {
enum entry_type_t {
DFLT_ENTRY_TYPE = 0,
API_ENTRY_TYPE = 1,
COPY_ENTRY_TYPE = 2,
KERNEL_ENTRY_TYPE = 3,
NUM_ENTRY_TYPE = 4
};
}

struct roctx_trace_entry_t {
std::atomic<uint32_t> valid;
roctracer::entry_type_t type;
uint32_t cid;
timestamp_t time;
uint32_t pid;
uint32_t tid;
roctx_range_id_t rid;
const char* message;
};

struct hsa_api_trace_entry_t {
std::atomic<uint32_t> valid;
roctracer::entry_type_t type;
uint32_t cid;
timestamp_t begin;
timestamp_t end;
uint32_t pid;
uint32_t tid;
hsa_api_data_t data;
};

struct hsa_activity_trace_entry_t {
uint64_t index;
uint32_t op;
uint32_t pid;
activity_record_t *record;
void *arg;
};

struct hip_api_trace_entry_t {
std::atomic<uint32_t> valid;
roctracer::entry_type_t type;
uint32_t domain;
uint32_t cid;
timestamp_t begin;
timestamp_t end;
uint32_t pid;
uint32_t tid;
hip_api_data_t data;
const char* name;
void* ptr;
};

struct hip_activity_trace_entry_t {
const roctracer_record_t *record;
const char *name;
uint32_t pid;
};

struct kfd_api_trace_entry_t {
std::atomic<uint32_t> valid;
roctracer::entry_type_t type;
uint32_t domain;
uint32_t cid;
timestamp_t begin;
timestamp_t end;
uint32_t pid;
uint32_t tid;
kfd_api_data_t data;
};

#endif
10 changes: 2 additions & 8 deletions src/core/trace_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <string.h>
#include <unistd.h>

#include <roctracer_trace_entries.h>

#define FATAL(stream) \
do { \
std::ostringstream oss; \
Expand All @@ -36,14 +38,6 @@ enum {
TRACE_ENTRY_COMPL = 2
};

enum entry_type_t {
DFLT_ENTRY_TYPE = 0,
API_ENTRY_TYPE = 1,
COPY_ENTRY_TYPE = 2,
KERNEL_ENTRY_TYPE = 3,
NUM_ENTRY_TYPE = 4
};

struct trace_entry_t {
std::atomic<uint32_t> valid;
entry_type_t type;
Expand Down
Loading