Cleanup the include files

Use #include "header" instead of #include <header> so that the header
files are found when the application #includes <roctracer/roctracer.h>
with -I /opt/rocm/include.

Change-Id: I24feac9a5030d3600aee98084340e246c3990db5


[ROCm/roctracer commit: 05ee3ff973]
This commit is contained in:
Laurent Morichetti
2022-09-08 22:08:08 -07:00
rodzic 14c153601d
commit e8cb732660
12 zmienionych plików z 111 dodań i 114 usunięć
@@ -1,3 +1,4 @@
---
BasedOnStyle: InheritParentConfig
ColumnLimit: 79
...
+18 -16
Wyświetl plik
@@ -26,30 +26,32 @@
/* Traced API domains */
typedef enum {
ACTIVITY_DOMAIN_HSA_API = 0, /* HSA API domain */
ACTIVITY_DOMAIN_HSA_OPS = 1, /* HSA async activity domain */
ACTIVITY_DOMAIN_HIP_OPS = 2, /* HIP async activity domain */
ACTIVITY_DOMAIN_HCC_OPS = ACTIVITY_DOMAIN_HIP_OPS, /* HCC async activity domain */
ACTIVITY_DOMAIN_HIP_VDI = ACTIVITY_DOMAIN_HIP_OPS, /* HIP VDI async activity domain */
ACTIVITY_DOMAIN_HIP_API = 3, /* HIP API domain */
ACTIVITY_DOMAIN_KFD_API = 4, /* KFD API domain */
ACTIVITY_DOMAIN_EXT_API = 5, /* External ID domain */
ACTIVITY_DOMAIN_ROCTX = 6, /* ROCTX domain */
ACTIVITY_DOMAIN_HSA_EVT = 7, /* HSA events */
ACTIVITY_DOMAIN_HSA_API = 0, /* HSA API domain */
ACTIVITY_DOMAIN_HSA_OPS = 1, /* HSA async activity domain */
ACTIVITY_DOMAIN_HIP_OPS = 2, /* HIP async activity domain */
ACTIVITY_DOMAIN_HCC_OPS =
ACTIVITY_DOMAIN_HIP_OPS, /* HCC async activity domain */
ACTIVITY_DOMAIN_HIP_VDI =
ACTIVITY_DOMAIN_HIP_OPS, /* HIP VDI async activity domain */
ACTIVITY_DOMAIN_HIP_API = 3, /* HIP API domain */
ACTIVITY_DOMAIN_KFD_API = 4, /* KFD API domain */
ACTIVITY_DOMAIN_EXT_API = 5, /* External ID domain */
ACTIVITY_DOMAIN_ROCTX = 6, /* ROCTX domain */
ACTIVITY_DOMAIN_HSA_EVT = 7, /* HSA events */
ACTIVITY_DOMAIN_NUMBER
} activity_domain_t;
/* Extension API opcodes */
typedef enum { ACTIVITY_EXT_OP_MARK = 0, ACTIVITY_EXT_OP_EXTERN_ID = 1 } activity_ext_op_t;
/* API callback type */
typedef void (*activity_rtapi_callback_t)(uint32_t domain, uint32_t cid, const void* data,
void* arg);
typedef void (*activity_rtapi_callback_t)(uint32_t domain, uint32_t cid,
const void* data, void* arg);
typedef uint32_t activity_kind_t;
typedef uint32_t activity_op_t;
/* API callback phase */
typedef enum { ACTIVITY_API_PHASE_ENTER = 0, ACTIVITY_API_PHASE_EXIT = 1 } activity_api_phase_t;
typedef enum {
ACTIVITY_API_PHASE_ENTER = 0,
ACTIVITY_API_PHASE_EXIT = 1
} activity_api_phase_t;
/* Trace record types */
+27 -28
Wyświetl plik
@@ -82,7 +82,7 @@
#include <stddef.h>
#include <stdint.h>
#include <ext/prof_protocol.h>
#include "ext/prof_protocol.h"
#ifdef __cplusplus
extern "C" {
@@ -254,7 +254,7 @@ typedef enum {
* \return Return the error string. The caller owns the returned string and
* should use \p free() to deallocate it.
*/
ROCTRACER_API const char *roctracer_error_string() ROCTRACER_VERSION_4_1;
ROCTRACER_API const char* roctracer_error_string() ROCTRACER_VERSION_4_1;
/** @} */
@@ -284,9 +284,8 @@ typedef activity_domain_t roctracer_domain_t;
* the domain or operation are invalid. The string is owned by the ROC Tracer
* library.
*/
ROCTRACER_API const char *
roctracer_op_string(uint32_t domain, uint32_t op,
uint32_t kind) ROCTRACER_VERSION_4_1;
ROCTRACER_API const char* roctracer_op_string(
uint32_t domain, uint32_t op, uint32_t kind) ROCTRACER_VERSION_4_1;
/**
* Query the operation code given a domain and the name of an operation.
@@ -309,8 +308,8 @@ roctracer_op_string(uint32_t domain, uint32_t op,
* not supported.
*/
ROCTRACER_API roctracer_status_t
roctracer_op_code(uint32_t domain, const char *str, uint32_t *op,
uint32_t *kind) ROCTRACER_VERSION_4_1;
roctracer_op_code(uint32_t domain, const char* str, uint32_t* op,
uint32_t* kind) ROCTRACER_VERSION_4_1;
/**
* Set the properties of a domain.
@@ -325,7 +324,7 @@ roctracer_op_code(uint32_t domain, const char *str, uint32_t *op,
* successfully.
*/
ROCTRACER_API roctracer_status_t roctracer_set_properties(
roctracer_domain_t domain, void *properties) ROCTRACER_VERSION_4_1;
roctracer_domain_t domain, void* properties) ROCTRACER_VERSION_4_1;
/** @} */
@@ -368,7 +367,7 @@ typedef activity_rtapi_callback_t roctracer_rtapi_callback_t;
*/
ROCTRACER_API roctracer_status_t roctracer_enable_op_callback(
activity_domain_t domain, uint32_t op, activity_rtapi_callback_t callback,
void *arg) ROCTRACER_VERSION_4_1;
void* arg) ROCTRACER_VERSION_4_1;
/**
* Enable runtime API callback for all operations of a domain.
@@ -387,7 +386,7 @@ ROCTRACER_API roctracer_status_t roctracer_enable_op_callback(
*/
ROCTRACER_API roctracer_status_t roctracer_enable_domain_callback(
activity_domain_t domain, activity_rtapi_callback_t callback,
void *arg) ROCTRACER_VERSION_4_1;
void* arg) ROCTRACER_VERSION_4_1;
/**
* Disable runtime API callback for a specific operation of a domain.
@@ -454,8 +453,8 @@ typedef activity_record_t roctracer_record_t;
* successfully.
*/
ROCTRACER_API roctracer_status_t
roctracer_next_record(const activity_record_t *record,
const activity_record_t **next) ROCTRACER_VERSION_4_1;
roctracer_next_record(const activity_record_t* record,
const activity_record_t** next) ROCTRACER_VERSION_4_1;
/**
* Memory pool allocator callback.
@@ -476,7 +475,7 @@ roctracer_next_record(const activity_record_t *record,
* \p arg Argument provided in the ::roctracer_properties_t passed to the
* ::roctracer_open_pool function.
*/
typedef void (*roctracer_allocator_t)(char **ptr, size_t size, void *arg);
typedef void (*roctracer_allocator_t)(char** ptr, size_t size, void* arg);
/**
* Memory pool buffer callback.
@@ -490,8 +489,8 @@ typedef void (*roctracer_allocator_t)(char **ptr, size_t size, void *arg);
*
* \p arg the argument specified when the callback was defined.
*/
typedef void (*roctracer_buffer_callback_t)(const char *begin, const char *end,
void *arg);
typedef void (*roctracer_buffer_callback_t)(const char* begin, const char* end,
void* arg);
/**
* Memory pool properties.
@@ -518,7 +517,7 @@ typedef struct {
/**
* The argument to pass when invoking the \p alloc_fun allocator.
*/
void *alloc_arg;
void* alloc_arg;
/**
* The function to call when a buffer becomes full or is flushed.
@@ -528,7 +527,7 @@ typedef struct {
/**
* The argument to pass when invoking the \p buffer_callback_fun callback.
*/
void *buffer_callback_arg;
void* buffer_callback_arg;
} roctracer_properties_t;
/**
@@ -559,8 +558,8 @@ typedef void roctracer_pool_t;
* for the \p pool. Unable to create the pool.
*/
ROCTRACER_API roctracer_status_t
roctracer_open_pool_expl(const roctracer_properties_t *properties,
roctracer_pool_t **pool) ROCTRACER_VERSION_4_1;
roctracer_open_pool_expl(const roctracer_properties_t* properties,
roctracer_pool_t** pool) ROCTRACER_VERSION_4_1;
/**
* Create tracer memory pool.
@@ -580,7 +579,7 @@ roctracer_open_pool_expl(const roctracer_properties_t *properties,
* for the \p pool. Unable to create the pool.
*/
ROCTRACER_API roctracer_status_t roctracer_open_pool(
const roctracer_properties_t *properties) ROCTRACER_VERSION_4_1;
const roctracer_properties_t* properties) ROCTRACER_VERSION_4_1;
/**
* Close tracer memory pool.
@@ -596,7 +595,7 @@ ROCTRACER_API roctracer_status_t roctracer_open_pool(
* successfully or pool was NULL and there is no default pool.
*/
ROCTRACER_API roctracer_status_t
roctracer_close_pool_expl(roctracer_pool_t *pool) ROCTRACER_VERSION_4_1;
roctracer_close_pool_expl(roctracer_pool_t* pool) ROCTRACER_VERSION_4_1;
/**
* Close default tracer memory pool, if defined, and set to undefined.
@@ -619,15 +618,15 @@ ROCTRACER_API roctracer_status_t roctracer_close_pool() ROCTRACER_VERSION_4_1;
* @return Return the current default memory pool before any change, or NULL if
* none is defined.
*/
ROCTRACER_API roctracer_pool_t *
roctracer_default_pool_expl(roctracer_pool_t *pool) ROCTRACER_VERSION_4_1;
ROCTRACER_API roctracer_pool_t* roctracer_default_pool_expl(
roctracer_pool_t* pool) ROCTRACER_VERSION_4_1;
/**
* Query the current default memory pool.
*
* @return Return the current default memory pool, or NULL is none is defined.
*/
ROCTRACER_API roctracer_pool_t *roctracer_default_pool() ROCTRACER_VERSION_4_1;
ROCTRACER_API roctracer_pool_t* roctracer_default_pool() ROCTRACER_VERSION_4_1;
/**
* Enable activity record logging for a specified operation of a domain
@@ -648,7 +647,7 @@ ROCTRACER_API roctracer_pool_t *roctracer_default_pool() ROCTRACER_VERSION_4_1;
*/
ROCTRACER_API roctracer_status_t roctracer_enable_op_activity_expl(
activity_domain_t domain, uint32_t op,
roctracer_pool_t *pool) ROCTRACER_VERSION_4_1;
roctracer_pool_t* pool) ROCTRACER_VERSION_4_1;
/**
* Enable activity record logging for a specified operation of a domain using
@@ -682,7 +681,7 @@ ROCTRACER_API roctracer_status_t roctracer_enable_op_activity(
* defined.
*/
ROCTRACER_API roctracer_status_t roctracer_enable_domain_activity_expl(
activity_domain_t domain, roctracer_pool_t *pool) ROCTRACER_VERSION_4_1;
activity_domain_t domain, roctracer_pool_t* pool) ROCTRACER_VERSION_4_1;
/**
* Enable activity record logging for all operations of a domain using the
@@ -736,7 +735,7 @@ ROCTRACER_API roctracer_status_t roctracer_disable_domain_activity(
* successfully.
*/
ROCTRACER_API roctracer_status_t
roctracer_flush_activity_expl(roctracer_pool_t *pool) ROCTRACER_VERSION_4_1;
roctracer_flush_activity_expl(roctracer_pool_t* pool) ROCTRACER_VERSION_4_1;
/**
* Flush available activity records for the default memory pool.
@@ -769,7 +768,7 @@ ROCTRACER_API roctracer_status_t roctracer_flush_activity()
* successfully.
*/
ROCTRACER_API roctracer_status_t roctracer_get_timestamp(
roctracer_timestamp_t *timestamp) ROCTRACER_VERSION_4_1;
roctracer_timestamp_t* timestamp) ROCTRACER_VERSION_4_1;
/** @} */
+11 -3
Wyświetl plik
@@ -30,7 +30,13 @@
#ifndef ROCTRACER_EXT_H_
#define ROCTRACER_EXT_H_
#include <roctracer.h>
#include "roctracer.h"
/* Extension API opcodes */
typedef enum {
ACTIVITY_EXT_OP_MARK = 0,
ACTIVITY_EXT_OP_EXTERN_ID = 1
} activity_ext_op_t;
typedef void (*roctracer_start_cb_t)();
typedef void (*roctracer_stop_cb_t)();
@@ -58,12 +64,14 @@ void ROCTRACER_API roctracer_stop() ROCTRACER_VERSION_4_1;
// Notifies that the calling thread is entering an external API region.
// Push an external correlation id for the calling thread.
roctracer_status_t ROCTRACER_API
roctracer_activity_push_external_correlation_id(activity_correlation_id_t id) ROCTRACER_VERSION_4_1;
roctracer_activity_push_external_correlation_id(activity_correlation_id_t id)
ROCTRACER_VERSION_4_1;
// Notifies that the calling thread is leaving an external API region.
// Pop an external correlation id for the calling thread.
// 'lastId' returns the last external correlation if not NULL
roctracer_status_t ROCTRACER_API roctracer_activity_pop_external_correlation_id(
roctracer_status_t ROCTRACER_API
roctracer_activity_pop_external_correlation_id(
activity_correlation_id_t* last_id) ROCTRACER_VERSION_4_1;
#ifdef __cplusplus
+3 -2
Wyświetl plik
@@ -18,6 +18,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#pragma message("This file has been deprecated and marked for removal. Please use roctracer_hip.h instead.")
#pragma message( \
"This file has been deprecated and marked for removal. Please use roctracer_hip.h instead.")
#include <roctracer_hip.h>
#include "roctracer_hip.h"
+5 -30
Wyświetl plik
@@ -18,29 +18,15 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#ifndef INC_ROCTRACER_HIP_H_
#define INC_ROCTRACER_HIP_H_
#ifndef ROCTRACER_HIP_H_
#define ROCTRACER_HIP_H_
#ifdef __cplusplus
#include <iostream>
inline static std::ostream& operator<<(std::ostream& out, const unsigned char& v) {
out << (unsigned int)v;
return out;
}
inline static std::ostream& operator<<(std::ostream& out, const char& v) {
out << (unsigned char)v;
return out;
}
#endif // __cplusplus
#include "roctracer.h"
#include <hip/hip_runtime.h>
#include <hip_ostream_ops.h>
#include "hip_ostream_ops.h"
#include <hip/amd_detail/hip_prof_str.h>
#include <roctracer.h>
typedef enum {
HIP_OP_ID_DISPATCH = 0,
HIP_OP_ID_COPY = 1,
@@ -48,15 +34,4 @@ typedef enum {
HIP_OP_ID_NUMBER = 3
} hip_op_id_t;
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Traced calls ID enumeration
typedef enum hip_api_id_t roctracer_hip_api_cid_t;
#ifdef __cplusplus
} // extern "C" block
#endif // __cplusplus
#endif // INC_ROCTRACER_HIP_H_
#endif // ROCTRACER_HIP_H_
+21 -17
Wyświetl plik
@@ -18,14 +18,15 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#ifndef INC_ROCTRACER_HSA_H_
#define INC_ROCTRACER_HSA_H_
#ifndef ROCTRACER_HSA_H_
#define ROCTRACER_HSA_H_
#include <roctracer.h>
#include "roctracer.h"
#include <hsa/hsa.h>
#include <hsa/hsa_ext_amd.h>
#include <hsa_prof_str.h>
#include "hsa_ostream_ops.h"
#include "hsa_prof_str.h"
// HSA OP ID enumeration
enum hsa_op_id_t {
@@ -55,11 +56,12 @@ struct hsa_ops_properties_t {
typedef struct {
union {
struct {
const void* ptr; // allocated area ptr
size_t size; // allocated area size, zero size means 'free' callback
const void* ptr; // allocated area ptr
size_t size; // allocated area size, zero size means 'free' callback
hsa_amd_segment_t segment; // allocated area's memory segment type
hsa_amd_memory_pool_global_flag_t global_flag; // allocated area's memory global flag
int is_code; // equal to 1 if code is allocated
hsa_amd_memory_pool_global_flag_t
global_flag; // allocated area's memory global flag
int is_code; // equal to 1 if code is allocated
} allocate;
struct {
@@ -76,11 +78,12 @@ typedef struct {
} memcopy;
struct {
const void* packet; // submitted to GPU packet
const char* kernel_name; // kernel name, NULL if not a kernel dispatch packet
hsa_queue_t* queue; // HSA queue the packet was submitted to
uint32_t device_type; // type of device the packet is submitted to
uint32_t device_id; // id of device the packet is submitted to
const void* packet; // submitted to GPU packet
const char*
kernel_name; // kernel name, NULL if not a kernel dispatch packet
hsa_queue_t* queue; // HSA queue the packet was submitted to
uint32_t device_type; // type of device the packet is submitted to
uint32_t device_id; // id of device the packet is submitted to
} submit;
struct {
@@ -98,11 +101,12 @@ typedef struct {
uint64_t load_base; // code object load base
uint64_t load_size; // code object load size
uint64_t load_delta; // code object load size
uint32_t uri_length; // URI string length (not including the terminating NUL character)
const char* uri; // URI string
int unload; // unload flag
uint32_t uri_length; // URI string length (not including the terminating
// NUL character)
const char* uri; // URI string
int unload; // unload flag
} codeobj;
};
} hsa_evt_data_t;
#endif // INC_ROCTRACER_HSA_H_
#endif // ROCTRACER_HSA_H_
@@ -77,9 +77,8 @@ extern "C" {
*
* @return Returns 0 on success and -1 on error.
*/
ROCTRACER_EXPORT int
roctracer_plugin_initialize(uint32_t roctracer_major_version,
uint32_t roctracer_minor_version);
ROCTRACER_EXPORT int roctracer_plugin_initialize(
uint32_t roctracer_major_version, uint32_t roctracer_minor_version);
/**
* Finalize plugin.
@@ -109,9 +108,8 @@ ROCTRACER_EXPORT void roctracer_plugin_finalize();
*
* @return Returns 0 on success and -1 on error.
*/
ROCTRACER_EXPORT int
roctracer_plugin_write_callback_record(const roctracer_record_t *record,
const void *callback_data);
ROCTRACER_EXPORT int roctracer_plugin_write_callback_record(
const roctracer_record_t* record, const void* callback_data);
/**
* Report a range of activity trace data.
@@ -127,9 +125,8 @@ roctracer_plugin_write_callback_record(const roctracer_record_t *record,
*
* @return Returns 0 on success and -1 on error.
*/
ROCTRACER_EXPORT int
roctracer_plugin_write_activity_records(const roctracer_record_t *begin,
const roctracer_record_t *end);
ROCTRACER_EXPORT int roctracer_plugin_write_activity_records(
const roctracer_record_t* begin, const roctracer_record_t* end);
/** @} */
@@ -21,7 +21,7 @@
#ifndef ROCTRACER_ROCTX_H_
#define ROCTRACER_ROCTX_H_
#include <roctx.h>
#include "roctx.h"
/**
* ROCTX API ID enumeration
+2 -1
Wyświetl plik
@@ -211,7 +211,8 @@ typedef uint64_t roctx_range_id_t;
*
* \return Returns the ID of the new range.
*/
ROCTX_API roctx_range_id_t roctxRangeStartA(const char* message) ROCTX_VERSION_4_1;
ROCTX_API roctx_range_id_t roctxRangeStartA(const char* message)
ROCTX_VERSION_4_1;
#define roctxRangeStart(message) roctxRangeStartA(message)
/**
@@ -58,7 +58,15 @@ header_basic = \
' using std::operator<<;\n' + \
' static bool recursion = false;\n' + \
' if (recursion == false) { recursion = true; out << v; recursion = false; }\n' + \
' return out; }\n'
' return out;\n }\n' + \
'\n' + \
' inline static std::ostream &operator<<(std::ostream &out, const unsigned char &v) {\n' + \
' out << (unsigned int)v;\n' + \
' return out;\n }\n' + \
'\n' + \
' inline static std::ostream &operator<<(std::ostream &out, const char &v) {\n' + \
' out << (unsigned char)v;\n' + \
' return out;\n }\n'
structs_analyzed = {}
global_ops = ''
@@ -153,11 +161,12 @@ def gen_cppheader(infilepath, outfilepath, rank):
header_s = \
'#ifndef INC_' + apiname + '_OSTREAM_OPS_H_\n' + \
'#define INC_' + apiname + '_OSTREAM_OPS_H_\n' + \
'\n' + \
'#include "roctracer.h"\n' + \
'\n' + \
'#ifdef __cplusplus\n' + \
'#include <iostream>\n' + \
'\n' + \
'#include "roctracer.h"\n'
header_s += '#include <string>\n'
'#include <string>\n'
output_filename_h.write(header_s)
output_filename_h.write('\n')
@@ -22,8 +22,8 @@
#include <cstdio>
#include <cstdlib>
#include "inc/roctracer.h"
#include "inc/roctracer_hsa.h"
#include "roctracer.h"
#include "roctracer_hsa.h"
namespace {
// Check returned HSA API status
@@ -66,4 +66,4 @@ ROCTRACER_EXPORT void OnUnload() {
CHECK(roctracer_disable_domain_callback(ACTIVITY_DOMAIN_HSA_EVT));
}
} // extern "C"
} // extern "C"