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
[ROCm/roctracer commit: 8ee9d859ed]
This commit is contained in:
@@ -773,30 +773,6 @@ roctracer_status_t roctracer_get_timestamp(uint64_t* timestamp);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** \defgroup internal_group Internal Operations
|
||||
*
|
||||
* \todo Should these operation be part of the API?
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load ROC Tracer library.
|
||||
*/
|
||||
bool roctracer_load();
|
||||
|
||||
/**
|
||||
* Unload ROC Tracer library.
|
||||
*/
|
||||
void roctracer_unload();
|
||||
|
||||
/**
|
||||
* Flush trace buffers.
|
||||
*/
|
||||
void roctracer_flush_buf();
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C" block
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -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() {}
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -111,6 +111,11 @@ hip_add_executable(roctx_test EXCLUDE_FROM_ALL app/roctx_test.cpp)
|
||||
target_link_libraries(roctx_test Threads::Threads roctx)
|
||||
add_dependencies(mytest roctx_test)
|
||||
|
||||
## Build the backward compatibility test
|
||||
add_executable(backward_compat_test EXCLUDE_FROM_ALL app/backward_compat_test.cpp)
|
||||
target_link_libraries(backward_compat_test roctracer)
|
||||
add_dependencies(mytest backward_compat_test)
|
||||
|
||||
## Copy the golden traces and test scripts
|
||||
configure_file(run.sh ${PROJECT_BINARY_DIR} COPYONLY)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink run.sh ${PROJECT_BINARY_DIR}/run_ci.sh)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/* 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"
|
||||
|
||||
extern "C" int roctracer_load(); // Removed in ROCTX 4.1
|
||||
extern "C" void roctracer_unload(); // Removed in ROCTX 4.1
|
||||
extern "C" void roctracer_flush_buf(); // Removed in ROCTX 4.1
|
||||
|
||||
int main() {
|
||||
if (roctracer_load() != 1) return -1;
|
||||
roctracer_flush_buf();
|
||||
roctracer_unload();
|
||||
return 0;
|
||||
}
|
||||
@@ -17,3 +17,4 @@ hsa_co_trace --check-none
|
||||
code_obj_trace --check-none
|
||||
trace_buffer_trace --check-none
|
||||
roctx_test_trace --check-count .*
|
||||
backward_compat_test_trace --check-none
|
||||
@@ -185,6 +185,8 @@ eval_test "tool tracer codeobj" ./test/MatrixTranspose code_obj_trace
|
||||
|
||||
eval_test "directed TraceBuffer test" ./test/trace_buffer trace_buffer_trace
|
||||
|
||||
eval_test "backward compatibilty tests" ./test/backward_compat_test backward_compat_test_trace
|
||||
|
||||
echo "$test_number tests total / $test_runnum tests run / $test_status tests failed"
|
||||
if [ $test_status != 0 ] ; then
|
||||
echo $failed_tests
|
||||
|
||||
Reference in New Issue
Block a user