Miscellanous AFAR 5 Updates (#891)

* Dispatch table copy/update uses ROCP_TRACE instead of ROCP_INFO

* Update rocprofiler-sdk CMake config

- rocprofiler::rocprofiler is alias to rocprofiler-sdk::rocprofiler-sdk instead of other way around

* Prefer rocprofiler-sdk::rocprofiler-sdk over rocprofiler::rocprofiler

* Fix WITH_UNWIND for glog

- requires a value of "none" instead of boolean now

* Update include/rocprofiler-sdk/registration.h

- explicit struct names to permit forward decl

* Update include/rocprofiler-sdk/cxx/serialization.hpp

- ROCPROFILER_SDK_CEREAL_NAMESPACE_BEGIN and ROCPROFILER_SDK_CEREAL_NAMESPACE_END to enable customized namespace

[ROCm/rocprofiler-sdk commit: 5525b400c3]
This commit is contained in:
Jonathan R. Madsen
2024-05-29 16:45:56 -05:00
committad av GitHub
förälder 4fb92ff114
incheckning ada9d97b78
16 ändrade filer med 61 tillägg och 48 borttagningar
@@ -7,19 +7,19 @@ if(@PACKAGE_NAME@_FIND_COMPONENTS)
if(TARGET ${TARG})
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG})
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
else()
set(@PACKAGE_NAME@_${COMP}_FOUND 0)
endif()
endforeach()
else()
set(@PACKAGE_NAME@_LIBRARIES @PROJECT_NAME@::@PROJECT_NAME@)
set(@PACKAGE_NAME@_LIBRARIES @PACKAGE_NAME@::@PACKAGE_NAME@)
endif()
foreach(COMP @PROJECT_BUILD_TREE_TARGETS@)
set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${COMP})
if(TARGET ${TARG})
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG})
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
endif()
endforeach()
@@ -34,12 +34,14 @@ endforeach()
set(@PACKAGE_NAME@_LIBRARIES)
# add interface library
add_library(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE IMPORTED)
add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ ALIAS @PROJECT_NAME@::@PROJECT_NAME@)
add_library(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE IMPORTED)
if(NOT TARGET @PROJECT_NAME@::@PROJECT_NAME@)
add_library(@PROJECT_NAME@::@PROJECT_NAME@ ALIAS @PACKAGE_NAME@::@PACKAGE_NAME@)
endif()
target_include_directories(@PROJECT_NAME@::@PROJECT_NAME@
target_include_directories(@PACKAGE_NAME@::@PACKAGE_NAME@
INTERFACE "${@PACKAGE_NAME@_INCLUDE_DIR}")
target_link_directories(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE
target_link_directories(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE
"${@PACKAGE_NAME@_LIB_DIR}")
if(@PACKAGE_NAME@_BUILD_TREE
@@ -111,7 +113,7 @@ else()
set(TARG @PROJECT_NAME@::@PROJECT_NAME@-${TARG})
if(NOT @PACKAGE_NAME@_FIND_COMPONENTS)
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG})
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
endif()
endforeach()
@@ -121,14 +123,14 @@ else()
if(TARGET ${TARG})
set(@PACKAGE_NAME@_${COMP}_FOUND 1)
list(APPEND @PACKAGE_NAME@_LIBRARIES ${TARG})
target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@ INTERFACE ${TARG})
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@ INTERFACE ${TARG})
else()
set(@PACKAGE_NAME@_${COMP}_FOUND 0)
endif()
endforeach()
endif()
target_link_libraries(@PROJECT_NAME@::@PROJECT_NAME@
target_link_libraries(@PACKAGE_NAME@::@PACKAGE_NAME@
INTERFACE @PACKAGE_NAME@::@PACKAGE_NAME@-external-nolink)
endif()
+1 -1
Visa fil
@@ -76,7 +76,7 @@ if(ROCPROFILER_BUILD_GLOG)
# May want to use GFLAGS in the future
set(WITH_GFLAGS OFF)
set(WITH_GTEST OFF)
set(WITH_UNWIND OFF)
set(WITH_UNWIND "none")
add_subdirectory(glog EXCLUDE_FROM_ALL)
target_link_libraries(rocprofiler-glog INTERFACE $<BUILD_INTERFACE:glog::glog>)
@@ -46,8 +46,8 @@ add_executable(advanced-thread-trace)
target_sources(advanced-thread-trace PRIVATE main.cpp client.cpp)
target_link_libraries(
advanced-thread-trace
PRIVATE rocprofiler::rocprofiler amd_comgr rocprofiler::samples-common-library
rocprofiler::samples-build-flags)
PRIVATE rocprofiler-sdk::rocprofiler-sdk amd_comgr
rocprofiler::samples-common-library rocprofiler::samples-build-flags)
rocprofiler_samples_get_preload_env(PRELOAD_ENV advanced-thread-trace)
@@ -103,8 +103,8 @@ add_executable(code-object-isa-decode)
target_sources(code-object-isa-decode PRIVATE main.cpp client.cpp)
target_link_libraries(
code-object-isa-decode
PRIVATE rocprofiler::samples-common-library rocprofiler::rocprofiler amd_comgr
rocprofiler::samples-build-flags)
PRIVATE rocprofiler::samples-common-library rocprofiler-sdk::rocprofiler-sdk
amd_comgr rocprofiler::samples-build-flags)
rocprofiler_samples_get_preload_env(PRELOAD_ENV code-object-isa-decode)
@@ -71,8 +71,18 @@
ar(make_nvp(NAME, _val)); \
}
namespace cereal
{
#if !defined(ROCPROFILER_SDK_CEREAL_NAMESPACE_BEGIN)
# define ROCPROFILER_SDK_CEREAL_NAMESPACE_BEGIN \
namespace cereal \
{
#endif
#if !defined(ROCPROFILER_SDK_CEREAL_NAMESPACE_END)
# define ROCPROFILER_SDK_CEREAL_NAMESPACE_END } // namespace cereal
#endif
ROCPROFILER_SDK_CEREAL_NAMESPACE_BEGIN
template <typename ArchiveT>
void
save(ArchiveT& ar, rocprofiler_context_id_t data)
@@ -781,7 +791,8 @@ save(ArchiveT& ar, const rocprofiler::sdk::utility::name_info_impl<EnumT, ValueT
_ops.emplace_back(itr);
ar(cereal::make_nvp("operations", _ops));
}
} // namespace cereal
ROCPROFILER_SDK_CEREAL_NAMESPACE_END
#undef ROCP_SDK_SAVE_DATA_FIELD
#undef ROCP_SDK_SAVE_DATA_VALUE
@@ -44,7 +44,7 @@ ROCPROFILER_EXTERN_C_INIT
* to the @ref rocprofiler_client_finalize_t function to force finalization (i.e. deactivate all of
* it's contexts) for the client.
*/
typedef struct
typedef struct rocprofiler_client_id_t
{
const char* name; ///< clients should set this value for debugging
const uint32_t handle; ///< internal handle
@@ -92,7 +92,7 @@ typedef void (*rocprofiler_tool_finalize_t)(void* tool_data);
::rocprofiler_tool_configure_result_t struct
* and it should be set to `sizeof(rocprofiler_tool_configure_result_t)`
*/
typedef struct
typedef struct rocprofiler_tool_configure_result_t
{
size_t size; ///< size of this struct (in case of future extensions)
rocprofiler_tool_initialize_t initialize; ///< context creation
@@ -450,13 +450,13 @@ copy_table(Tp* _orig, uint64_t _tbl_instance, std::integral_constant<size_t, OpI
if(!_copy_func)
{
ROCP_INFO << "copying table entry for " << _info.name;
ROCP_TRACE << "copying table entry for " << _info.name;
_copy_func = _orig_func;
}
else
{
ROCP_INFO << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
ROCP_TRACE << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
}
}
}
@@ -479,7 +479,7 @@ update_table(Tp* _orig, std::integral_constant<size_t, OpIdx>)
_info.callback_domain_idx, _info.buffered_domain_idx, _info.operation_idx))
return;
ROCP_INFO << "updating table entry for " << _info.name;
ROCP_TRACE << "updating table entry for " << _info.name;
// 1. get the sub-table containing the function pointer in original table
// 2. get reference to function pointer in sub-table in original table
@@ -749,13 +749,13 @@ async_copy_save(hsa_amd_ext_table_t* _orig, uint64_t _tbl_instance)
if(!_copy_func)
{
ROCP_INFO << "copying table entry for " << _meta.name;
ROCP_TRACE << "copying table entry for " << _meta.name;
_copy_func = _orig_func;
}
else
{
ROCP_INFO << "skipping copying table entry for " << _meta.name << " from table instance "
<< _tbl_instance;
ROCP_TRACE << "skipping copying table entry for " << _meta.name << " from table instance "
<< _tbl_instance;
}
}
@@ -565,13 +565,13 @@ copy_table(Tp* _orig, uint64_t _tbl_instance, std::integral_constant<size_t, OpI
if(!_copy_func)
{
ROCP_INFO << "copying table entry for " << _info.name;
ROCP_TRACE << "copying table entry for " << _info.name;
_copy_func = _orig_func;
}
else
{
ROCP_INFO << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
ROCP_TRACE << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
}
}
}
@@ -599,7 +599,7 @@ update_table(const context::context_array_t& _contexts,
_info.operation_idx))
return;
ROCP_INFO << "updating table entry for " << _info.name;
ROCP_TRACE << "updating table entry for " << _info.name;
// 1. get the sub-table containing the function pointer in original table
// 2. get reference to function pointer in sub-table in original table
@@ -140,13 +140,13 @@ copy_table(hsa_pc_sampling_ext_table_t* _orig, uint64_t _tbl_instance)
if(!_copy_func)
{
ROCP_INFO << "copying table entry for " << _info.name;
ROCP_TRACE << "copying table entry for " << _info.name;
_copy_func = _orig_func;
}
else
{
ROCP_INFO << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
ROCP_TRACE << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
}
}
}
@@ -316,13 +316,13 @@ copy_table(hsa_amd_tool_table_t* _orig, uint64_t _tbl_instance)
if(!_copy_func)
{
ROCP_INFO << "copying table entry for " << _info.name;
ROCP_TRACE << "copying table entry for " << _info.name;
_copy_func = _orig_func;
}
else
{
ROCP_INFO << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
ROCP_TRACE << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
}
}
}
@@ -580,7 +580,7 @@ update_table(const context_array_t& ctxs, hsa_amd_tool_table_t* _orig)
if(!should_wrap_functor(ctxs, OpIdx)) return;
ROCP_INFO << "updating table entry for " << _info.name;
ROCP_TRACE << "updating table entry for " << _info.name;
auto _meta = hsa_api_meta<TableIdx, OpIdx>{};
auto& _table = _meta.get_table(_orig);
@@ -393,13 +393,13 @@ copy_table(Tp* _orig, uint64_t _tbl_instance, std::integral_constant<size_t, OpI
if(!_copy_func)
{
ROCP_INFO << "copying table entry for " << _info.name;
ROCP_TRACE << "copying table entry for " << _info.name;
_copy_func = _orig_func;
}
else
{
ROCP_INFO << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
ROCP_TRACE << "skipping copying table entry for " << _info.name
<< " from table instance " << _tbl_instance;
}
}
}
@@ -423,7 +423,7 @@ update_table(Tp* _orig, std::integral_constant<size_t, OpIdx>)
_info.callback_domain_idx, _info.buffered_domain_idx, _info.operation_idx))
return;
ROCP_INFO << "updating table entry for " << _info.name;
ROCP_TRACE << "updating table entry for " << _info.name;
// 1. get the sub-table containing the function pointer in original table
// 2. get reference to function pointer in sub-table in original table
@@ -68,7 +68,7 @@ find_package(
target_link_libraries(multiqueue_testapp PRIVATE amd_comgr)
find_package(rocprofiler-sdk REQUIRED)
target_link_libraries(multiqueue_testapp PRIVATE rocprofiler::rocprofiler
target_link_libraries(multiqueue_testapp PRIVATE rocprofiler-sdk::rocprofiler-sdk
rocprofiler::tests-common-library)
find_package(
@@ -115,8 +115,8 @@ add_executable(thread-trace-api-single-test)
target_sources(
thread-trace-api-single-test PRIVATE main.cpp trace_callbacks.cpp single_dispatch.cpp
kernel_branch.cpp kernel_lds.cpp)
target_link_libraries(thread-trace-api-single-test PRIVATE rocprofiler::rocprofiler
amd_comgr dw)
target_link_libraries(thread-trace-api-single-test
PRIVATE rocprofiler-sdk::rocprofiler-sdk amd_comgr dw)
if(ROCPROFILER_MEMCHECK_PRELOAD_ENV)
set(PRELOAD_ENV
@@ -138,7 +138,7 @@ add_executable(thread-trace-api-multi-test)
target_sources(
thread-trace-api-multi-test PRIVATE main.cpp trace_callbacks.cpp multi_dispatch.cpp
kernel_branch.cpp kernel_lds.cpp)
target_link_libraries(thread-trace-api-multi-test PRIVATE rocprofiler::rocprofiler
target_link_libraries(thread-trace-api-multi-test PRIVATE rocprofiler-sdk::rocprofiler-sdk
amd_comgr dw)
if(ROCPROFILER_MEMCHECK_PRELOAD_ENV)
@@ -15,7 +15,7 @@ add_library(rocprofiler-sdk-json-tool SHARED)
target_sources(rocprofiler-sdk-json-tool PRIVATE json-tool.cpp)
target_link_libraries(
rocprofiler-sdk-json-tool
PRIVATE rocprofiler::rocprofiler rocprofiler::rocprofiler-cereal
PRIVATE rocprofiler-sdk::rocprofiler-sdk rocprofiler::rocprofiler-cereal
rocprofiler::tests-build-flags rocprofiler::tests-common-library
rocprofiler::tests-perfetto)
set_target_properties(
@@ -29,7 +29,7 @@ set_target_properties(
# tool library which just checks that tools can be compiled with C language
add_library(rocprofiler-sdk-c-tool SHARED)
target_sources(rocprofiler-sdk-c-tool PRIVATE c-tool.c)
target_link_libraries(rocprofiler-sdk-c-tool PRIVATE rocprofiler::rocprofiler
target_link_libraries(rocprofiler-sdk-c-tool PRIVATE rocprofiler-sdk::rocprofiler-sdk
rocprofiler::tests-build-flags)
set_target_properties(
rocprofiler-sdk-c-tool