Remove internal functions from the ROCtracer API

The roctracer_load, roctracer_unload, and roctrace_flush_buf functions
are not part of the ROCtracer API, and should not be exposed in the API
header file, but keep the functions in the library for backward
compatibility.

Add src/roctracer/backward_compat.cpp to implement retired functions.

Add test/app/backward_compat_test.cpp to test that the retired functions
are still accessible in the latest roctracer library.

Change-Id: I4c94310a7bfccfeae9384dac5db18fc79b4c5b17
This commit is contained in:
Laurent Morichetti committed 2022-05-24 15:52:29 -07:00
1 parent a4db4084db
commit 8ee9d859ed
9 files changed
+79 -58

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
/* Copyright (c) 2022 Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. */
#include "roctracer.h"
#define PUBLIC_API __attribute__((visibility("default")))
// Deprecated functions:
extern "C" PUBLIC_API int roctracer_load() { return 1; }
extern "C" PUBLIC_API void roctracer_unload() {}
extern "C" PUBLIC_API void roctracer_flush_buf() {}
+7 -4
View File
@@ -1,3 +1,9 @@
ROCTRACER_4.0 {
global: roctracer_flush_buf;
roctracer_load;
roctracer_unload;
};
ROCTRACER_4.1 {
global: OnLoad;
OnUnload;
@@ -25,9 +31,7 @@ global: OnLoad;
roctracer_error_string;
roctracer_flush_activity;
roctracer_flush_activity_expl;
roctracer_flush_buf;
roctracer_get_timestamp;
roctracer_load;
roctracer_mark;
roctracer_next_record;
roctracer_op_code;
@@ -37,8 +41,7 @@ global: OnLoad;
roctracer_set_properties;
roctracer_start;
roctracer_stop;
roctracer_unload;
roctracer_version_major;
roctracer_version_minor;
local: *;
};
} ROCTRACER_4.0;
+4 -24
View File
@@ -832,18 +832,14 @@ PUBLIC_API roctracer_status_t roctracer_open_pool_expl(const roctracer_propertie
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_open_pool(
const roctracer_properties_t* properties)
{
PUBLIC_API roctracer_status_t roctracer_open_pool(const roctracer_properties_t* properties) {
API_METHOD_PREFIX
roctracer_open_pool_impl(properties, nullptr);
API_METHOD_SUFFIX
}
PUBLIC_API roctracer_status_t roctracer_next_record(
const activity_record_t* record,
const activity_record_t** next)
{
PUBLIC_API roctracer_status_t roctracer_next_record(const activity_record_t* record,
const activity_record_t** next) {
API_METHOD_PREFIX
*next = record + 1;
API_METHOD_SUFFIX
@@ -1079,7 +1075,7 @@ PUBLIC_API roctracer_status_t roctracer_close_pool() {
API_METHOD_PREFIX
roctracer_close_pool_impl(NULL);
API_METHOD_SUFFIX
}
}
// Flush available activity records
static void roctracer_flush_activity_impl(roctracer_pool_t* pool) {
@@ -1224,22 +1220,6 @@ PUBLIC_API roctracer_status_t roctracer_set_properties(roctracer_domain_t domain
API_METHOD_SUFFIX
}
PUBLIC_API bool roctracer_load() {
ONLOAD_TRACE_BEG();
ONLOAD_TRACE_END();
return true;
}
PUBLIC_API void roctracer_unload() {
ONLOAD_TRACE_BEG();
ONLOAD_TRACE_END();
}
PUBLIC_API void roctracer_flush_buf() {
ONLOAD_TRACE_BEG();
ONLOAD_TRACE_END();
}
CONSTRUCTOR_API void constructor() {
ONLOAD_TRACE_BEG();
util::Logger::Create();
-6
View File
@@ -718,16 +718,12 @@ void tool_unload() {
close_tracing_pool();
roctracer::TraceBufferBase::FlushAll();
roctracer_flush_buf();
close_file_handles();
if (hip_api_stats) hip_api_stats->dump();
if (hip_kernel_stats) hip_kernel_stats->dump();
if (hip_memcpy_stats) hip_memcpy_stats->dump();
roctracer_unload();
ONLOAD_TRACE_END();
}
@@ -900,8 +896,6 @@ extern "C" PUBLIC_API bool OnLoad(HsaApiTable* table, uint64_t runtime_version,
const char* const* failed_tool_names) {
ONLOAD_TRACE_BEG();
roctracer_load();
const char* output_prefix = getenv("ROCP_OUTPUT_DIR");
// Dumping HSA handles for agents