Rename Omnitrace to ROCm Systems Profiler (#4)
The Omnitrace program is being renamed.
Full name: "ROCm Systems Profiler"
Package name: "rocprofiler-systems"
Binary / Library names: "rocprof-sys-*"
---------
Co-authored-by: Xuan Chen <xuchen@amd.com>
Signed-off-by: David Galiffi <David.Galiffi@amd.com>
[ROCm/rocprofiler-systems commit: d07bf508a9]
このコミットが含まれているのは:
@@ -1,10 +1,10 @@
|
||||
# ----------------------------------------------------------------------------- #
|
||||
#
|
||||
# omnitrace: contains all instrumentation functionality
|
||||
# rocprofiler-systems: contains all instrumentation functionality
|
||||
#
|
||||
# omnitrace-dl: contains minimal symbols and dlopen's omnitrace
|
||||
# rocprofiler-systems-dl: contains minimal symbols and dlopen's rocprofiler-systems
|
||||
#
|
||||
# omnitrace-user: contains symbols for user API
|
||||
# rocprofiler-systems-user: contains symbols for user API
|
||||
#
|
||||
# ----------------------------------------------------------------------------- #
|
||||
|
||||
@@ -12,56 +12,58 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
|
||||
cmake_policy(SET CMP0115 NEW)
|
||||
endif()
|
||||
|
||||
if(OMNITRACE_USE_ROCPROFILER
|
||||
if(ROCPROFSYS_USE_ROCPROFILER
|
||||
AND rocprofiler_LIBRARY_DIR
|
||||
AND ROCmVersion_TRIPLE_VERSION VERSION_LESS 5.2.0
|
||||
AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH)
|
||||
set(OMNITRACE_LIB_INSTALL_RPATH
|
||||
"\$ORIGIN:\$ORIGIN/omnitrace:${rocprofiler_LIBRARY_DIR}")
|
||||
set(ROCPROFSYS_LIB_INSTALL_RPATH
|
||||
"\$ORIGIN:\$ORIGIN/${PROJECT_NAME}:${rocprofiler_LIBRARY_DIR}")
|
||||
else()
|
||||
set(OMNITRACE_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/omnitrace")
|
||||
set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace interface library
|
||||
# rocprofiler-systems interface library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(omnitrace-interface-library INTERFACE)
|
||||
add_library(omnitrace::omnitrace-interface-library ALIAS omnitrace-interface-library)
|
||||
add_library(rocprofiler-systems-interface-library INTERFACE)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-interface-library ALIAS
|
||||
rocprofiler-systems-interface-library)
|
||||
|
||||
target_include_directories(
|
||||
omnitrace-interface-library INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/omnitrace)
|
||||
rocprofiler-systems-interface-library
|
||||
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys)
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-interface-library
|
||||
rocprofiler-systems-interface-library
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-headers>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-threading>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-common-library>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-options>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-definitions>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-perfetto>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-timemory>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-elfutils>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-bfd>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-mpi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-ptl>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-hip>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-roctracer>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rocprofiler>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rocm-smi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rccl>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${OMNITRACE_BUILD_LTO}>,omnitrace::omnitrace-lto,>>)
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-headers>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-threading>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-common-library>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-options>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-perfetto>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-timemory>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-elfutils>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-bfd>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-mpi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-ptl>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-hip>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-roctracer>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocprofiler>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocm-smi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rccl>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace internal libraries
|
||||
# rocprofiler-systems internal libraries
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
@@ -71,11 +73,11 @@ add_subdirectory(binary)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace exported libraries
|
||||
# rocprofiler-systems exported libraries
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_subdirectory(omnitrace)
|
||||
add_subdirectory(omnitrace-dl)
|
||||
add_subdirectory(omnitrace-rt)
|
||||
add_subdirectory(omnitrace-user)
|
||||
add_subdirectory(rocprof-sys)
|
||||
add_subdirectory(rocprof-sys-dl)
|
||||
add_subdirectory(rocprof-sys-rt)
|
||||
add_subdirectory(rocprof-sys-user)
|
||||
|
||||
@@ -16,13 +16,17 @@ set(binary_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/scope_filter.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/symbol.hpp)
|
||||
|
||||
add_library(omnitrace-binary-library STATIC)
|
||||
add_library(omnitrace::omnitrace-binary ALIAS omnitrace-binary-library)
|
||||
add_library(rocprofiler-systems-binary-library STATIC)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-binary ALIAS
|
||||
rocprofiler-systems-binary-library)
|
||||
|
||||
target_sources(omnitrace-binary-library PRIVATE ${binary_sources} ${binary_headers})
|
||||
target_sources(rocprofiler-systems-binary-library PRIVATE ${binary_sources}
|
||||
${binary_headers})
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-binary-library PRIVATE omnitrace::omnitrace-interface-library
|
||||
omnitrace::omnitrace-core)
|
||||
rocprofiler-systems-binary-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library
|
||||
rocprofiler-systems::rocprofiler-systems-core)
|
||||
|
||||
set_target_properties(omnitrace-binary-library PROPERTIES OUTPUT_NAME omnitrace-binary)
|
||||
set_target_properties(rocprofiler-systems-binary-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-binary)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -72,4 +72,4 @@ address_multirange::operator+=(address_range _v)
|
||||
return *this;
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -39,7 +39,7 @@ struct address_multirange
|
||||
struct coarse
|
||||
{};
|
||||
|
||||
OMNITRACE_DEFAULT_OBJECT(address_multirange)
|
||||
ROCPROFSYS_DEFAULT_OBJECT(address_multirange)
|
||||
|
||||
address_multirange& operator+=(std::pair<coarse, uintptr_t>&&);
|
||||
address_multirange& operator+=(std::pair<coarse, address_range>&& _v);
|
||||
@@ -61,7 +61,7 @@ private:
|
||||
};
|
||||
|
||||
template <typename Tp>
|
||||
OMNITRACE_INLINE bool
|
||||
ROCPROFSYS_INLINE bool
|
||||
address_multirange::contains(Tp&& _v) const
|
||||
{
|
||||
using type = concepts::unqualified_type_t<Tp>;
|
||||
@@ -74,4 +74,4 @@ address_multirange::contains(Tp&& _v) const
|
||||
[_v](auto&& itr) { return itr.contains(_v); });
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,7 +26,7 @@
|
||||
# error "BFD support not enabled"
|
||||
#endif
|
||||
|
||||
#define PACKAGE "omnitrace"
|
||||
#define PACKAGE "rocprofiler-systems"
|
||||
|
||||
#include <bfd.h>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -75,7 +75,8 @@ parse_line_info(const std::string& _name, bool _process_dwarf, bool _process_bfd
|
||||
auto& _bfd = _info.bfd;
|
||||
_bfd = std::make_shared<bfd_file>(_name);
|
||||
|
||||
OMNITRACE_BASIC_VERBOSE(0, "[binary] Reading line info for '%s'...\n", _name.c_str());
|
||||
ROCPROFSYS_BASIC_VERBOSE(0, "[binary] Reading line info for '%s'...\n",
|
||||
_name.c_str());
|
||||
|
||||
if(_bfd && _bfd->is_good())
|
||||
{
|
||||
@@ -124,8 +125,8 @@ parse_line_info(const std::string& _name, bool _process_dwarf, bool _process_bfd
|
||||
_info.sort();
|
||||
}
|
||||
|
||||
OMNITRACE_BASIC_VERBOSE(1, "[binary] Reading line info for '%s'... %zu entries\n",
|
||||
_bfd->name.c_str(), _info.symbols.size());
|
||||
ROCPROFSYS_BASIC_VERBOSE(1, "[binary] Reading line info for '%s'... %zu entries\n",
|
||||
_bfd->name.c_str(), _info.symbols.size());
|
||||
|
||||
return _info;
|
||||
}
|
||||
@@ -151,7 +152,7 @@ get_binary_info(const std::vector<std::string>& _files,
|
||||
};
|
||||
|
||||
// filter function used by procfs::get_contiguous_maps
|
||||
// ensures that we do not process omnitrace/gotcha/libunwind libraries
|
||||
// ensures that we do not process rocprof-sys/gotcha/libunwind libraries
|
||||
// and do not process the libraries outside of the binary scope
|
||||
auto _filter = [&_satisfies_binary_filter](const procfs::maps& _v) {
|
||||
if(_v.pathname.empty()) return false;
|
||||
@@ -237,10 +238,10 @@ lookup_ipaddr_entry(uintptr_t _addr, unw_context_t* _context_p,
|
||||
}
|
||||
};
|
||||
|
||||
for(const auto& itr : binary::get_link_map("libomnitrace.so", "", ""))
|
||||
for(const auto& itr : binary::get_link_map("librocprof-sys.so", "", ""))
|
||||
_insert_exclude_range(itr.real());
|
||||
|
||||
for(const auto& itr : binary::get_link_map("libomnitrace-dl.so", "", ""))
|
||||
for(const auto& itr : binary::get_link_map("librocprof-sys-dl.so", "", ""))
|
||||
_insert_exclude_range(itr.real());
|
||||
|
||||
return _exclude_range_v;
|
||||
@@ -305,4 +306,4 @@ lookup_ipaddr_entry<true>(uintptr_t, unw_context_t*, tim::unwind::cache*);
|
||||
template std::optional<tim::unwind::processed_entry>
|
||||
lookup_ipaddr_entry<false>(uintptr_t, unw_context_t*, tim::unwind::cache*);
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <tuple>
|
||||
#include <variant>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -62,4 +62,4 @@ template <bool ExcludeInternal>
|
||||
std::optional<tim::unwind::processed_entry>
|
||||
lookup_ipaddr_entry(uintptr_t, unw_context_t* = nullptr, tim::unwind::cache* = nullptr);
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -84,4 +84,4 @@ binary_info::filename() const
|
||||
return (bfd) ? std::string{ bfd->name } : std::string{};
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <dwarf.h>
|
||||
#include <elfutils/libdw.h>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -206,20 +206,20 @@ template <typename ArchiveT>
|
||||
void
|
||||
dwarf_entry::serialize(ArchiveT& ar, const unsigned int)
|
||||
{
|
||||
#define OMNITRACE_SERIALIZE_MEMBER(MEMBER) ar(::tim::cereal::make_nvp(#MEMBER, MEMBER));
|
||||
#define ROCPROFSYS_SERIALIZE_MEMBER(MEMBER) ar(::tim::cereal::make_nvp(#MEMBER, MEMBER));
|
||||
|
||||
OMNITRACE_SERIALIZE_MEMBER(file)
|
||||
OMNITRACE_SERIALIZE_MEMBER(line)
|
||||
OMNITRACE_SERIALIZE_MEMBER(col)
|
||||
OMNITRACE_SERIALIZE_MEMBER(address)
|
||||
OMNITRACE_SERIALIZE_MEMBER(discriminator)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(begin_statement)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(end_sequence)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(line_block)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(prologue_end)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(epilogue_begin)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(vliw_op_index)
|
||||
// OMNITRACE_SERIALIZE_MEMBER(isa)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(file)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(line)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(col)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(address)
|
||||
ROCPROFSYS_SERIALIZE_MEMBER(discriminator)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(begin_statement)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(end_sequence)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(line_block)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(prologue_end)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(epilogue_begin)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(vliw_op_index)
|
||||
// ROCPROFSYS_SERIALIZE_MEMBER(isa)
|
||||
}
|
||||
|
||||
template void
|
||||
@@ -234,4 +234,4 @@ template void
|
||||
dwarf_entry::serialize<cereal::PrettyJSONOutputArchive>(cereal::PrettyJSONOutputArchive&,
|
||||
const unsigned int);
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "core/binary/address_range.hpp"
|
||||
#include "core/binary/fwd.hpp"
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -35,7 +35,7 @@ struct dwarf_entry
|
||||
using dwarf_tuple_t = std::tuple<std::deque<dwarf_entry>, std::vector<address_range>,
|
||||
std::vector<uintptr_t>>;
|
||||
|
||||
OMNITRACE_DEFAULT_OBJECT(dwarf_entry)
|
||||
ROCPROFSYS_DEFAULT_OBJECT(dwarf_entry)
|
||||
|
||||
bool begin_statement = false;
|
||||
bool end_sequence = false;
|
||||
@@ -63,4 +63,4 @@ struct dwarf_entry
|
||||
void serialize(ArchiveT&, const unsigned int);
|
||||
};
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -138,14 +138,14 @@ get_link_map(const char* _lib, const std::string& _exclude_linked_by,
|
||||
auto _name = (!_lib) ? config::get_exe_realpath() : std::string{ _lib };
|
||||
for(const auto& itr : _fini_chain)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(2, "[linkmap][%s]: %s\n", filepath::basename(_name),
|
||||
itr.real().c_str());
|
||||
ROCPROFSYS_BASIC_VERBOSE(2, "[linkmap][%s]: %s\n", filepath::basename(_name),
|
||||
itr.real().c_str());
|
||||
}
|
||||
|
||||
for(const auto& itr : _excl_chain)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(3, "[linkmap][%s]: %s\n", _exclude_linked_by.c_str(),
|
||||
link_file{ itr }.real().c_str());
|
||||
ROCPROFSYS_BASIC_VERBOSE(3, "[linkmap][%s]: %s\n", _exclude_linked_by.c_str(),
|
||||
link_file{ itr }.real().c_str());
|
||||
}
|
||||
|
||||
return _fini_chain;
|
||||
@@ -178,4 +178,4 @@ link_file::real() const
|
||||
return filepath::realpath(name, nullptr, false);
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -54,11 +54,11 @@ std::optional<std::string>
|
||||
get_linked_path(const char*, open_modes_vec_t&& = {});
|
||||
|
||||
// default parameters: get the linked binaries for the exe but exclude the linked binaries
|
||||
// from libomnitrace
|
||||
// from librocprof-sys
|
||||
std::set<link_file>
|
||||
get_link_map(const char* _lib = nullptr,
|
||||
const std::string& _exclude_linked_by = "libomnitrace.so",
|
||||
const std::string& _exclude_re = "libomnitrace-([a-zA-Z]+)\\.so",
|
||||
const std::string& _exclude_linked_by = "librocprof-sys.so",
|
||||
const std::string& _exclude_re = "librocprof-sys-([a-zA-Z]+)\\.so",
|
||||
open_modes_vec_t&& _open_modes = {});
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <regex>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -43,4 +43,4 @@ scope_filter::operator()(std::string_view _value) const
|
||||
throw exception<std::runtime_error>{ "invalid scope filter mode" };
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -55,7 +55,7 @@ struct scope_filter
|
||||
|
||||
template <typename ContainerT>
|
||||
static bool satisfies_filter(const ContainerT&, filter_scope,
|
||||
std::string_view) OMNITRACE_PURE;
|
||||
std::string_view) ROCPROFSYS_PURE;
|
||||
};
|
||||
|
||||
template <typename ContainerT>
|
||||
@@ -72,4 +72,4 @@ scope_filter::satisfies_filter(const ContainerT& _filters, filter_scope _scope,
|
||||
return true;
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,7 +27,7 @@
|
||||
# error "BFD support not enabled"
|
||||
#endif
|
||||
|
||||
#define PACKAGE "omnitrace"
|
||||
#define PACKAGE "rocprofiler-systems"
|
||||
#define L_LNNO_SIZE 4
|
||||
|
||||
#include <bfd.h>
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
#include <timemory/mpl/concepts.hpp>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -404,4 +404,4 @@ template std::vector<dwarf_entry>
|
||||
symbol::get_debug_line_info<std::vector<dwarf_entry>>(
|
||||
const std::vector<scope_filter>& _filters) const;
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -95,4 +95,4 @@ struct symbol : private tim::unwind::bfd_file::symbol
|
||||
std::vector<dwarf_entry> dwarf_info = {};
|
||||
};
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace common headers
|
||||
# rocprofiler-systems common headers
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(omnitrace-common-library INTERFACE)
|
||||
add_library(omnitrace::common-library ALIAS omnitrace-common-library)
|
||||
add_library(omnitrace::omnitrace-common-library ALIAS omnitrace-common-library)
|
||||
add_library(rocprofiler-systems-common-library INTERFACE)
|
||||
add_library(rocprofiler-systems::common-library ALIAS rocprofiler-systems-common-library)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-common-library ALIAS
|
||||
rocprofiler-systems-common-library)
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.h @ONLY)
|
||||
|
||||
target_sources(
|
||||
omnitrace-common-library
|
||||
rocprofiler-systems-common-library
|
||||
INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/defines.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/delimit.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/environment.hpp
|
||||
@@ -24,11 +25,11 @@ get_filename_component(COMMON_SOURCE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" D
|
||||
get_filename_component(COMMON_BINARY_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" DIRECTORY)
|
||||
|
||||
target_include_directories(
|
||||
omnitrace-common-library
|
||||
rocprofiler-systems-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:${COMMON_SOURCE_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${COMMON_BINARY_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/timemory/source>
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/external/timemory/source>)
|
||||
|
||||
target_compile_definitions(omnitrace-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:OMNITRACE_INTERNAL_BUILD=1>)
|
||||
target_compile_definitions(rocprofiler-systems-common-library
|
||||
INTERFACE $<BUILD_INTERFACE:ROCPROFSYS_INTERNAL_BUILD=1>)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,117 +23,118 @@
|
||||
#pragma once
|
||||
|
||||
// clang-format off
|
||||
#define OMNITRACE_VERSION_STRING "@FULL_VERSION_STRING@"
|
||||
#define OMNITRACE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define OMNITRACE_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define OMNITRACE_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define OMNITRACE_GIT_DESCRIBE "@OMNITRACE_GIT_DESCRIBE@"
|
||||
#define OMNITRACE_GIT_REVISION "@OMNITRACE_GIT_REVISION@"
|
||||
#define ROCPROFSYS_VERSION_STRING "@FULL_VERSION_STRING@"
|
||||
#define ROCPROFSYS_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define ROCPROFSYS_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define ROCPROFSYS_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define ROCPROFSYS_GIT_DESCRIBE "@ROCPROFSYS_GIT_DESCRIBE@"
|
||||
#define ROCPROFSYS_GIT_REVISION "@ROCPROFSYS_GIT_REVISION@"
|
||||
|
||||
// system info during compilation
|
||||
#define OMNITRACE_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
|
||||
#define OMNITRACE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
#define OMNITRACE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
|
||||
#define OMNITRACE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
|
||||
#define ROCPROFSYS_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
|
||||
#define ROCPROFSYS_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
#define ROCPROFSYS_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
|
||||
#define ROCPROFSYS_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
|
||||
|
||||
// compiler information
|
||||
#define OMNITRACE_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
|
||||
#define OMNITRACE_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
#define OMNITRACE_COMPILER_STRING OMNITRACE_COMPILER_ID " v" OMNITRACE_COMPILER_VERSION
|
||||
#define ROCPROFSYS_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
|
||||
#define ROCPROFSYS_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
#define ROCPROFSYS_COMPILER_STRING ROCPROFSYS_COMPILER_ID " v" ROCPROFSYS_COMPILER_VERSION
|
||||
|
||||
#define OMNITRACE_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@"
|
||||
#define OMNITRACE_HIP_VERSION_STRING "@OMNITRACE_HIP_VERSION@"
|
||||
#define OMNITRACE_HIP_VERSION_MAJOR @OMNITRACE_HIP_VERSION_MAJOR@
|
||||
#define OMNITRACE_HIP_VERSION_MINOR @OMNITRACE_HIP_VERSION_MINOR@
|
||||
#define OMNITRACE_HIP_VERSION_PATCH @OMNITRACE_HIP_VERSION_PATCH@
|
||||
#define ROCPROFSYS_DEFAULT_ROCM_PATH "@ROCmVersion_DIR@"
|
||||
#define ROCPROFSYS_HIP_VERSION_STRING "@ROCPROFSYS_HIP_VERSION@"
|
||||
#define ROCPROFSYS_HIP_VERSION_MAJOR @ROCPROFSYS_HIP_VERSION_MAJOR@
|
||||
#define ROCPROFSYS_HIP_VERSION_MINOR @ROCPROFSYS_HIP_VERSION_MINOR@
|
||||
#define ROCPROFSYS_HIP_VERSION_PATCH @ROCPROFSYS_HIP_VERSION_PATCH@
|
||||
|
||||
// these can be set via defining the variable in CMake, e.g.:
|
||||
// cmake -D OMNITRACE_CACHELINE_SIZE=N /path/to/source
|
||||
// cmake -D ROCPROFSYS_CACHELINE_SIZE=N /path/to/source
|
||||
// if not defined when configuring cmake, these values fall back to
|
||||
// default values set in core/containers/aligned_static_vector.hpp.
|
||||
// the OMNITRACE_CACHELINE_SIZE_MIN is used to ensure portability
|
||||
#cmakedefine OMNITRACE_CACHELINE_SIZE @OMNITRACE_CACHELINE_SIZE@
|
||||
#cmakedefine OMNITRACE_CACHELINE_SIZE_MIN @OMNITRACE_CACHELINE_SIZE_MIN@
|
||||
// the ROCPROFSYS_CACHELINE_SIZE_MIN is used to ensure portability
|
||||
#cmakedefine ROCPROFSYS_CACHELINE_SIZE @ROCPROFSYS_CACHELINE_SIZE@
|
||||
#cmakedefine ROCPROFSYS_CACHELINE_SIZE_MIN @ROCPROFSYS_CACHELINE_SIZE_MIN@
|
||||
|
||||
// misc definitions which can be configured by cmake to override the defaults
|
||||
#cmakedefine OMNITRACE_ROCM_MAX_COUNTERS @OMNITRACE_ROCM_MAX_COUNTERS@
|
||||
#cmakedefine ROCPROFSYS_ROCM_MAX_COUNTERS @ROCPROFSYS_ROCM_MAX_COUNTERS@
|
||||
// clang-format on
|
||||
|
||||
#define OMNITRACE_VERSION \
|
||||
((10000 * OMNITRACE_VERSION_MAJOR) + (100 * OMNITRACE_VERSION_MINOR) + \
|
||||
OMNITRACE_VERSION_PATCH)
|
||||
#define ROCPROFSYS_VERSION \
|
||||
((10000 * ROCPROFSYS_VERSION_MAJOR) + (100 * ROCPROFSYS_VERSION_MINOR) + \
|
||||
ROCPROFSYS_VERSION_PATCH)
|
||||
|
||||
#define OMNITRACE_HIP_VERSION \
|
||||
((10000 * OMNITRACE_HIP_VERSION_MAJOR) + (100 * OMNITRACE_HIP_VERSION_MINOR) + \
|
||||
OMNITRACE_HIP_VERSION_PATCH)
|
||||
#define ROCPROFSYS_HIP_VERSION \
|
||||
((10000 * ROCPROFSYS_HIP_VERSION_MAJOR) + (100 * ROCPROFSYS_HIP_VERSION_MINOR) + \
|
||||
ROCPROFSYS_HIP_VERSION_PATCH)
|
||||
|
||||
#if OMNITRACE_HIP_VERSION_MAJOR > 0
|
||||
# define OMNITRACE_HIP_VERSION_COMPAT_STRING \
|
||||
"v@OMNITRACE_HIP_VERSION_MAJOR@.@OMNITRACE_HIP_VERSION_MINOR@.x"
|
||||
#if ROCPROFSYS_HIP_VERSION_MAJOR > 0
|
||||
# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING \
|
||||
"v@ROCPROFSYS_HIP_VERSION_MAJOR@.@ROCPROFSYS_HIP_VERSION_MINOR@.x"
|
||||
#else
|
||||
# define OMNITRACE_HIP_VERSION_COMPAT_STRING ""
|
||||
# define ROCPROFSYS_HIP_VERSION_COMPAT_STRING ""
|
||||
#endif
|
||||
|
||||
// this should be passed to argparse::argument_parser::enable_version
|
||||
// Example:
|
||||
// parser.enable_version(<name>, OMNITRACE_ARGPARSE_VERSION_INFO);
|
||||
#if !defined(OMNITRACE_ARGPARSE_VERSION_INFO)
|
||||
# define OMNITRACE_ARGPARSE_VERSION_INFO \
|
||||
"v" OMNITRACE_VERSION_STRING, OMNITRACE_GIT_DESCRIBE, OMNITRACE_GIT_REVISION, \
|
||||
// parser.enable_version(<name>, ROCPROFSYS_ARGPARSE_VERSION_INFO);
|
||||
#if !defined(ROCPROFSYS_ARGPARSE_VERSION_INFO)
|
||||
# define ROCPROFSYS_ARGPARSE_VERSION_INFO \
|
||||
"v" ROCPROFSYS_VERSION_STRING, ROCPROFSYS_GIT_DESCRIBE, ROCPROFSYS_GIT_REVISION, \
|
||||
{ \
|
||||
{ "", OMNITRACE_LIBRARY_ARCH }, { "compiler", OMNITRACE_COMPILER_STRING }, \
|
||||
{ "", ROCPROFSYS_LIBRARY_ARCH }, { "compiler", ROCPROFSYS_COMPILER_STRING }, \
|
||||
{ \
|
||||
"rocm", OMNITRACE_HIP_VERSION_COMPAT_STRING \
|
||||
"rocm", ROCPROFSYS_HIP_VERSION_COMPAT_STRING \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
// clang-format off
|
||||
#if !defined(OMNITRACE_MAX_THREADS)
|
||||
# define OMNITRACE_MAX_THREADS @OMNITRACE_MAX_THREADS@
|
||||
#if !defined(ROCPROFSYS_MAX_THREADS)
|
||||
# define ROCPROFSYS_MAX_THREADS @ROCPROFSYS_MAX_THREADS@
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_MAX_UNWIND_DEPTH)
|
||||
# define OMNITRACE_MAX_UNWIND_DEPTH @OMNITRACE_MAX_UNWIND_DEPTH@
|
||||
#if !defined(ROCPROFSYS_MAX_UNWIND_DEPTH)
|
||||
# define ROCPROFSYS_MAX_UNWIND_DEPTH @ROCPROFSYS_MAX_UNWIND_DEPTH@
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
// in general, we want to make sure the cache line size is not less than
|
||||
// 64 bytes (most common cacheline size for x86-64 CPUs) so unless
|
||||
// OMNITRACE_CACHELINE_SIZE was explicitly set, we set the min to 64
|
||||
// and use the max value of OMNITRACE_CACHELINE_SIZE and
|
||||
// OMNITRACE_CACHELINE_SIZE_MIN to assure that false-sharing is well
|
||||
// ROCPROFSYS_CACHELINE_SIZE was explicitly set, we set the min to 64
|
||||
// and use the max value of ROCPROFSYS_CACHELINE_SIZE and
|
||||
// ROCPROFSYS_CACHELINE_SIZE_MIN to assure that false-sharing is well
|
||||
// guarded against
|
||||
#if !defined(OMNITRACE_CACHELINE_SIZE_MIN)
|
||||
# if defined(OMNITRACE_CACHELINE_SIZE)
|
||||
# define OMNITRACE_CACHELINE_SIZE_MIN OMNITRACE_CACHELINE_SIZE
|
||||
#if !defined(ROCPROFSYS_CACHELINE_SIZE_MIN)
|
||||
# if defined(ROCPROFSYS_CACHELINE_SIZE)
|
||||
# define ROCPROFSYS_CACHELINE_SIZE_MIN ROCPROFSYS_CACHELINE_SIZE
|
||||
# else
|
||||
# define OMNITRACE_CACHELINE_SIZE_MIN 64
|
||||
# define ROCPROFSYS_CACHELINE_SIZE_MIN 64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_ROCM_MAX_COUNTERS)
|
||||
# define OMNITRACE_ROCM_MAX_COUNTERS 25
|
||||
#if !defined(ROCPROFSYS_ROCM_MAX_COUNTERS)
|
||||
# define ROCPROFSYS_ROCM_MAX_COUNTERS 25
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
|
||||
#define OMNITRACE_VISIBILITY(MODE) OMNITRACE_ATTRIBUTE(visibility(MODE))
|
||||
#define OMNITRACE_PUBLIC_API OMNITRACE_VISIBILITY("default")
|
||||
#define OMNITRACE_HIDDEN_API OMNITRACE_VISIBILITY("hidden")
|
||||
#define OMNITRACE_INTERNAL_API OMNITRACE_VISIBILITY("internal")
|
||||
#define OMNITRACE_INLINE OMNITRACE_ATTRIBUTE(always_inline) inline
|
||||
#define OMNITRACE_NOINLINE OMNITRACE_ATTRIBUTE(noinline)
|
||||
#define OMNITRACE_HOT OMNITRACE_ATTRIBUTE(hot)
|
||||
#define OMNITRACE_COLD OMNITRACE_ATTRIBUTE(cold)
|
||||
#define OMNITRACE_CONST OMNITRACE_ATTRIBUTE(const)
|
||||
#define OMNITRACE_PURE OMNITRACE_ATTRIBUTE(pure)
|
||||
#define OMNITRACE_WEAK OMNITRACE_ATTRIBUTE(weak)
|
||||
#define OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__packed__)
|
||||
#define OMNITRACE_PACKED_ALIGN(VAL) OMNITRACE_PACKED OMNITRACE_ATTRIBUTE(__aligned__(VAL))
|
||||
#define OMNITRACE_LIKELY(...) __builtin_expect((__VA_ARGS__), 1)
|
||||
#define OMNITRACE_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0)
|
||||
#define ROCPROFSYS_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
|
||||
#define ROCPROFSYS_VISIBILITY(MODE) ROCPROFSYS_ATTRIBUTE(visibility(MODE))
|
||||
#define ROCPROFSYS_PUBLIC_API ROCPROFSYS_VISIBILITY("default")
|
||||
#define ROCPROFSYS_HIDDEN_API ROCPROFSYS_VISIBILITY("hidden")
|
||||
#define ROCPROFSYS_INTERNAL_API ROCPROFSYS_VISIBILITY("internal")
|
||||
#define ROCPROFSYS_INLINE ROCPROFSYS_ATTRIBUTE(always_inline) inline
|
||||
#define ROCPROFSYS_NOINLINE ROCPROFSYS_ATTRIBUTE(noinline)
|
||||
#define ROCPROFSYS_HOT ROCPROFSYS_ATTRIBUTE(hot)
|
||||
#define ROCPROFSYS_COLD ROCPROFSYS_ATTRIBUTE(cold)
|
||||
#define ROCPROFSYS_CONST ROCPROFSYS_ATTRIBUTE(const)
|
||||
#define ROCPROFSYS_PURE ROCPROFSYS_ATTRIBUTE(pure)
|
||||
#define ROCPROFSYS_WEAK ROCPROFSYS_ATTRIBUTE(weak)
|
||||
#define ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__packed__)
|
||||
#define ROCPROFSYS_PACKED_ALIGN(VAL) \
|
||||
ROCPROFSYS_PACKED ROCPROFSYS_ATTRIBUTE(__aligned__(VAL))
|
||||
#define ROCPROFSYS_LIKELY(...) __builtin_expect((__VA_ARGS__), 1)
|
||||
#define ROCPROFSYS_UNLIKELY(...) __builtin_expect((__VA_ARGS__), 0)
|
||||
|
||||
#if defined(OMNITRACE_CI) && OMNITRACE_CI > 0
|
||||
#if defined(ROCPROFSYS_CI) && ROCPROFSYS_CI > 0
|
||||
# if defined(NDEBUG)
|
||||
# undef NDEBUG
|
||||
# endif
|
||||
@@ -147,15 +148,15 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_STRINGIZE(X) OMNITRACE_STRINGIZE2(X)
|
||||
#define OMNITRACE_STRINGIZE2(X) #X
|
||||
#define OMNITRACE_VAR_NAME_COMBINE(X, Y) X##Y
|
||||
#define OMNITRACE_VARIABLE(X, Y) OMNITRACE_VAR_NAME_COMBINE(X, Y)
|
||||
#define OMNITRACE_LINESTR OMNITRACE_STRINGIZE(__LINE__)
|
||||
#define OMNITRACE_ESC(...) __VA_ARGS__
|
||||
#define ROCPROFSYS_STRINGIZE(X) ROCPROFSYS_STRINGIZE2(X)
|
||||
#define ROCPROFSYS_STRINGIZE2(X) #X
|
||||
#define ROCPROFSYS_VAR_NAME_COMBINE(X, Y) X##Y
|
||||
#define ROCPROFSYS_VARIABLE(X, Y) ROCPROFSYS_VAR_NAME_COMBINE(X, Y)
|
||||
#define ROCPROFSYS_LINESTR ROCPROFSYS_STRINGIZE(__LINE__)
|
||||
#define ROCPROFSYS_ESC(...) __VA_ARGS__
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# if !defined(OMNITRACE_FOLD_EXPRESSION)
|
||||
# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
# if !defined(ROCPROFSYS_FOLD_EXPRESSION)
|
||||
# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -120,4 +120,4 @@ delimit(const std::string& line, const char* delimiters)
|
||||
}
|
||||
} // namespace
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -34,47 +34,48 @@
|
||||
#include <type_traits>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_ENVIRON_LOG_NAME)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_ENVIRON_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
|
||||
#if !defined(ROCPROFSYS_ENVIRON_LOG_NAME)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_ENVIRON_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
|
||||
# else
|
||||
# define OMNITRACE_ENVIRON_LOG_NAME
|
||||
# define ROCPROFSYS_ENVIRON_LOG_NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_ENVIRON_LOG_START)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_ENVIRON_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_ENVIRON_LOG_START)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_ENVIRON_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_ENVIRON_LOG_START \
|
||||
# define ROCPROFSYS_ENVIRON_LOG_START \
|
||||
fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# else
|
||||
# define OMNITRACE_ENVIRON_LOG_START
|
||||
# define ROCPROFSYS_ENVIRON_LOG_START
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_ENVIRON_LOG_END)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_ENVIRON_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_ENVIRON_LOG_END)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_ENVIRON_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_ENVIRON_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# define ROCPROFSYS_ENVIRON_LOG_END \
|
||||
fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# else
|
||||
# define OMNITRACE_ENVIRON_LOG_END
|
||||
# define ROCPROFSYS_ENVIRON_LOG_END
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_ENVIRON_LOG(CONDITION, ...) \
|
||||
#define ROCPROFSYS_ENVIRON_LOG(CONDITION, ...) \
|
||||
if(CONDITION) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
OMNITRACE_ENVIRON_LOG_START \
|
||||
fprintf(stderr, "[omnitrace]" OMNITRACE_ENVIRON_LOG_NAME "[%i] ", getpid()); \
|
||||
ROCPROFSYS_ENVIRON_LOG_START \
|
||||
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_ENVIRON_LOG_NAME "[%i] ", getpid()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
OMNITRACE_ENVIRON_LOG_END \
|
||||
ROCPROFSYS_ENVIRON_LOG_END \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -108,7 +109,7 @@ get_env_impl(std::string_view env_id, int _default)
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"[omnitrace][get_env] Exception thrown converting getenv(\"%s\") = "
|
||||
"[rocprof-sys][get_env] Exception thrown converting getenv(\"%s\") = "
|
||||
"%s to integer :: %s. Using default value of %i\n",
|
||||
env_id.data(), env_var, _e.what(), _default);
|
||||
}
|
||||
@@ -162,7 +163,7 @@ get_env(std::string_view env_id, Tp&& _default)
|
||||
}
|
||||
}
|
||||
|
||||
struct OMNITRACE_INTERNAL_API env_config
|
||||
struct ROCPROFSYS_INTERNAL_API env_config
|
||||
{
|
||||
std::string env_name = {};
|
||||
std::string env_value = {};
|
||||
@@ -171,10 +172,10 @@ struct OMNITRACE_INTERNAL_API env_config
|
||||
auto operator()(bool _verbose = false) const
|
||||
{
|
||||
if(env_name.empty()) return -1;
|
||||
OMNITRACE_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(),
|
||||
env_value.c_str(), override);
|
||||
ROCPROFSYS_ENVIRON_LOG(_verbose, "setenv(\"%s\", \"%s\", %i)\n", env_name.c_str(),
|
||||
env_value.c_str(), override);
|
||||
return setenv(env_name.c_str(), env_value.c_str(), override);
|
||||
}
|
||||
};
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,20 +31,20 @@
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_COMMON_LIBRARY_NAME "common"
|
||||
# error OMNITRACE_COMMON_LIBRARY_NAME must be defined
|
||||
#if !defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_COMMON_LIBRARY_NAME "common"
|
||||
# error ROCPROFSYS_COMMON_LIBRARY_NAME must be defined
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
#endif
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace
|
||||
{
|
||||
template <typename FuncT, typename... Args>
|
||||
inline auto
|
||||
invoke(const char* _name, FuncT&& _func, Args... _args) OMNITRACE_HIDDEN_API;
|
||||
invoke(const char* _name, FuncT&& _func, Args... _args) ROCPROFSYS_HIDDEN_API;
|
||||
|
||||
inline int32_t&
|
||||
get_guard()
|
||||
@@ -77,7 +77,7 @@ ignore(const char* _name, int _verbose, int _value, const char* _reason, Args...
|
||||
{
|
||||
fflush(stderr);
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li] %s(%s) was ignored :: %s\n",
|
||||
getpid(), get_thread_index(), _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str(), _reason);
|
||||
@@ -107,13 +107,13 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
|
||||
if(_verbose >= 3)
|
||||
{
|
||||
fflush(stderr);
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li][%i] %s(%s)\n",
|
||||
getpid(), get_thread_index(), _lk, _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str());
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
fflush(stderr);
|
||||
}
|
||||
return std::invoke(std::forward<FuncT>(_func), _args...);
|
||||
@@ -121,25 +121,25 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
|
||||
else if(_verbose >= 2)
|
||||
{
|
||||
fflush(stderr);
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li] %s(%s) was guarded :: value = %i\n",
|
||||
getpid(), get_thread_index(), _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str(), _lk);
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
else if(_verbose >= 0)
|
||||
{
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
fprintf(stderr,
|
||||
"[omnitrace][" OMNITRACE_COMMON_LIBRARY_NAME
|
||||
"[rocprof-sys][" ROCPROFSYS_COMMON_LIBRARY_NAME
|
||||
"][%i][%li] %s(%s) ignored :: null function pointer\n",
|
||||
getpid(), get_thread_index(), _name,
|
||||
join(QuoteStrings{}, ", ", _args...).c_str());
|
||||
OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
}
|
||||
|
||||
using return_type = decltype(std::invoke(std::forward<FuncT>(_func), _args...));
|
||||
@@ -147,4 +147,4 @@ invoke(const char* _name, int _verbose, bool& _toggle, FuncT&& _func, Args... _a
|
||||
}
|
||||
} // namespace
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,11 +31,11 @@
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(OMNITRACE_FOLD_EXPRESSION)
|
||||
# define OMNITRACE_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
#if !defined(ROCPROFSYS_FOLD_EXPRESSION)
|
||||
# define ROCPROFSYS_FOLD_EXPRESSION(...) ((__VA_ARGS__), ...)
|
||||
#endif
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -99,13 +99,13 @@ join(DelimT&& _delim, Args&&... _args)
|
||||
if constexpr(std::is_same<delim_type, char>::value)
|
||||
{
|
||||
const char _delim_c[2] = { _delim, '\0' };
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << _args);
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << _args);
|
||||
auto _ret = _ss.str();
|
||||
return (_ret.length() > 1) ? _ret.substr(1) : std::string{};
|
||||
}
|
||||
else
|
||||
{
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim << _args);
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << _args);
|
||||
auto _ret = _ss.str();
|
||||
auto&& _len = std::string{ _delim }.length();
|
||||
return (_ret.length() > _len) ? _ret.substr(_len) : std::string{};
|
||||
@@ -127,13 +127,13 @@ join(QuoteStrings&&, DelimT&& _delim, Args&&... _args)
|
||||
if constexpr(std::is_same<delim_type, char>::value)
|
||||
{
|
||||
const char _delim_c[2] = { _delim, '\0' };
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args));
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim_c << as_string(_args));
|
||||
auto _ret = _ss.str();
|
||||
return (_ret.length() > 1) ? _ret.substr(1) : std::string{};
|
||||
}
|
||||
else
|
||||
{
|
||||
OMNITRACE_FOLD_EXPRESSION(_ss << _delim << as_string(_args));
|
||||
ROCPROFSYS_FOLD_EXPRESSION(_ss << _delim << as_string(_args));
|
||||
auto _ret = _ss.str();
|
||||
auto&& _len = std::string{ _delim }.length();
|
||||
return (_ret.length() > _len) ? _ret.substr(_len) : std::string{};
|
||||
@@ -177,4 +177,4 @@ join(QuoteStrings&&, std::tuple<DelimB, DelimT, DelimE>&& _delim, Args&&... _arg
|
||||
}
|
||||
} // namespace
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -38,46 +38,47 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_PATH_LOG_NAME)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_PATH_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
|
||||
#if !defined(ROCPROFSYS_PATH_LOG_NAME)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_PATH_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
|
||||
# else
|
||||
# define OMNITRACE_PATH_LOG_NAME
|
||||
# define ROCPROFSYS_PATH_LOG_NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_PATH_LOG_START)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_PATH_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_PATH_LOG_START)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_PATH_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_PATH_LOG_START fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# define ROCPROFSYS_PATH_LOG_START \
|
||||
fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# else
|
||||
# define OMNITRACE_PATH_LOG_START
|
||||
# define ROCPROFSYS_PATH_LOG_START
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_PATH_LOG_END)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_PATH_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_PATH_LOG_END)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_PATH_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# define ROCPROFSYS_PATH_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# else
|
||||
# define OMNITRACE_PATH_LOG_END
|
||||
# define ROCPROFSYS_PATH_LOG_END
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_PATH_LOG(CONDITION, ...) \
|
||||
#define ROCPROFSYS_PATH_LOG(CONDITION, ...) \
|
||||
if(CONDITION) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
OMNITRACE_PATH_LOG_START \
|
||||
fprintf(stderr, "[omnitrace]" OMNITRACE_PATH_LOG_NAME "[%i] ", getpid()); \
|
||||
ROCPROFSYS_PATH_LOG_START \
|
||||
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_PATH_LOG_NAME "[%i] ", getpid()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
OMNITRACE_PATH_LOG_END \
|
||||
ROCPROFSYS_PATH_LOG_END \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
@@ -85,45 +86,45 @@ namespace path
|
||||
{
|
||||
inline std::vector<std::string>
|
||||
get_link_map(const char*, std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) },
|
||||
bool _include_self = false) OMNITRACE_INTERNAL_API;
|
||||
bool _include_self = false) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline auto
|
||||
get_link_map(const char* _name, bool&& _include_self,
|
||||
std::vector<int>&& _open_modes = {
|
||||
(RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API;
|
||||
(RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
get_origin(const std::string&,
|
||||
std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) }) OMNITRACE_INTERNAL_API;
|
||||
std::vector<int>&& = { (RTLD_LAZY | RTLD_NOLOAD) }) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline bool
|
||||
exists(const std::string& _fname) OMNITRACE_INTERNAL_API;
|
||||
exists(const std::string& _fname) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
template <typename RetT = std::string>
|
||||
inline RetT
|
||||
get_default_lib_search_paths() OMNITRACE_INTERNAL_API;
|
||||
get_default_lib_search_paths() ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
find_path(const std::string& _path, int _verbose,
|
||||
const std::string& _search_paths = {}) OMNITRACE_INTERNAL_API;
|
||||
const std::string& _search_paths = {}) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
dirname(const std::string& _fname) OMNITRACE_INTERNAL_API;
|
||||
dirname(const std::string& _fname) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
realpath(const std::string& _relpath,
|
||||
std::string* _resolved = nullptr) OMNITRACE_INTERNAL_API;
|
||||
std::string* _resolved = nullptr) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline bool
|
||||
is_text_file(const std::string& filename) OMNITRACE_INTERNAL_API;
|
||||
is_text_file(const std::string& filename) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline bool
|
||||
is_link(const std::string& _path) OMNITRACE_INTERNAL_API;
|
||||
is_link(const std::string& _path) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
inline std::string
|
||||
readlink(const std::string& _path) OMNITRACE_INTERNAL_API;
|
||||
readlink(const std::string& _path) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
struct OMNITRACE_INTERNAL_API path_type
|
||||
struct ROCPROFSYS_INTERNAL_API path_type
|
||||
{
|
||||
enum path_type_e
|
||||
{
|
||||
@@ -181,8 +182,9 @@ template <typename RetT>
|
||||
RetT
|
||||
get_default_lib_search_paths()
|
||||
{
|
||||
auto _paths = join(":", get_env("OMNITRACE_PATH", ""), get_env("LD_LIBRARY_PATH", ""),
|
||||
get_env("LIBRARY_PATH", ""), get_env("PWD", ""), ".");
|
||||
auto _paths =
|
||||
join(":", get_env("ROCPROFSYS_PATH", ""), get_env("LD_LIBRARY_PATH", ""),
|
||||
get_env("LIBRARY_PATH", ""), get_env("PWD", ""), ".");
|
||||
if constexpr(std::is_same<RetT, std::string>::value)
|
||||
return _paths;
|
||||
else
|
||||
@@ -204,13 +206,13 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat
|
||||
for(const auto& itr : _paths)
|
||||
{
|
||||
auto _f = join('/', itr, _path);
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
if(exists(_f))
|
||||
{
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n",
|
||||
_path.c_str(), itr.c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl, "found '%s' in '%s' ...\n",
|
||||
_path.c_str(), itr.c_str());
|
||||
return _f;
|
||||
}
|
||||
}
|
||||
@@ -224,14 +226,14 @@ find_path(const std::string& _path, int _verbose, const std::string& _search_pat
|
||||
for(const auto* sitr : { "lib", "lib64", "../lib", "../lib64" })
|
||||
{
|
||||
auto _f = join('/', dirname(itr), sitr, _path);
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
common::join('/', itr, sitr).c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl + 1,
|
||||
"searching for '%s' in '%s' ...\n", _path.c_str(),
|
||||
common::join('/', itr, sitr).c_str());
|
||||
if(exists(_f))
|
||||
{
|
||||
OMNITRACE_PATH_LOG(_verbose >= _verbose_lvl,
|
||||
"found '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
ROCPROFSYS_PATH_LOG(_verbose >= _verbose_lvl,
|
||||
"found '%s' in '%s' ...\n", _path.c_str(),
|
||||
itr.c_str());
|
||||
return _f;
|
||||
}
|
||||
}
|
||||
@@ -317,7 +319,7 @@ is_text_file(const std::string& filename)
|
||||
std::ifstream _file{ filename, std::ios::in | std::ios::binary };
|
||||
if(!_file.is_open())
|
||||
{
|
||||
OMNITRACE_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str());
|
||||
ROCPROFSYS_PATH_LOG(0, "Error! '%s' could not be opened...\n", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -411,4 +413,4 @@ get_origin(const std::string& _filename, std::vector<int>&& _open_modes)
|
||||
}
|
||||
} // namespace path
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -41,54 +41,54 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_SETUP_LOG_NAME)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_NAME)
|
||||
# define OMNITRACE_SETUP_LOG_NAME "[" OMNITRACE_COMMON_LIBRARY_NAME "]"
|
||||
#if !defined(ROCPROFSYS_SETUP_LOG_NAME)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_NAME)
|
||||
# define ROCPROFSYS_SETUP_LOG_NAME "[" ROCPROFSYS_COMMON_LIBRARY_NAME "]"
|
||||
# else
|
||||
# define OMNITRACE_SETUP_LOG_NAME
|
||||
# define ROCPROFSYS_SETUP_LOG_NAME
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_SETUP_LOG_START)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_START)
|
||||
# define OMNITRACE_SETUP_LOG_START OMNITRACE_COMMON_LIBRARY_LOG_START
|
||||
#if !defined(ROCPROFSYS_SETUP_LOG_START)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_START)
|
||||
# define ROCPROFSYS_SETUP_LOG_START ROCPROFSYS_COMMON_LIBRARY_LOG_START
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_SETUP_LOG_START \
|
||||
# define ROCPROFSYS_SETUP_LOG_START \
|
||||
fprintf(stderr, "%s", ::tim::log::color::info());
|
||||
# else
|
||||
# define OMNITRACE_SETUP_LOG_START
|
||||
# define ROCPROFSYS_SETUP_LOG_START
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_SETUP_LOG_END)
|
||||
# if defined(OMNITRACE_COMMON_LIBRARY_LOG_END)
|
||||
# define OMNITRACE_SETUP_LOG_END OMNITRACE_COMMON_LIBRARY_LOG_END
|
||||
#if !defined(ROCPROFSYS_SETUP_LOG_END)
|
||||
# if defined(ROCPROFSYS_COMMON_LIBRARY_LOG_END)
|
||||
# define ROCPROFSYS_SETUP_LOG_END ROCPROFSYS_COMMON_LIBRARY_LOG_END
|
||||
# elif defined(TIMEMORY_LOG_COLORS_AVAILABLE)
|
||||
# define OMNITRACE_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# define ROCPROFSYS_SETUP_LOG_END fprintf(stderr, "%s", ::tim::log::color::end());
|
||||
# else
|
||||
# define OMNITRACE_SETUP_LOG_END
|
||||
# define ROCPROFSYS_SETUP_LOG_END
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define OMNITRACE_SETUP_LOG(CONDITION, ...) \
|
||||
#define ROCPROFSYS_SETUP_LOG(CONDITION, ...) \
|
||||
if(CONDITION) \
|
||||
{ \
|
||||
fflush(stderr); \
|
||||
OMNITRACE_SETUP_LOG_START \
|
||||
fprintf(stderr, "[omnitrace]" OMNITRACE_SETUP_LOG_NAME "[%i] ", getpid()); \
|
||||
ROCPROFSYS_SETUP_LOG_START \
|
||||
fprintf(stderr, "[rocprof-sys]" ROCPROFSYS_SETUP_LOG_NAME "[%i] ", getpid()); \
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
OMNITRACE_SETUP_LOG_END \
|
||||
ROCPROFSYS_SETUP_LOG_END \
|
||||
fflush(stderr); \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace common
|
||||
{
|
||||
inline std::vector<env_config>
|
||||
get_environ(int _verbose, std::string _search_paths = {},
|
||||
std::string _omnilib = "libomnitrace.so",
|
||||
std::string _omnilib_dl = "libomnitrace-dl.so")
|
||||
std::string _omnilib = "librocprof-sys.so",
|
||||
std::string _omnilib_dl = "librocprof-sys-dl.so")
|
||||
{
|
||||
auto _data = std::vector<env_config>{};
|
||||
auto _omnilib_path = path::get_origin(_omnilib);
|
||||
@@ -109,17 +109,17 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
_omnilib = common::path::find_path(_omnilib, _verbose, _search_paths);
|
||||
_omnilib_dl = common::path::find_path(_omnilib_dl, _verbose, _search_paths);
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER) && OMNITRACE_USE_ROCTRACER > 0
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER) && ROCPROFSYS_USE_ROCTRACER > 0
|
||||
_data.emplace_back(env_config{ "HSA_TOOLS_LIB", _omnilib.c_str(), 0 });
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER) && OMNITRACE_USE_ROCPROFILER > 0
|
||||
# if OMNITRACE_HIP_VERSION >= 50200
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER) && ROCPROFSYS_USE_ROCPROFILER > 0
|
||||
# if ROCPROFSYS_HIP_VERSION >= 50200
|
||||
# define ROCPROFILER_METRICS_DIR "lib/rocprofiler"
|
||||
# else
|
||||
# define ROCPROFILER_METRICS_DIR "rocprofiler/lib"
|
||||
# endif
|
||||
# if OMNITRACE_HIP_VERSION <= 50500
|
||||
# if ROCPROFSYS_HIP_VERSION <= 50500
|
||||
# define ROCPROFILER_LIBNAME "librocprofiler64.so"
|
||||
# else
|
||||
# define ROCPROFILER_LIBNAME "librocprofiler64.so.1"
|
||||
@@ -133,7 +133,7 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
|
||||
auto _possible_rocp_metrics = std::vector<std::string>{};
|
||||
auto _possible_rocprof_libs = std::vector<std::string>{};
|
||||
for(const auto* itr : { "OMNITRACE_ROCM_PATH", "ROCM_PATH" })
|
||||
for(const auto* itr : { "ROCPROFSYS_ROCM_PATH", "ROCM_PATH" })
|
||||
{
|
||||
if(getenv(itr))
|
||||
{
|
||||
@@ -150,9 +150,9 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
|
||||
// default path
|
||||
_possible_rocp_metrics.emplace_back(
|
||||
common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "lib/rocprofiler"));
|
||||
common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "lib/rocprofiler"));
|
||||
_possible_rocp_metrics.emplace_back(
|
||||
common::join('/', OMNITRACE_DEFAULT_ROCM_PATH, "rocprofiler/lib"));
|
||||
common::join('/', ROCPROFSYS_DEFAULT_ROCM_PATH, "rocprofiler/lib"));
|
||||
|
||||
auto _realpath_and_unique = [](const auto& _inp_v) {
|
||||
auto _out_v = decltype(_inp_v){};
|
||||
@@ -172,7 +172,7 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
if(path::exists(itr))
|
||||
{
|
||||
_data.emplace_back(
|
||||
env_config{ "OMNITRACE_ROCPROFILER_LIBRARY", itr.c_str(), 0 });
|
||||
env_config{ "ROCPROFSYS_ROCPROFILER_LIBRARY", itr.c_str(), 0 });
|
||||
_possible_rocp_metrics.emplace(
|
||||
_possible_rocp_metrics.begin(),
|
||||
common::join('/', path::dirname(itr), "../../lib/rocprofiler"));
|
||||
@@ -195,7 +195,7 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
}
|
||||
|
||||
auto _found_rocp_metrics = (!_env_rocp_metrics.empty())
|
||||
? get_env("OMNITRACE_ROCP_METRICS_FORCE_VALID", false)
|
||||
? get_env("ROCPROFSYS_ROCP_METRICS_FORCE_VALID", false)
|
||||
: false;
|
||||
|
||||
if(!_found_rocp_metrics)
|
||||
@@ -232,26 +232,27 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
<< path::exists(_rocp_metrics_xml) << ") and/or gfx_metrics.xml (found: "
|
||||
<< path::exists(_rocp_gfx_metrics_xml)
|
||||
<< "). To ignore this error, set "
|
||||
"OMNITRACE_ROCP_METRICS_FORCE_VALID=true in the environment";
|
||||
"ROCPROFSYS_ROCP_METRICS_FORCE_VALID=true in the environment";
|
||||
}
|
||||
else
|
||||
{
|
||||
_msg << "Error! ROCP_METRICS not set in environment and OmniTrace could not "
|
||||
"find a suitable path. Please set ROCP_METRICS=/path/to/metrics.xml "
|
||||
"in the environment. This file is typically located in the same "
|
||||
"folder as the librocprofiler64.so library.\nAdditional note: "
|
||||
"metrics.xml typically contains:\n\t#include "
|
||||
"\"gfx_metrics.xml\"\nMake sure the provided path also contains this "
|
||||
"file.\nExample:\n\texport ROCP_METRICS="
|
||||
<< OMNITRACE_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR
|
||||
<< "/metrics.xml\n";
|
||||
_msg
|
||||
<< "Error! ROCP_METRICS not set in environment and rocprof-sys could not "
|
||||
"find a suitable path. Please set ROCP_METRICS=/path/to/metrics.xml "
|
||||
"in the environment. This file is typically located in the same "
|
||||
"folder as the librocprofiler64.so library.\nAdditional note: "
|
||||
"metrics.xml typically contains:\n\t#include "
|
||||
"\"gfx_metrics.xml\"\nMake sure the provided path also contains this "
|
||||
"file.\nExample:\n\texport ROCP_METRICS="
|
||||
<< ROCPROFSYS_DEFAULT_ROCM_PATH << "/" << ROCPROFILER_METRICS_DIR
|
||||
<< "/metrics.xml\n";
|
||||
}
|
||||
throw std::runtime_error(_msg.str());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_OMPT) && OMNITRACE_USE_OMPT > 0
|
||||
if(get_env("OMNITRACE_USE_OMPT", true))
|
||||
#if defined(ROCPROFSYS_USE_OMPT) && ROCPROFSYS_USE_OMPT > 0
|
||||
if(get_env("ROCPROFSYS_USE_OMPT", true))
|
||||
{
|
||||
std::string _omni_omp_libs = _omnilib_dl;
|
||||
const char* _omp_libs = getenv("OMP_TOOL_LIBRARIES");
|
||||
@@ -262,8 +263,8 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
_override = 1;
|
||||
_omni_omp_libs = common::join(':', _omp_libs, _omnilib_dl);
|
||||
}
|
||||
OMNITRACE_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n",
|
||||
_omni_omp_libs.c_str());
|
||||
ROCPROFSYS_SETUP_LOG(_verbose >= 2, "setting OMP_TOOL_LIBRARIES to '%s'\n",
|
||||
_omni_omp_libs.c_str());
|
||||
_data.emplace_back(
|
||||
env_config{ "OMP_TOOL_LIBRARIES", _omni_omp_libs.c_str(), _override });
|
||||
}
|
||||
@@ -274,8 +275,8 @@ get_environ(int _verbose, std::string _search_paths = {},
|
||||
|
||||
inline void
|
||||
setup_environ(int _verbose, const std::string& _search_paths = {},
|
||||
std::string _omnilib = "libomnitrace.so",
|
||||
std::string _omnilib_dl = "libomnitrace-dl.so")
|
||||
std::string _omnilib = "librocprof-sys.so",
|
||||
std::string _omnilib_dl = "librocprof-sys-dl.so")
|
||||
{
|
||||
auto _data =
|
||||
get_environ(_verbose, _search_paths, std::move(_omnilib), std::move(_omnilib_dl));
|
||||
@@ -283,4 +284,4 @@ setup_environ(int _verbose, const std::string& _search_paths = {},
|
||||
itr(_verbose >= 3);
|
||||
}
|
||||
} // namespace common
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -40,36 +40,40 @@ set(core_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/timemory.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/utility.hpp)
|
||||
|
||||
add_library(omnitrace-core-library STATIC)
|
||||
add_library(omnitrace::omnitrace-core ALIAS omnitrace-core-library)
|
||||
add_library(rocprofiler-systems-core-library STATIC)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-core ALIAS
|
||||
rocprofiler-systems-core-library)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${core_sources} ${core_headers}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp)
|
||||
target_sources(
|
||||
rocprofiler-systems-core-library PRIVATE ${core_sources} ${core_headers}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/defines.hpp)
|
||||
add_subdirectory(binary)
|
||||
add_subdirectory(components)
|
||||
add_subdirectory(containers)
|
||||
|
||||
target_include_directories(omnitrace-core-library BEFORE
|
||||
target_include_directories(rocprofiler-systems-core-library BEFORE
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
target_link_libraries(omnitrace-core-library
|
||||
PRIVATE omnitrace::omnitrace-interface-library)
|
||||
target_link_libraries(rocprofiler-systems-core-library
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-interface-library)
|
||||
target_link_libraries(
|
||||
omnitrace-core-library
|
||||
rocprofiler-systems-core-library
|
||||
PRIVATE
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-headers>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-threading>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-common-library>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-definitions>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-options>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-perfetto>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-timemory>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-mpi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-hip>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-rocm-smi>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${OMNITRACE_BUILD_LTO}>,omnitrace::omnitrace-lto,>>)
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-headers>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-threading>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-common-library>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-options>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-perfetto>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-timemory>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-mpi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-hip>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocm-smi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libgcc-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
|
||||
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
|
||||
)
|
||||
|
||||
set_target_properties(omnitrace-core-library PROPERTIES OUTPUT_NAME omnitrace-core)
|
||||
set_target_properties(rocprofiler-systems-core-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-core)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <timemory/utility/filepath.hpp>
|
||||
#include <timemory/utility/join.hpp>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace argparse
|
||||
{
|
||||
@@ -56,25 +56,25 @@ get_clock_id_choices()
|
||||
return _v;
|
||||
};
|
||||
|
||||
#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \
|
||||
#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \
|
||||
std::make_tuple(clock_name(#VAL), VAL, std::string_view{ #VAL })
|
||||
|
||||
auto _choices = strvec_t{};
|
||||
auto _aliases = std::map<std::string, strvec_t>{};
|
||||
for(auto itr : { OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) })
|
||||
for(auto itr : { ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) })
|
||||
{
|
||||
auto _choice = std::to_string(std::get<1>(itr));
|
||||
_choices.emplace_back(_choice);
|
||||
_aliases[_choice] = { std::get<0>(itr), std::string{ std::get<2>(itr) } };
|
||||
}
|
||||
|
||||
#undef OMNITRACE_CLOCK_IDENTIFIER
|
||||
#undef ROCPROFSYS_CLOCK_IDENTIFIER
|
||||
|
||||
return std::make_pair(_choices, _aliases);
|
||||
}
|
||||
@@ -137,13 +137,13 @@ update_env(parser_data& _data, std::string_view _env_var, Tp&& _env_val,
|
||||
else
|
||||
{
|
||||
free(itr);
|
||||
itr = strdup(omnitrace::common::join('=', _env_var, _env_val).c_str());
|
||||
itr = strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
_data.current.emplace_back(
|
||||
strdup(omnitrace::common::join('=', _env_var, _env_val).c_str()));
|
||||
strdup(rocprofsys::common::join('=', _env_var, _env_val).c_str()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -171,7 +171,7 @@ get_internal_libpath(const std::string& _lib)
|
||||
auto _pos = _exe.find_last_of('/');
|
||||
auto _dir = filepath::get_cwd();
|
||||
if(_pos != std::string_view::npos) _dir = _exe.substr(0, _pos);
|
||||
return filepath::realpath(omnitrace::common::join("/", _dir, "..", "lib", _lib),
|
||||
return filepath::realpath(rocprofsys::common::join("/", _dir, "..", "lib", _lib),
|
||||
nullptr, false);
|
||||
}
|
||||
} // namespace
|
||||
@@ -219,21 +219,21 @@ init_parser(parser_data& _data)
|
||||
}
|
||||
}
|
||||
|
||||
_data.dl_libpath = get_realpath(get_internal_libpath("libomnitrace-dl.so").c_str());
|
||||
_data.omni_libpath = get_realpath(get_internal_libpath("libomnitrace.so").c_str());
|
||||
_data.dl_libpath = get_realpath(get_internal_libpath("librocprof-sys-dl.so").c_str());
|
||||
_data.omni_libpath = get_realpath(get_internal_libpath("librocprof-sys.so").c_str());
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER) || defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER) || defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_data, "HSA_TOOLS_LIB", _data.dl_libpath);
|
||||
if(!getenv("HSA_TOOLS_REPORT_LOAD_FAILURE"))
|
||||
update_env(_data, "HSA_TOOLS_REPORT_LOAD_FAILURE", "1");
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_data, "ROCP_TOOL_LIB", _data.omni_libpath);
|
||||
if(!getenv("ROCP_HSA_INTERCEPT")) update_env(_data, "ROCP_HSA_INTERCEPT", "1");
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_OMPT)
|
||||
#if defined(ROCPROFSYS_USE_OMPT)
|
||||
if(!getenv("OMP_TOOL_LIBRARIES"))
|
||||
update_env(_data, "OMP_TOOL_LIBRARIES", _data.dl_libpath, UPD_PREPEND);
|
||||
#endif
|
||||
@@ -305,7 +305,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
? strvec_t{ "hsa-interrupt" }
|
||||
: strvec_t{};
|
||||
|
||||
#if OMNITRACE_USE_ROCTRACER == 0 && OMNITRACE_USE_ROCPROFILER == 0
|
||||
#if ROCPROFSYS_USE_ROCTRACER == 0 && ROCPROFSYS_USE_ROCPROFILER == 0
|
||||
_realtime_reqs.clear();
|
||||
#endif
|
||||
|
||||
@@ -325,7 +325,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
auto _monochrome = p.get<bool>("monochrome");
|
||||
_data.monochrome = _monochrome;
|
||||
p.set_use_color(!_monochrome);
|
||||
update_env(_data, "OMNITRACE_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_data, "ROCPROFSYS_MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
update_env(_data, "MONOCHROME", (_monochrome) ? "1" : "0");
|
||||
});
|
||||
|
||||
@@ -337,7 +337,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
_parser.add_argument({ "--debug" }, "Debug output")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_DEBUG", p.get<bool>("debug"));
|
||||
update_env(_data, "ROCPROFSYS_DEBUG", p.get<bool>("debug"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("debug");
|
||||
@@ -351,7 +351,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<int>("verbose");
|
||||
_data.verbose = _v;
|
||||
update_env(_data, "OMNITRACE_VERBOSE", _v);
|
||||
update_env(_data, "ROCPROFSYS_VERBOSE", _v);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("verbose");
|
||||
@@ -369,7 +369,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("filepath")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_CONFIG_FILE",
|
||||
update_env(_data, "ROCPROFSYS_CONFIG_FILE",
|
||||
join(array_config_t{ ":" }, p.get<strvec_t>("config")));
|
||||
});
|
||||
|
||||
@@ -389,8 +389,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("path [prefix]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<strvec_t>("output");
|
||||
update_env(_data, "OMNITRACE_OUTPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "OMNITRACE_OUTPUT_PREFIX", _v.at(1));
|
||||
update_env(_data, "ROCPROFSYS_OUTPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "ROCPROFSYS_OUTPUT_PREFIX", _v.at(1));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("output");
|
||||
@@ -405,7 +405,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"Generate a detailed trace (perfetto output)")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE", p.get<bool>("trace"));
|
||||
update_env(_data, "ROCPROFSYS_TRACE", p.get<bool>("trace"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("trace");
|
||||
@@ -420,7 +420,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.max_count(1)
|
||||
.conflicts({ "flat-profile" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROFILE", p.get<bool>("profile"));
|
||||
update_env(_data, "ROCPROFSYS_PROFILE", p.get<bool>("profile"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("profile");
|
||||
@@ -434,8 +434,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.max_count(1)
|
||||
.conflicts({ "profile" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_data, "OMNITRACE_FLAT_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_data, "ROCPROFSYS_PROFILE", p.get<bool>("flat-profile"));
|
||||
update_env(_data, "ROCPROFSYS_FLAT_PROFILE", p.get<bool>("flat-profile"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("flat_profile");
|
||||
@@ -451,13 +451,13 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("timer-type")
|
||||
.choices({ "cputime", "realtime" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_USE_SAMPLING", true);
|
||||
update_env(_data, "ROCPROFSYS_USE_SAMPLING", true);
|
||||
auto _modes = p.get<strset_t>("sample");
|
||||
if(!_modes.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME",
|
||||
_modes.count("cputime") > 0, UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME",
|
||||
_modes.count("realtime") > 0, UPD_WEAK);
|
||||
}
|
||||
});
|
||||
@@ -475,8 +475,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.action([&](parser_t& p) {
|
||||
auto _h = p.get<bool>("host");
|
||||
auto _d = p.get<bool>("device");
|
||||
update_env(_data, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "OMNITRACE_CPU_FREQ_ENABLED", _h);
|
||||
update_env(_data, "ROCPROFSYS_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "ROCPROFSYS_CPU_FREQ_ENABLED", _h);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("host");
|
||||
@@ -494,8 +494,8 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.action([&](parser_t& p) {
|
||||
auto _h = p.get<bool>("host");
|
||||
auto _d = p.get<bool>("device");
|
||||
update_env(_data, "OMNITRACE_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "OMNITRACE_USE_ROCM_SMI", _d);
|
||||
update_env(_data, "ROCPROFSYS_USE_PROCESS_SAMPLING", _h || _d);
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCM_SMI", _d);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("device");
|
||||
@@ -512,11 +512,11 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DELAY", p.get<double>("wait"),
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DELAY", p.get<double>("wait"),
|
||||
UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DELAY", p.get<double>("wait"),
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DELAY", p.get<double>("wait"),
|
||||
UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_CAUSAL_DELAY", p.get<double>("wait"),
|
||||
update_env(_data, "ROCPROFSYS_CAUSAL_DELAY", p.get<double>("wait"),
|
||||
UPD_WEAK);
|
||||
});
|
||||
|
||||
@@ -533,11 +533,11 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DURATION", p.get<double>("duration"),
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DURATION", p.get<double>("duration"),
|
||||
UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DURATION",
|
||||
p.get<double>("duration"), UPD_WEAK);
|
||||
update_env(_data, "OMNITRACE_CAUSAL_DURATION", p.get<double>("duration"),
|
||||
update_env(_data, "ROCPROFSYS_CAUSAL_DURATION", p.get<double>("duration"),
|
||||
UPD_WEAK);
|
||||
});
|
||||
|
||||
@@ -555,7 +555,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("period-spec(s)")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_data, "OMNITRACE_TRACE_PERIODS",
|
||||
_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
join(array_config_t{ " ", "", "" }, p.get<strvec_t>("periods")),
|
||||
UPD_WEAK);
|
||||
});
|
||||
@@ -567,28 +567,28 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"rcclp", "rocm-smi", "roctracer", "rocprofiler",
|
||||
"roctx", "mutex-locks", "spin-locks", "rw-locks" };
|
||||
|
||||
#if !defined(OMNITRACE_USE_MPI) && !defined(OMNITRACE_USE_MPI_HEADERS)
|
||||
#if !defined(ROCPROFSYS_USE_MPI) && !defined(ROCPROFSYS_USE_MPI_HEADERS)
|
||||
_backend_choices.erase("mpip");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_OMPT)
|
||||
#if !defined(ROCPROFSYS_USE_OMPT)
|
||||
_backend_choices.erase("ompt");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_RCCL)
|
||||
#if !defined(ROCPROFSYS_USE_RCCL)
|
||||
_backend_choices.erase("rcclp");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCM_SMI)
|
||||
#if !defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
_backend_choices.erase("rocm-smi");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("roctx");
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
_backend_choices.erase("rocprofiler");
|
||||
#endif
|
||||
|
||||
@@ -599,25 +599,25 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("rocprofiler");
|
||||
|
||||
#if defined(OMNITRACE_USE_RCCL)
|
||||
update_env(_data, "OMNITRACE_USE_RCCLP", false);
|
||||
#if defined(ROCPROFSYS_USE_RCCL)
|
||||
update_env(_data, "ROCPROFSYS_USE_RCCLP", false);
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCM_SMI)
|
||||
update_env(_data, "OMNITRACE_USE_ROCM_SMI", false);
|
||||
#if defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCM_SMI", false);
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCTRACER)
|
||||
update_env(_data, "OMNITRACE_USE_ROCTRACER", false);
|
||||
update_env(_data, "OMNITRACE_USE_ROCTX", false);
|
||||
update_env(_data, "OMNITRACE_ROCTRACER_HSA_ACTIVITY", false);
|
||||
update_env(_data, "OMNITRACE_ROCTRACER_HIP_ACTIVITY", false);
|
||||
#if defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCTRACER", false);
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCTX", false);
|
||||
update_env(_data, "ROCPROFSYS_ROCTRACER_HSA_ACTIVITY", false);
|
||||
update_env(_data, "ROCPROFSYS_ROCTRACER_HIP_ACTIVITY", false);
|
||||
_backend_choices.erase("roctracer");
|
||||
_backend_choices.erase("roctx");
|
||||
#endif
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER)
|
||||
update_env(_data, "OMNITRACE_USE_ROCPROFILER", false);
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
update_env(_data, "ROCPROFSYS_USE_ROCPROFILER", false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -637,17 +637,17 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
auto _update = [&](const auto& _opt, bool _cond) {
|
||||
if(_cond || _v.count("all") > 0) update_env(_data, _opt, true);
|
||||
};
|
||||
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
_update("ROCPROFSYS_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("ROCPROFSYS_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("ROCPROFSYS_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("ROCPROFSYS_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
|
||||
if(_v.count("all") > 0 || _v.count("ompt") > 0)
|
||||
update_env(_data, "OMP_TOOL_LIBRARIES", _data.dl_libpath,
|
||||
@@ -673,17 +673,17 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
auto _update = [&](const auto& _opt, bool _cond) {
|
||||
if(_cond || _v.count("all") > 0) update_env(_data, _opt, false);
|
||||
};
|
||||
_update("OMNITRACE_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("OMNITRACE_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("OMNITRACE_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("OMNITRACE_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("OMNITRACE_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("OMNITRACE_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("OMNITRACE_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("OMNITRACE_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("OMNITRACE_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
_update("ROCPROFSYS_USE_KOKKOSP", _v.count("kokkosp") > 0);
|
||||
_update("ROCPROFSYS_USE_MPIP", _v.count("mpip") > 0);
|
||||
_update("ROCPROFSYS_USE_OMPT", _v.count("ompt") > 0);
|
||||
_update("ROCPROFSYS_USE_RCCLP", _v.count("rcclp") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTX", _v.count("roctx") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCM_SMI", _v.count("rocm-smi") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCTRACER", _v.count("roctracer") > 0);
|
||||
_update("ROCPROFSYS_USE_ROCPROFILER", _v.count("rocprofiler") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_LOCKS", _v.count("mutex-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_RW_LOCKS", _v.count("rw-locks") > 0);
|
||||
_update("ROCPROFSYS_TRACE_THREAD_SPIN_LOCKS", _v.count("spin-locks") > 0);
|
||||
|
||||
if(_v.count("all") > 0 ||
|
||||
(_v.count("roctracer") > 0 && _v.count("rocprofiler") > 0))
|
||||
@@ -746,7 +746,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("filepath")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PERFETTO_FILE",
|
||||
update_env(_data, "ROCPROFSYS_PERFETTO_FILE",
|
||||
p.get<std::string>("trace-file"));
|
||||
});
|
||||
|
||||
@@ -762,7 +762,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("KB")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PERFETTO_BUFFER_SIZE_KB",
|
||||
update_env(_data, "ROCPROFSYS_PERFETTO_BUFFER_SIZE_KB",
|
||||
p.get<int64_t>("trace-buffer-size"));
|
||||
});
|
||||
|
||||
@@ -777,7 +777,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("policy")
|
||||
.choices({ "discard", "ring_buffer" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PERFETTO_FILL_POLICY",
|
||||
update_env(_data, "ROCPROFSYS_PERFETTO_FILL_POLICY",
|
||||
p.get<std::string>("trace-fill-policy"));
|
||||
});
|
||||
|
||||
@@ -797,7 +797,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DELAY", p.get<double>("trace-wait"));
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DELAY", p.get<double>("trace-wait"));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("trace_delay");
|
||||
@@ -814,7 +814,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_TRACE_DURATION",
|
||||
p.get<double>("trace-duration"));
|
||||
});
|
||||
|
||||
@@ -833,7 +833,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.min_count(1)
|
||||
.dtype("period-spec(s)")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_PERIODS",
|
||||
update_env(_data, "ROCPROFSYS_TRACE_PERIODS",
|
||||
join(array_config_t{ ",", "", "" },
|
||||
p.get<strvec_t>("trace-periods")));
|
||||
});
|
||||
@@ -855,11 +855,11 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"active "
|
||||
"threads would equate to ~1 second of realtime. If this proves to be "
|
||||
"difficult to handle in practice, please file a feature request for "
|
||||
"omnitrace to auto-scale based on the number of threads.")
|
||||
"rocprof-sys to auto-scale based on the number of threads.")
|
||||
.count(1)
|
||||
.dtype("clock-id")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_TRACE_PERIOD_CLOCK_ID",
|
||||
update_env(_data, "ROCPROFSYS_TRACE_PERIOD_CLOCK_ID",
|
||||
p.get<double>("trace-clock-id"));
|
||||
})
|
||||
.choices(_clock_id_choices.first)
|
||||
@@ -883,12 +883,12 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.choices({ "text", "json", "console" })
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<strset_t>("profile-format");
|
||||
update_env(_data, "OMNITRACE_PROFILE", true);
|
||||
update_env(_data, "ROCPROFSYS_PROFILE", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_TEXT_OUTPUT", _v.count("text") != 0);
|
||||
update_env(_data, "OMNITRACE_JSON_OUTPUT", _v.count("json") != 0);
|
||||
update_env(_data, "OMNITRACE_COUT_OUTPUT", _v.count("console") != 0);
|
||||
update_env(_data, "ROCPROFSYS_TEXT_OUTPUT", _v.count("text") != 0);
|
||||
update_env(_data, "ROCPROFSYS_JSON_OUTPUT", _v.count("json") != 0);
|
||||
update_env(_data, "ROCPROFSYS_COUT_OUTPUT", _v.count("console") != 0);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -911,9 +911,9 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("path [prefix]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<strvec_t>("profile-diff");
|
||||
update_env(_data, "OMNITRACE_DIFF_OUTPUT", true);
|
||||
update_env(_data, "OMNITRACE_INPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "OMNITRACE_INPUT_PREFIX", _v.at(1));
|
||||
update_env(_data, "ROCPROFSYS_DIFF_OUTPUT", true);
|
||||
update_env(_data, "ROCPROFSYS_INPUT_PATH", _v.at(0));
|
||||
if(_v.size() > 1) update_env(_data, "ROCPROFSYS_INPUT_PREFIX", _v.at(1));
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("profile_diff");
|
||||
@@ -936,7 +936,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("floating-point")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROCESS_SAMPLING_FREQ",
|
||||
update_env(_data, "ROCPROFSYS_PROCESS_SAMPLING_FREQ",
|
||||
p.get<double>("process-freq"));
|
||||
});
|
||||
|
||||
@@ -953,7 +953,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_PROCESS_SAMPLING_DELAY",
|
||||
update_env(_data, "ROCPROFSYS_PROCESS_SAMPLING_DELAY",
|
||||
p.get<double>("process-wait"));
|
||||
});
|
||||
|
||||
@@ -970,7 +970,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_PROCESS_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_PROCESS_DURATION",
|
||||
p.get<double>("process-duration"));
|
||||
});
|
||||
|
||||
@@ -987,7 +987,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("int and/or range")
|
||||
.required({ "host" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUS",
|
||||
join(array_config_t{ "," }, p.get<strvec_t>("cpus")));
|
||||
});
|
||||
|
||||
@@ -1003,7 +1003,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("int and/or range")
|
||||
.required({ "device" })
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_GPUS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_GPUS",
|
||||
join(array_config_t{ "," }, p.get<strvec_t>("gpus")));
|
||||
});
|
||||
|
||||
@@ -1023,7 +1023,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("floating-point")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_FREQ",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_FREQ",
|
||||
p.get<double>("sampling-freq"));
|
||||
});
|
||||
|
||||
@@ -1042,7 +1042,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("int and/or range")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(
|
||||
_data, "OMNITRACE_SAMPLING_TIDS",
|
||||
_data, "ROCPROFSYS_SAMPLING_TIDS",
|
||||
join(array_config_t{ ", " }, p.get<std::vector<int64_t>>("tids")));
|
||||
});
|
||||
|
||||
@@ -1063,7 +1063,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DELAY",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DELAY",
|
||||
p.get<double>("sampling-wait"));
|
||||
});
|
||||
|
||||
@@ -1082,7 +1082,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.count(1)
|
||||
.dtype("seconds")
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_DURATION",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_DURATION",
|
||||
p.get<double>("sampling-duration"));
|
||||
});
|
||||
|
||||
@@ -1100,20 +1100,20 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("[freq] [delay] [tids...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("sample-cputime");
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME", true);
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_FREQ", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_DELAY", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME_DELAY", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_CPUTIME_TIDS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_CPUTIME_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -1129,20 +1129,20 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.required(std::move(_realtime_reqs))
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("sample-realtime");
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME", true);
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME", true);
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_FREQ", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_DELAY", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME_DELAY", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_REALTIME_TIDS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_REALTIME_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -1157,7 +1157,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
.dtype("[event] [freq] [tids...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _v = p.get<std::deque<std::string>>("sample-overflow");
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW", true);
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW", true);
|
||||
|
||||
if(!_v.empty())
|
||||
{
|
||||
@@ -1167,17 +1167,17 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"", "'--sample-overflow ", _v.front(),
|
||||
" ...' conflicts with '--sampling-overflow-event ",
|
||||
p.get<std::string>("sampling-overflow-event"), "' option"));
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_EVENT", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_EVENT", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_FREQ", _v.front());
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_FREQ", _v.front());
|
||||
_v.pop_front();
|
||||
}
|
||||
if(!_v.empty())
|
||||
{
|
||||
update_env(_data, "OMNITRACE_SAMPLING_OVERFLOW_TIDS",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_OVERFLOW_TIDS",
|
||||
join(array_config_t{ "," }, _v));
|
||||
}
|
||||
});
|
||||
@@ -1191,37 +1191,37 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
|
||||
add_group_arguments(_parser, "sampling", _data);
|
||||
|
||||
_parser.start_group("HARDWARE COUNTER OPTIONS", "See also: omnitrace-avail -H");
|
||||
_parser.start_group("HARDWARE COUNTER OPTIONS", "See also: rocprof-sys-avail -H");
|
||||
|
||||
if(_data.environ_filter("cpu_events", _data))
|
||||
{
|
||||
_parser
|
||||
.add_argument({ "-C", "--cpu-events" },
|
||||
"Set the CPU hardware counter events to record (ref: "
|
||||
"`omnitrace-avail -H -c CPU`)")
|
||||
"`rocprof-sys-avail -H -c CPU`)")
|
||||
.min_count(1)
|
||||
.dtype("[EVENT ...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("cpu-events"));
|
||||
update_env(_data, "OMNITRACE_PAPI_EVENTS", _events);
|
||||
update_env(_data, "ROCPROFSYS_PAPI_EVENTS", _events);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("cpu_events");
|
||||
_data.processed_environs.emplace("papi_events");
|
||||
}
|
||||
|
||||
#if defined(OMNITRACE_USE_ROCPROFILER)
|
||||
#if defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
if(_data.environ_filter("gpu_events", _data))
|
||||
{
|
||||
_parser
|
||||
.add_argument({ "-G", "--gpu-events" },
|
||||
"Set the GPU hardware counter events to record (ref: "
|
||||
"`omnitrace-avail -H -c GPU`)")
|
||||
"`rocprof-sys-avail -H -c GPU`)")
|
||||
.min_count(1)
|
||||
.dtype("[EVENT ...]")
|
||||
.action([&](parser_t& p) {
|
||||
auto _events = join(array_config_t{ "," }, p.get<strvec_t>("gpu-events"));
|
||||
update_env(_data, "OMNITRACE_ROCM_EVENTS", _events);
|
||||
update_env(_data, "ROCPROFSYS_ROCM_EVENTS", _events);
|
||||
});
|
||||
|
||||
_data.processed_environs.emplace("gpu_events");
|
||||
@@ -1244,7 +1244,7 @@ add_core_arguments(parser_t& _parser, parser_data& _data)
|
||||
"Include inline info in output when available")
|
||||
.max_count(1)
|
||||
.action([&](parser_t& p) {
|
||||
update_env(_data, "OMNITRACE_SAMPLING_INCLUDE_INLINES",
|
||||
update_env(_data, "ROCPROFSYS_SAMPLING_INCLUDE_INLINES",
|
||||
p.get<bool>("inlines"));
|
||||
});
|
||||
|
||||
@@ -1328,9 +1328,9 @@ add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_da
|
||||
};
|
||||
|
||||
auto _settings = std::vector<std::shared_ptr<tim::vsettings>>{};
|
||||
for(auto& itr : *omnitrace::settings::instance())
|
||||
for(auto& itr : *rocprofsys::settings::instance())
|
||||
{
|
||||
if(itr.second->get_categories().count("omnitrace") == 0) continue;
|
||||
if(itr.second->get_categories().count("rocprofsys") == 0) continue;
|
||||
if(itr.second->get_categories().count("deprecated") > 0) continue;
|
||||
if(itr.second->get_hidden()) continue;
|
||||
if(!_data.setting_filter(itr.second.get(), _data)) continue;
|
||||
@@ -1353,7 +1353,7 @@ add_group_arguments(parser_t& _parser, const std::string& _group_name, parser_da
|
||||
}),
|
||||
_choices.end());
|
||||
_choices.emplace_back(
|
||||
"... run `omnitrace-avail -H -c CPU` for full list ...");
|
||||
"... run `rocprof-sys-avail -H -c CPU` for full list ...");
|
||||
itr.second->set_choices(_choices);
|
||||
}
|
||||
}
|
||||
@@ -1390,9 +1390,9 @@ add_extended_arguments(parser_t& _parser, parser_data& _data)
|
||||
{
|
||||
auto _category_count_map = std::unordered_map<std::string, uint32_t>{};
|
||||
auto _settings = std::vector<std::shared_ptr<tim::vsettings>>{};
|
||||
for(auto& itr : *omnitrace::settings::instance())
|
||||
for(auto& itr : *rocprofsys::settings::instance())
|
||||
{
|
||||
if(itr.second->get_categories().count("omnitrace") == 0) continue;
|
||||
if(itr.second->get_categories().count("rocprofsys") == 0) continue;
|
||||
if(itr.second->get_categories().count("deprecated") > 0) continue;
|
||||
if(itr.second->get_hidden()) continue;
|
||||
if(!_data.setting_filter(itr.second.get(), _data)) continue;
|
||||
@@ -1414,15 +1414,14 @@ add_extended_arguments(parser_t& _parser, parser_data& _data)
|
||||
}),
|
||||
_choices.end());
|
||||
_choices.emplace_back(
|
||||
"... run `omnitrace-avail -H -c CPU` for full list ...");
|
||||
"... run `rocprof-sys-avail -H -c CPU` for full list ...");
|
||||
itr.second->set_choices(_choices);
|
||||
}
|
||||
|
||||
for(const auto& citr : itr.second->get_categories())
|
||||
{
|
||||
if(std::regex_search(
|
||||
citr, std::regex{
|
||||
"omnitrace|timemory|^(native|custom|advanced|analysis)$" }))
|
||||
if(std::regex_search(citr, std::regex{ "rocprofsys|timemory|^("
|
||||
"native|custom|advanced|analysis)$" }))
|
||||
continue;
|
||||
_category_count_map[citr] += 1;
|
||||
}
|
||||
@@ -1467,4 +1466,4 @@ add_extended_arguments(parser_t& _parser, parser_data& _data)
|
||||
return _data;
|
||||
}
|
||||
} // namespace argparse
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace argparse
|
||||
{
|
||||
@@ -93,4 +93,4 @@ add_group_arguments(parser_t&, const std::string&, parser_data&, bool _add_group
|
||||
parser_data&
|
||||
add_extended_arguments(parser_t&, parser_data&);
|
||||
} // namespace argparse
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -4,4 +4,5 @@ set(binary_sources ${CMAKE_CURRENT_LIST_DIR}/address_range.cpp)
|
||||
set(binary_headers ${CMAKE_CURRENT_LIST_DIR}/address_range.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${binary_sources} ${binary_headers})
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${binary_sources}
|
||||
${binary_headers})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "binary/address_range.hpp"
|
||||
#include "debug.hpp"
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -187,4 +187,4 @@ address_range::hash() const
|
||||
: hash_value_t{ low };
|
||||
}
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -43,7 +43,7 @@ struct address_range
|
||||
uintptr_t low = std::numeric_limits<uintptr_t>::max();
|
||||
uintptr_t high = std::numeric_limits<uintptr_t>::min();
|
||||
|
||||
OMNITRACE_DEFAULT_OBJECT(address_range)
|
||||
ROCPROFSYS_DEFAULT_OBJECT(address_range)
|
||||
|
||||
explicit address_range(uintptr_t _v);
|
||||
address_range(uintptr_t _low, uintptr_t _high);
|
||||
@@ -89,14 +89,14 @@ operator+(uintptr_t _v, binary::address_range _lhs)
|
||||
{
|
||||
return (_lhs += _v);
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<::omnitrace::binary::address_range>
|
||||
struct hash<::rocprofsys::binary::address_range>
|
||||
{
|
||||
using address_range_t = ::omnitrace::binary::address_range;
|
||||
using address_range_t = ::rocprofsys::binary::address_range;
|
||||
|
||||
auto operator()(const address_range_t& _v) const { return _v.hash(); }
|
||||
auto operator()(address_range_t&& _v) const { return _v.hash(); }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <tuple>
|
||||
#include <variant>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace binary
|
||||
{
|
||||
@@ -59,4 +59,4 @@ struct symbol;
|
||||
struct dwarf_entry;
|
||||
struct binary_info;
|
||||
} // namespace binary
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace categories
|
||||
{
|
||||
@@ -44,8 +44,8 @@ configure_categories(bool _enable, const std::set<std::string>& _categories)
|
||||
auto _name = trait::name<Tp>::value;
|
||||
if(_categories.count(_name) > 0)
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(3, "%s category: %s\n", (_enable) ? "Enabling" : "Disabling",
|
||||
_name);
|
||||
ROCPROFSYS_VERBOSE_F(3, "%s category: %s\n", (_enable) ? "Enabling" : "Disabling",
|
||||
_name);
|
||||
trait::runtime_enabled<Tp>::set(_enable);
|
||||
}
|
||||
}
|
||||
@@ -61,11 +61,11 @@ configure_categories(bool _enable, const std::set<std::string>& _categories,
|
||||
void
|
||||
configure_categories(bool _enable, const std::set<std::string>& _categories)
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(1, "%s categories...\n", (_enable) ? "Enabling" : "Disabling");
|
||||
ROCPROFSYS_VERBOSE_F(1, "%s categories...\n", (_enable) ? "Enabling" : "Disabling");
|
||||
|
||||
configure_categories(
|
||||
_enable, _categories,
|
||||
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
|
||||
utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{});
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -74,7 +74,7 @@ enable_categories(const std::set<std::string>& _categories)
|
||||
{
|
||||
configure_categories(
|
||||
true, _categories,
|
||||
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
|
||||
utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{});
|
||||
}
|
||||
|
||||
void
|
||||
@@ -82,7 +82,7 @@ disable_categories(const std::set<std::string>& _categories)
|
||||
{
|
||||
configure_categories(
|
||||
false, _categories,
|
||||
utility::make_index_sequence_range<1, OMNITRACE_CATEGORY_LAST>{});
|
||||
utility::make_index_sequence_range<1, ROCPROFSYS_CATEGORY_LAST>{});
|
||||
}
|
||||
|
||||
void
|
||||
@@ -138,4 +138,4 @@ shutdown()
|
||||
disable_categories(config::get_enabled_categories());
|
||||
}
|
||||
} // namespace categories
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "common/join.hpp"
|
||||
#include "defines.hpp"
|
||||
#include "omnitrace/categories.h" // in omnitrace-user
|
||||
#include "rocprofiler-systems/categories.h" // in rocprof-sys-user
|
||||
|
||||
#if defined(TIMEMORY_PERFETTO_CATEGORIES)
|
||||
# error "TIMEMORY_PERFETTO_CATEGORIES is already defined. Please include \"" __FILE__ "\" before including any timemory files"
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <timemory/mpl/macros.hpp>
|
||||
#include <timemory/mpl/types.hpp>
|
||||
|
||||
#define OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, ...) \
|
||||
#define ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, ...) \
|
||||
namespace tim \
|
||||
{ \
|
||||
namespace trait \
|
||||
@@ -49,7 +49,7 @@
|
||||
} \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
template <size_t>
|
||||
struct category_type_id;
|
||||
@@ -59,10 +59,10 @@ struct category_enum_id;
|
||||
|
||||
template <size_t Idx>
|
||||
using category_type_id_t = typename category_type_id<Idx>::type;
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
#define OMNITRACE_DEFINE_CATEGORY_TRAIT(TYPE, ENUM) \
|
||||
namespace omnitrace \
|
||||
#define ROCPROFSYS_DEFINE_CATEGORY_TRAIT(TYPE, ENUM) \
|
||||
namespace rocprofsys \
|
||||
{ \
|
||||
template <> \
|
||||
struct category_type_id<ENUM> \
|
||||
@@ -76,61 +76,61 @@ using category_type_id_t = typename category_type_id<Idx>::type;
|
||||
}; \
|
||||
}
|
||||
|
||||
#define OMNITRACE_DECLARE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
#define ROCPROFSYS_DECLARE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
TIMEMORY_DECLARE_NS_API(NS, VALUE) \
|
||||
OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
OMNITRACE_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
#define OMNITRACE_DEFINE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
ROCPROFSYS_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
#define ROCPROFSYS_DEFINE_CATEGORY(NS, VALUE, ENUM, NAME, DESC) \
|
||||
TIMEMORY_DEFINE_NS_API(NS, VALUE) \
|
||||
OMNITRACE_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
OMNITRACE_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
ROCPROFSYS_DEFINE_NAME_TRAIT(NAME, DESC, NS::VALUE) \
|
||||
ROCPROFSYS_DEFINE_CATEGORY_TRAIT(::tim::NS::VALUE, ENUM)
|
||||
|
||||
// clang-format off
|
||||
// these are defined by omnitrace
|
||||
OMNITRACE_DEFINE_CATEGORY(project, omnitrace, OMNITRACE_CATEGORY_NONE, "omnitrace", "Omnitrace project")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, host, OMNITRACE_CATEGORY_HOST, "host", "Host-side function tracing")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, user, OMNITRACE_CATEGORY_USER, "user", "User-defined regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, python, OMNITRACE_CATEGORY_PYTHON, "python", "Python regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, device_hip, OMNITRACE_CATEGORY_DEVICE_HIP, "device_hip", "Device-side functions submitted via HIP API")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, device_hsa, OMNITRACE_CATEGORY_DEVICE_HSA, "device_hsa", "Device-side functions submitted via HSA API")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_hip, OMNITRACE_CATEGORY_ROCM_HIP, "rocm_hip", "Host-side HIP functions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_hsa, OMNITRACE_CATEGORY_ROCM_HSA, "rocm_hsa", "Host-side HSA functions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_roctx, OMNITRACE_CATEGORY_ROCM_ROCTX, "rocm_roctx", "ROCTx labels")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi, OMNITRACE_CATEGORY_ROCM_SMI, "rocm_smi", "rocm-smi data")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_busy, OMNITRACE_CATEGORY_ROCM_SMI_BUSY, "device_busy", "Busy percentage of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_temp, OMNITRACE_CATEGORY_ROCM_SMI_TEMP, "device_temp", "Temperature of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_power, OMNITRACE_CATEGORY_ROCM_SMI_POWER, "device_power", "Power consumption of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_smi_memory_usage, OMNITRACE_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocm_rccl, OMNITRACE_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, roctracer, OMNITRACE_CATEGORY_ROCTRACER, "roctracer", "Kernel tracing provided by roctracer")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, rocprofiler, OMNITRACE_CATEGORY_ROCPROFILER, "rocprofiler", "HW counter data provided by rocprofiler")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, pthread, OMNITRACE_CATEGORY_PTHREAD, "pthread", "POSIX threading functions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, kokkos, OMNITRACE_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, mpi, OMNITRACE_CATEGORY_MPI, "mpi", "MPI regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, ompt, OMNITRACE_CATEGORY_OMPT, "ompt", "OpenMP tools regions")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_sampling, OMNITRACE_CATEGORY_PROCESS_SAMPLING, "process_sampling", "Process-level data")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, comm_data, OMNITRACE_CATEGORY_COMM_DATA, "comm_data", "MPI/RCCL counters for tracking amount of data sent or received")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, causal, OMNITRACE_CATEGORY_CAUSAL, "causal", "Causal profiling data")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, cpu_freq, OMNITRACE_CATEGORY_CPU_FREQ, "cpu_frequency", "CPU frequency (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_page, OMNITRACE_CATEGORY_PROCESS_PAGE, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_virt, OMNITRACE_CATEGORY_PROCESS_VIRT, "process_virtual_memory", "Virtual memory usage in process in MB (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_peak, OMNITRACE_CATEGORY_PROCESS_PEAK, "process_memory_hwm", "Memory High-Water Mark i.e. peak memory usage (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_context_switch, OMNITRACE_CATEGORY_PROCESS_CONTEXT_SWITCH, "process_context_switch", "Context switches in process (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_page_fault, OMNITRACE_CATEGORY_PROCESS_PAGE_FAULT, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_user_mode_time, OMNITRACE_CATEGORY_PROCESS_USER_MODE_TIME, "process_user_cpu_time", "CPU time of functions executing in user-space in process in seconds (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, process_kernel_mode_time, OMNITRACE_CATEGORY_PROCESS_KERNEL_MODE_TIME, "process_kernel_cpu_time", "CPU time of functions executing in kernel-space in process in seconds (collected in background thread)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_wall_time, OMNITRACE_CATEGORY_THREAD_WALL_TIME, "thread_wall_time", "Wall-clock time on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_cpu_time, OMNITRACE_CATEGORY_THREAD_CPU_TIME, "thread_cpu_time", "CPU time on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_page_fault, OMNITRACE_CATEGORY_THREAD_PAGE_FAULT, "thread_page_fault", "Memory page faults on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_peak_memory, OMNITRACE_CATEGORY_THREAD_PEAK_MEMORY, "thread_peak_memory", "Peak memory usage on thread in MB (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_context_switch, OMNITRACE_CATEGORY_THREAD_CONTEXT_SWITCH, "thread_context_switch", "Context switches on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, thread_hardware_counter, OMNITRACE_CATEGORY_THREAD_HARDWARE_COUNTER, "thread_hardware_counter", "Hardware counter value on thread (derived from sampling)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, kernel_hardware_counter, OMNITRACE_CATEGORY_KERNEL_HARDWARE_COUNTER, "kernel_hardware_counter", "Hardware counter value for kernel (deterministic)")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, numa, OMNITRACE_CATEGORY_NUMA, "numa", "Non-unified memory architecture")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, timer_sampling, OMNITRACE_CATEGORY_TIMER_SAMPLING, "timer_sampling", "Sampling based on a timer")
|
||||
OMNITRACE_DEFINE_CATEGORY(category, overflow_sampling, OMNITRACE_CATEGORY_OVERFLOW_SAMPLING, "overflow_sampling", "Sampling based on a counter overflow")
|
||||
// these are defined by rocprofsys
|
||||
ROCPROFSYS_DEFINE_CATEGORY(project, rocprofsys, ROCPROFSYS_CATEGORY_NONE, "rocprofsys", "ROCm Systems Profiler project")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, host, ROCPROFSYS_CATEGORY_HOST, "host", "Host-side function tracing")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, user, ROCPROFSYS_CATEGORY_USER, "user", "User-defined regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, python, ROCPROFSYS_CATEGORY_PYTHON, "python", "Python regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, device_hip, ROCPROFSYS_CATEGORY_DEVICE_HIP, "device_hip", "Device-side functions submitted via HIP API")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, device_hsa, ROCPROFSYS_CATEGORY_DEVICE_HSA, "device_hsa", "Device-side functions submitted via HSA API")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_hip, ROCPROFSYS_CATEGORY_ROCM_HIP, "rocm_hip", "Host-side HIP functions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_hsa, ROCPROFSYS_CATEGORY_ROCM_HSA, "rocm_hsa", "Host-side HSA functions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_roctx, ROCPROFSYS_CATEGORY_ROCM_ROCTX, "rocm_roctx", "ROCTx labels")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi, ROCPROFSYS_CATEGORY_ROCM_SMI, "rocm_smi", "rocm-smi data")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_busy, ROCPROFSYS_CATEGORY_ROCM_SMI_BUSY, "device_busy", "Busy percentage of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_temp, ROCPROFSYS_CATEGORY_ROCM_SMI_TEMP, "device_temp", "Temperature of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_power, ROCPROFSYS_CATEGORY_ROCM_SMI_POWER, "device_power", "Power consumption of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_memory_usage, ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rccl, ROCPROFSYS_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, roctracer, ROCPROFSYS_CATEGORY_ROCTRACER, "roctracer", "Kernel tracing provided by roctracer")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, rocprofiler, ROCPROFSYS_CATEGORY_ROCPROFILER, "rocprofiler", "HW counter data provided by rocprofiler")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, pthread, ROCPROFSYS_CATEGORY_PTHREAD, "pthread", "POSIX threading functions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, kokkos, ROCPROFSYS_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, mpi, ROCPROFSYS_CATEGORY_MPI, "mpi", "MPI regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, ompt, ROCPROFSYS_CATEGORY_OMPT, "ompt", "OpenMP tools regions")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_sampling, ROCPROFSYS_CATEGORY_PROCESS_SAMPLING, "process_sampling", "Process-level data")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, comm_data, ROCPROFSYS_CATEGORY_COMM_DATA, "comm_data", "MPI/RCCL counters for tracking amount of data sent or received")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, causal, ROCPROFSYS_CATEGORY_CAUSAL, "causal", "Causal profiling data")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, cpu_freq, ROCPROFSYS_CATEGORY_CPU_FREQ, "cpu_frequency", "CPU frequency (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_page, ROCPROFSYS_CATEGORY_PROCESS_PAGE, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_virt, ROCPROFSYS_CATEGORY_PROCESS_VIRT, "process_virtual_memory", "Virtual memory usage in process in MB (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_peak, ROCPROFSYS_CATEGORY_PROCESS_PEAK, "process_memory_hwm", "Memory High-Water Mark i.e. peak memory usage (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_context_switch, ROCPROFSYS_CATEGORY_PROCESS_CONTEXT_SWITCH, "process_context_switch", "Context switches in process (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_page_fault, ROCPROFSYS_CATEGORY_PROCESS_PAGE_FAULT, "process_page_fault", "Memory page faults in process (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_user_mode_time, ROCPROFSYS_CATEGORY_PROCESS_USER_MODE_TIME, "process_user_cpu_time", "CPU time of functions executing in user-space in process in seconds (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, process_kernel_mode_time, ROCPROFSYS_CATEGORY_PROCESS_KERNEL_MODE_TIME, "process_kernel_cpu_time", "CPU time of functions executing in kernel-space in process in seconds (collected in background thread)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_wall_time, ROCPROFSYS_CATEGORY_THREAD_WALL_TIME, "thread_wall_time", "Wall-clock time on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_cpu_time, ROCPROFSYS_CATEGORY_THREAD_CPU_TIME, "thread_cpu_time", "CPU time on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_page_fault, ROCPROFSYS_CATEGORY_THREAD_PAGE_FAULT, "thread_page_fault", "Memory page faults on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_peak_memory, ROCPROFSYS_CATEGORY_THREAD_PEAK_MEMORY, "thread_peak_memory", "Peak memory usage on thread in MB (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_context_switch, ROCPROFSYS_CATEGORY_THREAD_CONTEXT_SWITCH, "thread_context_switch", "Context switches on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, thread_hardware_counter, ROCPROFSYS_CATEGORY_THREAD_HARDWARE_COUNTER, "thread_hardware_counter", "Hardware counter value on thread (derived from sampling)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, kernel_hardware_counter, ROCPROFSYS_CATEGORY_KERNEL_HARDWARE_COUNTER, "kernel_hardware_counter", "Hardware counter value for kernel (deterministic)")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, numa, ROCPROFSYS_CATEGORY_NUMA, "numa", "Non-unified memory architecture")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, timer_sampling, ROCPROFSYS_CATEGORY_TIMER_SAMPLING, "timer_sampling", "Sampling based on a timer")
|
||||
ROCPROFSYS_DEFINE_CATEGORY(category, overflow_sampling, ROCPROFSYS_CATEGORY_OVERFLOW_SAMPLING, "overflow_sampling", "Sampling based on a counter overflow")
|
||||
|
||||
OMNITRACE_DECLARE_CATEGORY(category, sampling, OMNITRACE_CATEGORY_SAMPLING, "sampling", "Host-side call-stack sampling")
|
||||
ROCPROFSYS_DECLARE_CATEGORY(category, sampling, ROCPROFSYS_CATEGORY_SAMPLING, "sampling", "Host-side call-stack sampling")
|
||||
// clang-format on
|
||||
|
||||
namespace tim
|
||||
@@ -142,64 +142,64 @@ using name = perfetto_category<Tp...>;
|
||||
}
|
||||
} // namespace tim
|
||||
|
||||
#define OMNITRACE_PERFETTO_CATEGORY(TYPE) \
|
||||
#define ROCPROFSYS_PERFETTO_CATEGORY(TYPE) \
|
||||
::perfetto::Category(::tim::trait::perfetto_category<::tim::TYPE>::value) \
|
||||
.SetDescription(::tim::trait::perfetto_category<::tim::TYPE>::description)
|
||||
|
||||
#define OMNITRACE_PERFETTO_CATEGORIES \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::host), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::user), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::python), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::device_hip), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::device_hsa), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_hip), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_hsa), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_roctx), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_busy), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_temp), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_power), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocm_rccl), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::roctracer), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::rocprofiler), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::pthread), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::kokkos), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::mpi), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::ompt), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::comm_data), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::causal), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::cpu_freq), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_page), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_virt), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_peak), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_context_switch), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_page_fault), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_user_mode_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::process_kernel_mode_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_wall_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_cpu_time), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_page_fault), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_peak_memory), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_context_switch), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::thread_hardware_counter), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::kernel_hardware_counter), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::numa), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::timer_sampling), \
|
||||
OMNITRACE_PERFETTO_CATEGORY(category::overflow_sampling), \
|
||||
#define ROCPROFSYS_PERFETTO_CATEGORIES \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::host), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::user), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::python), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::device_hip), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::device_hsa), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_hip), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_hsa), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_roctx), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_busy), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_temp), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_power), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rccl), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::roctracer), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::rocprofiler), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::pthread), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::kokkos), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::mpi), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::ompt), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::comm_data), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::causal), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::cpu_freq), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_page), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_virt), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_peak), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_context_switch), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_page_fault), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_user_mode_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::process_kernel_mode_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_wall_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_cpu_time), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_page_fault), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_peak_memory), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_context_switch), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_hardware_counter), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::kernel_hardware_counter), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::numa), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::timer_sampling), \
|
||||
ROCPROFSYS_PERFETTO_CATEGORY(category::overflow_sampling), \
|
||||
::perfetto::Category("timemory").SetDescription("Events from the timemory API")
|
||||
|
||||
#if defined(TIMEMORY_USE_PERFETTO)
|
||||
# define TIMEMORY_PERFETTO_CATEGORIES OMNITRACE_PERFETTO_CATEGORIES
|
||||
# define TIMEMORY_PERFETTO_CATEGORIES ROCPROFSYS_PERFETTO_CATEGORIES
|
||||
#endif
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace config
|
||||
{
|
||||
@@ -224,4 +224,4 @@ setup();
|
||||
void
|
||||
shutdown();
|
||||
} // namespace categories
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -50,8 +50,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#define OMNITRACE_DECLARE_COMPONENT(NAME) \
|
||||
namespace omnitrace \
|
||||
#define ROCPROFSYS_DECLARE_COMPONENT(NAME) \
|
||||
namespace rocprofsys \
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
@@ -63,7 +63,7 @@
|
||||
namespace trait \
|
||||
{ \
|
||||
template <> \
|
||||
struct is_component<omnitrace::component::NAME> : true_type \
|
||||
struct is_component<rocprofsys::component::NAME> : true_type \
|
||||
{}; \
|
||||
} \
|
||||
} \
|
||||
@@ -71,12 +71,12 @@
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
using ::omnitrace::component::NAME; \
|
||||
using ::rocprofsys::component::NAME; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define OMNITRACE_COMPONENT_ALIAS(NAME, ...) \
|
||||
namespace omnitrace \
|
||||
#define ROCPROFSYS_COMPONENT_ALIAS(NAME, ...) \
|
||||
namespace rocprofsys \
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
@@ -87,22 +87,22 @@
|
||||
{ \
|
||||
namespace component \
|
||||
{ \
|
||||
using ::omnitrace::component::NAME; \
|
||||
using ::rocprofsys::component::NAME; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define OMNITRACE_DEFINE_CONCRETE_TRAIT(TRAIT, TYPE, VALUE) \
|
||||
#define ROCPROFSYS_DEFINE_CONCRETE_TRAIT(TRAIT, TYPE, VALUE) \
|
||||
namespace tim \
|
||||
{ \
|
||||
namespace trait \
|
||||
{ \
|
||||
template <> \
|
||||
struct TRAIT<::omnitrace::TYPE> : VALUE \
|
||||
struct TRAIT<::rocprofsys::TYPE> : VALUE \
|
||||
{}; \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace api = ::tim::api; // NOLINT
|
||||
namespace category = ::tim::category; // NOLINT
|
||||
@@ -126,9 +126,9 @@ struct construct_on_thread
|
||||
{
|
||||
int64_t index = threading::get_id();
|
||||
};
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
// same sort of functionality as python's " ".join([...])
|
||||
#if !defined(JOIN)
|
||||
# define JOIN(...) ::omnitrace::common::join(__VA_ARGS__)
|
||||
# define JOIN(...) ::rocprofsys::common::join(__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
@@ -3,4 +3,5 @@ set(component_sources)
|
||||
|
||||
set(component_headers ${CMAKE_CURRENT_LIST_DIR}/fwd.hpp)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${component_sources} ${component_headers})
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${component_sources}
|
||||
${component_headers})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -39,15 +39,15 @@
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
OMNITRACE_DECLARE_COMPONENT(roctracer)
|
||||
OMNITRACE_DECLARE_COMPONENT(rocprofiler)
|
||||
OMNITRACE_DECLARE_COMPONENT(rcclp_handle)
|
||||
OMNITRACE_DECLARE_COMPONENT(comm_data)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(roctracer)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(rocprofiler)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(rcclp_handle)
|
||||
ROCPROFSYS_DECLARE_COMPONENT(comm_data)
|
||||
|
||||
OMNITRACE_COMPONENT_ALIAS(comm_data_tracker_t,
|
||||
::tim::component::data_tracker<float, project::omnitrace>)
|
||||
ROCPROFSYS_COMPONENT_ALIAS(comm_data_tracker_t,
|
||||
::tim::component::data_tracker<float, project::rocprofsys>)
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace policy = ::tim::policy; // NOLINT
|
||||
namespace comp = ::tim::component; // NOLINT
|
||||
@@ -94,161 +94,162 @@ template <typename ApiT, typename StartFuncT = default_functor_t,
|
||||
typename StopFuncT = default_functor_t>
|
||||
struct functors;
|
||||
} // namespace component
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::roctracer, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rocprofiler, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_RCCL)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, category::rocm_rccl, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_handle, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_RCCL)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, category::rocm_rccl, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::rcclp_handle, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_RCCL) && !defined(OMNITRACE_USE_MPI)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data_tracker_t, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data, false_type)
|
||||
#if !defined(ROCPROFSYS_USE_RCCL) && !defined(ROCPROFSYS_USE_MPI)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data_tracker_t, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::comm_data, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(TIMEMORY_USE_LIBUNWIND)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, category::sampling, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_metrics, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_timestamp, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_wall_clock, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_cpu_clock, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_percent, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, category::sampling, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_metrics, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::backtrace_timestamp, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_wall_clock, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_cpu_clock, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_percent, false_type)
|
||||
#endif
|
||||
|
||||
#if !defined(TIMEMORY_USE_LIBUNWIND) || !defined(OMNITRACE_USE_ROCM_SMI)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_busy, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_temp, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_power, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_memory, false_type)
|
||||
#if !defined(TIMEMORY_USE_LIBUNWIND) || !defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_busy, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_temp, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_power, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_available, component::sampling_gpu_memory, false_type)
|
||||
#endif
|
||||
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::roctracer, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::roctracer, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::external)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::rocprofiler, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::rocprofiler, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::external, category::hardware_counter)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_wall_clock, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_wall_clock,
|
||||
project::rocprofsys, category::timing, os::supports_unix,
|
||||
category::sampling, category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_cpu_clock, project::rocprofsys,
|
||||
category::timing, os::supports_unix, category::sampling,
|
||||
category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_cpu_clock, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_percent, project::rocprofsys,
|
||||
category::timing, os::supports_unix, category::sampling,
|
||||
category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_percent, project::omnitrace,
|
||||
category::timing, os::supports_unix, category::sampling,
|
||||
category::interrupt_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_busy, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_busy, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::sampling, category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_memory, project::omnitrace,
|
||||
tpls::rocm, device::gpu, os::supports_linux, category::memory,
|
||||
category::sampling, category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_power, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_memory,
|
||||
project::rocprofsys, tpls::rocm, device::gpu,
|
||||
os::supports_linux, category::memory, category::sampling,
|
||||
category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_power, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux, category::power,
|
||||
category::sampling, category::process_sampling)
|
||||
TIMEMORY_SET_COMPONENT_API(omnitrace::component::sampling_gpu_temp, project::omnitrace,
|
||||
TIMEMORY_SET_COMPONENT_API(rocprofsys::component::sampling_gpu_temp, project::rocprofsys,
|
||||
tpls::rocm, device::gpu, os::supports_linux,
|
||||
category::temperature, category::sampling,
|
||||
category::process_sampling)
|
||||
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::roctracer, "roctracer",
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::roctracer, "roctracer",
|
||||
"High-precision ROCm API and kernel tracing", "")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::rocprofiler, "rocprofiler",
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::rocprofiler, "rocprofiler",
|
||||
"ROCm kernel hardware counters", "")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_wall_clock,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_wall_clock,
|
||||
"sampling_wall_clock", "Wall-clock timing",
|
||||
"Derived from statistical sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_cpu_clock,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_cpu_clock,
|
||||
"sampling_cpu_clock", "CPU-clock timing",
|
||||
"Derived from statistical sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_percent,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_percent,
|
||||
"sampling_percent",
|
||||
"Fraction of wall-clock time spent in functions",
|
||||
"Derived from statistical sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_busy,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_busy,
|
||||
"sampling_gpu_busy",
|
||||
"GPU Utilization (% busy) via ROCm-SMI",
|
||||
"Derived from sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_memory,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_memory,
|
||||
"sampling_gpu_memory_usage",
|
||||
"GPU Memory Usage via ROCm-SMI", "Derived from sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_power,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_power,
|
||||
"sampling_gpu_power", "GPU Power Usage via ROCm-SMI",
|
||||
"Derived from sampling")
|
||||
TIMEMORY_METADATA_SPECIALIZATION(omnitrace::component::sampling_gpu_temp,
|
||||
TIMEMORY_METADATA_SPECIALIZATION(rocprofsys::component::sampling_gpu_temp,
|
||||
"sampling_gpu_temp", "GPU Temperature via ROCm-SMI",
|
||||
"Derived from sampling")
|
||||
|
||||
// statistics type
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_wall_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_cpu_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_busy, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_temp, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_power, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::sampling_gpu_memory, double)
|
||||
TIMEMORY_STATISTICS_TYPE(omnitrace::component::comm_data_tracker_t, float)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_wall_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_cpu_clock, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_busy, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_temp, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_power, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::sampling_gpu_memory, double)
|
||||
TIMEMORY_STATISTICS_TYPE(rocprofsys::component::comm_data_tracker_t, float)
|
||||
|
||||
// enable timing units
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_wall_clock,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_percent,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_wall_clock,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_wall_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_timing_category, component::sampling_percent,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_wall_clock,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_timing_units, component::sampling_cpu_clock,
|
||||
true_type)
|
||||
|
||||
// enable percent units
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_gpu_busy,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_percent,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_gpu_busy,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_percent_units, component::sampling_percent,
|
||||
true_type)
|
||||
|
||||
// enable memory units
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_memory_category, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_memory_units, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(is_memory_category, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(uses_memory_units, component::sampling_gpu_memory,
|
||||
true_type)
|
||||
|
||||
// reporting categories (sum)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_busy, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_temp, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_power, false_type)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_memory, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_busy, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_temp, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_power, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_sum, component::sampling_gpu_memory, false_type)
|
||||
|
||||
// reporting categories (mean)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_mean, component::sampling_percent, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_mean, component::sampling_percent, false_type)
|
||||
|
||||
// reporting categories (stats)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_statistics, component::sampling_percent,
|
||||
false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_statistics, component::sampling_percent,
|
||||
false_type)
|
||||
|
||||
// reporting categories (self)
|
||||
OMNITRACE_DEFINE_CONCRETE_TRAIT(report_self, component::sampling_percent, false_type)
|
||||
ROCPROFSYS_DEFINE_CONCRETE_TRAIT(report_self, component::sampling_percent, false_type)
|
||||
|
||||
#define OMNITRACE_DECLARE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
#define ROCPROFSYS_DECLARE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
TIMEMORY_DECLARE_EXTERN_TEMPLATE( \
|
||||
struct tim::component::base<TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
struct tim::component::base<TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
__VA_ARGS__>) \
|
||||
TIMEMORY_DECLARE_EXTERN_OPERATIONS(TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
TIMEMORY_DECLARE_EXTERN_OPERATIONS(TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
HAS_DATA) \
|
||||
TIMEMORY_DECLARE_EXTERN_STORAGE(TIMEMORY_ESC(omnitrace::component::NAME))
|
||||
TIMEMORY_DECLARE_EXTERN_STORAGE(TIMEMORY_ESC(rocprofsys::component::NAME))
|
||||
|
||||
#define OMNITRACE_INSTANTIATE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
#define ROCPROFSYS_INSTANTIATE_EXTERN_COMPONENT(NAME, HAS_DATA, ...) \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_TEMPLATE( \
|
||||
struct tim::component::base<TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
struct tim::component::base<TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
__VA_ARGS__>) \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_OPERATIONS(TIMEMORY_ESC(omnitrace::component::NAME), \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_OPERATIONS(TIMEMORY_ESC(rocprofsys::component::NAME), \
|
||||
HAS_DATA) \
|
||||
TIMEMORY_INSTANTIATE_EXTERN_STORAGE(TIMEMORY_ESC(omnitrace::component::NAME))
|
||||
TIMEMORY_INSTANTIATE_EXTERN_STORAGE(TIMEMORY_ESC(rocprofsys::component::NAME))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,16 +31,16 @@
|
||||
#include <optional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace concepts = ::tim::concepts; // NOLINT
|
||||
|
||||
static constexpr size_t max_supported_threads = OMNITRACE_MAX_THREADS;
|
||||
static constexpr size_t max_supported_threads = ROCPROFSYS_MAX_THREADS;
|
||||
|
||||
template <typename Tp>
|
||||
struct thread_deleter;
|
||||
|
||||
// unique ptr type for omnitrace
|
||||
// unique ptr type for rocprof-sys
|
||||
template <typename Tp>
|
||||
using unique_ptr_t = std::unique_ptr<Tp, thread_deleter<Tp>>;
|
||||
|
||||
@@ -59,7 +59,7 @@ make_unique(Args&&... args)
|
||||
{
|
||||
return unique_ptr_t<Tp>{ new Tp{ std::forward<Args>(args)... } };
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
namespace tim
|
||||
{
|
||||
@@ -70,7 +70,7 @@ struct is_unique_pointer : std::false_type
|
||||
{};
|
||||
|
||||
template <typename Tp>
|
||||
struct is_unique_pointer<::omnitrace::unique_ptr_t<Tp>> : std::true_type
|
||||
struct is_unique_pointer<::rocprofsys::unique_ptr_t<Tp>> : std::true_type
|
||||
{};
|
||||
|
||||
template <typename Tp>
|
||||
|
||||
ファイル差分が大きすぎるため省略します
差分を読み込み
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
//
|
||||
// Initialization routines
|
||||
@@ -49,7 +49,7 @@ using signal_handler_t = void (*)(void);
|
||||
signal_handler_t set_signal_handler(signal_handler_t);
|
||||
|
||||
bool
|
||||
settings_are_configured() OMNITRACE_HOT;
|
||||
settings_are_configured() ROCPROFSYS_HOT;
|
||||
|
||||
void
|
||||
configure_settings(bool _init = true);
|
||||
@@ -156,10 +156,10 @@ bool&
|
||||
is_binary_rewrite();
|
||||
|
||||
bool
|
||||
get_is_continuous_integration() OMNITRACE_HOT;
|
||||
get_is_continuous_integration() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_env() OMNITRACE_HOT;
|
||||
get_debug_env() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_init();
|
||||
@@ -168,49 +168,49 @@ bool
|
||||
get_debug_finalize();
|
||||
|
||||
bool
|
||||
get_debug() OMNITRACE_HOT;
|
||||
get_debug() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_sampling() OMNITRACE_HOT;
|
||||
get_debug_sampling() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_tid() OMNITRACE_HOT;
|
||||
get_debug_tid() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_pid() OMNITRACE_HOT;
|
||||
get_debug_pid() ROCPROFSYS_HOT;
|
||||
|
||||
int
|
||||
get_verbose_env() OMNITRACE_HOT;
|
||||
get_verbose_env() ROCPROFSYS_HOT;
|
||||
|
||||
int
|
||||
get_verbose() OMNITRACE_HOT;
|
||||
get_verbose() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_perfetto() OMNITRACE_HOT;
|
||||
get_use_perfetto() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_timemory() OMNITRACE_HOT;
|
||||
get_use_timemory() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_causal() OMNITRACE_HOT;
|
||||
get_use_causal() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_roctracer() OMNITRACE_HOT;
|
||||
get_use_roctracer() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_rocprofiler() OMNITRACE_HOT;
|
||||
get_use_rocprofiler() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_rocm_smi() OMNITRACE_HOT;
|
||||
get_use_rocm_smi() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_use_roctx();
|
||||
|
||||
bool&
|
||||
get_use_sampling() OMNITRACE_HOT;
|
||||
get_use_sampling() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_process_sampling() OMNITRACE_HOT;
|
||||
get_use_process_sampling() ROCPROFSYS_HOT;
|
||||
|
||||
bool&
|
||||
get_use_pid();
|
||||
@@ -267,7 +267,7 @@ std::set<std::string>
|
||||
get_disabled_categories();
|
||||
|
||||
bool
|
||||
get_perfetto_annotations() OMNITRACE_HOT;
|
||||
get_perfetto_annotations() ROCPROFSYS_HOT;
|
||||
|
||||
uint64_t
|
||||
get_thread_pool_size();
|
||||
@@ -278,12 +278,12 @@ get_trace_hsa_api_types();
|
||||
std::string&
|
||||
get_perfetto_backend();
|
||||
|
||||
// make this visible so omnitrace-avail can call it
|
||||
// make this visible so rocprof-sys-avail can call it
|
||||
std::string
|
||||
get_perfetto_output_filename();
|
||||
|
||||
bool
|
||||
get_perfetto_roctracer_per_stream() OMNITRACE_HOT;
|
||||
get_perfetto_roctracer_per_stream() ROCPROFSYS_HOT;
|
||||
|
||||
double
|
||||
get_trace_delay();
|
||||
@@ -424,4 +424,4 @@ get_causal_source_exclude();
|
||||
std::vector<std::string>
|
||||
get_causal_function_exclude();
|
||||
} // namespace config
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <thread>
|
||||
#include <type_traits>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace constraint
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace units = ::tim::units;
|
||||
using clock_type = std::chrono::high_resolution_clock;
|
||||
using duration_type = std::chrono::duration<double, std::nano>;
|
||||
|
||||
#define OMNITRACE_CLOCK_IDENTIFIER(VAL) \
|
||||
#define ROCPROFSYS_CLOCK_IDENTIFIER(VAL) \
|
||||
clock_identifier { #VAL, VAL }
|
||||
|
||||
auto
|
||||
@@ -63,13 +63,13 @@ clock_name(std::string _v)
|
||||
}
|
||||
|
||||
auto accepted_clock_ids =
|
||||
std::set<clock_identifier>{ OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
OMNITRACE_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) };
|
||||
std::set<clock_identifier>{ ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_PROCESS_CPUTIME_ID),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_RAW),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_REALTIME_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_MONOTONIC_COARSE),
|
||||
ROCPROFSYS_CLOCK_IDENTIFIER(CLOCK_BOOTTIME) };
|
||||
|
||||
template <typename Tp>
|
||||
clock_identifier
|
||||
@@ -101,9 +101,9 @@ find_clock_identifier(const Tp& _v)
|
||||
}
|
||||
}
|
||||
|
||||
OMNITRACE_THROW("Unknown clock id %s: %s. Valid choices: %s\n", _descript,
|
||||
timemory::join::join("", _v).c_str(),
|
||||
timemory::join::join("", accepted_clock_ids).c_str());
|
||||
ROCPROFSYS_THROW("Unknown clock id %s: %s. Valid choices: %s\n", _descript,
|
||||
timemory::join::join("", _v).c_str(),
|
||||
timemory::join::join("", accepted_clock_ids).c_str());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -232,10 +232,10 @@ spec::spec(const std::string& _clock_id, double _delay, double _dur, uint64_t _n
|
||||
{}
|
||||
|
||||
spec::spec(const std::string& _line)
|
||||
: spec{ config::get_setting_value<std::string>("OMNITRACE_TRACE_PERIOD_CLOCK_ID")
|
||||
: spec{ config::get_setting_value<std::string>("ROCPROFSYS_TRACE_PERIOD_CLOCK_ID")
|
||||
.value_or("CLOCK_REALTIME"),
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DELAY").value_or(0.0),
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DURATION").value_or(0.0) }
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DELAY").value_or(0.0),
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DURATION").value_or(0.0) }
|
||||
{
|
||||
auto _delim = tim::delimit(_line, ":");
|
||||
if(!_delim.empty()) delay = utility::convert<double>(_delim.at(0));
|
||||
@@ -266,11 +266,11 @@ spec::operator()(const stages& _stages) const
|
||||
return _ret;
|
||||
};
|
||||
|
||||
OMNITRACE_VERBOSE(2,
|
||||
"Executing constraint spec %lu of %lu :: delay: %6.3f, "
|
||||
"duration: %6.3f, clock: %s\n",
|
||||
i, _spec.repeat, _spec.delay, _spec.duration,
|
||||
_spec.clock_id.as_string().c_str());
|
||||
ROCPROFSYS_VERBOSE(2,
|
||||
"Executing constraint spec %lu of %lu :: delay: %6.3f, "
|
||||
"duration: %6.3f, clock: %s\n",
|
||||
i, _spec.repeat, _spec.delay, _spec.duration,
|
||||
_spec.clock_id.as_string().c_str());
|
||||
|
||||
if(_stages.init(_spec) && _wait(_stages.wait, _spec.delay) &&
|
||||
_stages.start(_spec) && _wait(_stages.collect, _spec.duration) &&
|
||||
@@ -302,11 +302,11 @@ get_trace_specs()
|
||||
|
||||
{
|
||||
auto _delay_v =
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DELAY").value_or(0.0);
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DELAY").value_or(0.0);
|
||||
auto _duration_v =
|
||||
config::get_setting_value<double>("OMNITRACE_TRACE_DURATION").value_or(0.0);
|
||||
config::get_setting_value<double>("ROCPROFSYS_TRACE_DURATION").value_or(0.0);
|
||||
auto _clock_v = find_clock_identifier(
|
||||
config::get_setting_value<std::string>("OMNITRACE_TRACE_PERIOD_CLOCK_ID")
|
||||
config::get_setting_value<std::string>("ROCPROFSYS_TRACE_PERIOD_CLOCK_ID")
|
||||
.value_or("CLOCK_REALTIME"));
|
||||
|
||||
if(_delay_v > 0.0 || _duration_v > 0.0)
|
||||
@@ -317,7 +317,7 @@ get_trace_specs()
|
||||
|
||||
{
|
||||
auto _periods_v =
|
||||
config::get_setting_value<std::string>("OMNITRACE_TRACE_PERIODS")
|
||||
config::get_setting_value<std::string>("ROCPROFSYS_TRACE_PERIODS")
|
||||
.value_or("");
|
||||
if(!_periods_v.empty())
|
||||
{
|
||||
@@ -349,4 +349,4 @@ get_trace_stages()
|
||||
return _v;
|
||||
}
|
||||
} // namespace constraint
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace constraint
|
||||
{
|
||||
@@ -51,7 +51,7 @@ struct stages
|
||||
|
||||
stages();
|
||||
|
||||
OMNITRACE_DEFAULT_COPY_MOVE(stages)
|
||||
ROCPROFSYS_DEFAULT_COPY_MOVE(stages)
|
||||
|
||||
functor_t init = [](const spec&) { return true; };
|
||||
functor_t wait = [](const spec&) { return true; };
|
||||
@@ -69,7 +69,7 @@ struct clock_identifier
|
||||
clock_identifier();
|
||||
clock_identifier(std::string_view, int);
|
||||
|
||||
OMNITRACE_DEFAULT_COPY_MOVE(clock_identifier)
|
||||
ROCPROFSYS_DEFAULT_COPY_MOVE(clock_identifier)
|
||||
|
||||
std::string as_string() const;
|
||||
|
||||
@@ -91,7 +91,7 @@ struct spec
|
||||
spec(const std::string&, double, double, uint64_t = 0, uint64_t = 1);
|
||||
spec(const std::string&);
|
||||
|
||||
OMNITRACE_DEFAULT_COPY_MOVE(spec)
|
||||
ROCPROFSYS_DEFAULT_COPY_MOVE(spec)
|
||||
|
||||
void operator()(const stages&) const;
|
||||
|
||||
@@ -111,4 +111,4 @@ get_trace_specs();
|
||||
stages
|
||||
get_trace_stages();
|
||||
} // namespace constraint
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -8,4 +8,5 @@ set(containers_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/stable_vector.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/static_vector.hpp)
|
||||
|
||||
target_sources(omnitrace-core-library PRIVATE ${containers_sources} ${containers_headers})
|
||||
target_sources(rocprofiler-systems-core-library PRIVATE ${containers_sources}
|
||||
${containers_headers})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,21 +32,21 @@
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
#if !defined(OMNITRACE_CACHELINE_SIZE)
|
||||
#if !defined(ROCPROFSYS_CACHELINE_SIZE)
|
||||
# ifdef __cpp_lib_hardware_interference_size
|
||||
# define OMNITRACE_CACHELINE_SIZE std::hardware_destructive_interference_size
|
||||
# define ROCPROFSYS_CACHELINE_SIZE std::hardware_destructive_interference_size
|
||||
# else
|
||||
// 64 bytes on x86-64 │ L1_CACHE_BYTES │ L1_CACHE_SHIFT │ __cacheline_aligned │ ...
|
||||
# define OMNITRACE_CACHELINE_SIZE 64
|
||||
# define ROCPROFSYS_CACHELINE_SIZE 64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
constexpr std::size_t cacheline_align_v =
|
||||
std::max<size_t>(OMNITRACE_CACHELINE_SIZE, OMNITRACE_CACHELINE_SIZE_MIN);
|
||||
std::max<size_t>(ROCPROFSYS_CACHELINE_SIZE, ROCPROFSYS_CACHELINE_SIZE_MIN);
|
||||
|
||||
template <typename Tp, size_t N, size_t AlignN = cacheline_align_v,
|
||||
bool AtomicSizeV = false>
|
||||
@@ -228,7 +228,7 @@ aligned_static_vector<Tp, N, AlignN, AtomicSizeV>&
|
||||
aligned_static_vector<Tp, N, AlignN, AtomicSizeV>::operator=(
|
||||
std::initializer_list<Tp>&& _v)
|
||||
{
|
||||
if(OMNITRACE_UNLIKELY(_v.size() > N))
|
||||
if(ROCPROFSYS_UNLIKELY(_v.size() > N))
|
||||
{
|
||||
throw exception<std::out_of_range>(
|
||||
std::string{ "aligned_static_vector::operator=(initializer_list) size > " } +
|
||||
@@ -323,4 +323,4 @@ aligned_static_vector<Tp, N, AlignN, AtomicSizeV>::emplace_back(Args&&... _v)
|
||||
}
|
||||
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
@@ -62,7 +62,7 @@ struct c_array
|
||||
Tp& at(size_t i)
|
||||
{
|
||||
if(i < m_size) return m_base[i];
|
||||
throw ::omnitrace::exception<std::out_of_range>(
|
||||
throw ::rocprofsys::exception<std::out_of_range>(
|
||||
std::string{ typeid(*this).name() } + std::to_string(i) + " exceeds size " +
|
||||
std::to_string(m_size));
|
||||
}
|
||||
@@ -71,7 +71,7 @@ struct c_array
|
||||
const Tp& at(size_t i) const
|
||||
{
|
||||
if(i < m_size) return m_base[i];
|
||||
throw ::omnitrace::exception<std::out_of_range>(
|
||||
throw ::rocprofsys::exception<std::out_of_range>(
|
||||
std::string{ typeid(*this).name() } + std::to_string(i) + " exceeds size " +
|
||||
std::to_string(m_size));
|
||||
}
|
||||
@@ -137,4 +137,4 @@ wrap_c_array(Tp* base, size_t size)
|
||||
return c_array<Tp>(base, size);
|
||||
}
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,30 +27,30 @@
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
|
||||
#define OMNITRACE_IMPORT_TEMPLATE2(template_name)
|
||||
#define OMNITRACE_IMPORT_TEMPLATE1(template_name)
|
||||
#define ROCPROFSYS_IMPORT_TEMPLATE2(template_name)
|
||||
#define ROCPROFSYS_IMPORT_TEMPLATE1(template_name)
|
||||
|
||||
// Import a 2-type-argument operator template into boost (if necessary) and
|
||||
// provide a specialization of 'is_chained_base<>' for it.
|
||||
#define OMNITRACE_OPERATOR_TEMPLATE2(template_name2) \
|
||||
OMNITRACE_IMPORT_TEMPLATE2(template_name2) \
|
||||
#define ROCPROFSYS_OPERATOR_TEMPLATE2(template_name2) \
|
||||
ROCPROFSYS_IMPORT_TEMPLATE2(template_name2) \
|
||||
template <typename T, typename U, typename B> \
|
||||
struct is_chained_base<::omnitrace::container::template_name2<T, U, B>> \
|
||||
struct is_chained_base<::rocprofsys::container::template_name2<T, U, B>> \
|
||||
{ \
|
||||
using value = ::omnitrace::container::true_t; \
|
||||
using value = ::rocprofsys::container::true_t; \
|
||||
};
|
||||
|
||||
// Import a 1-type-argument operator template into boost (if necessary) and
|
||||
// provide a specialization of 'is_chained_base<>' for it.
|
||||
#define OMNITRACE_OPERATOR_TEMPLATE1(template_name1) \
|
||||
OMNITRACE_IMPORT_TEMPLATE1(template_name1) \
|
||||
#define ROCPROFSYS_OPERATOR_TEMPLATE1(template_name1) \
|
||||
ROCPROFSYS_IMPORT_TEMPLATE1(template_name1) \
|
||||
template <typename T, typename B> \
|
||||
struct is_chained_base<::omnitrace::container::template_name1<T, B>> \
|
||||
struct is_chained_base<::rocprofsys::container::template_name1<T, B>> \
|
||||
{ \
|
||||
using value = ::omnitrace::container::true_t; \
|
||||
using value = ::rocprofsys::container::true_t; \
|
||||
};
|
||||
|
||||
#define OMNITRACE_OPERATOR_TEMPLATE(template_name) \
|
||||
#define ROCPROFSYS_OPERATOR_TEMPLATE(template_name) \
|
||||
template <typename T, typename U = T, typename B = empty_base<T>, \
|
||||
typename O = typename is_chained_base<U>::value> \
|
||||
struct template_name; \
|
||||
@@ -74,13 +74,13 @@
|
||||
template <typename T, typename U, typename B, typename O> \
|
||||
struct is_chained_base<template_name<T, U, B, O>> \
|
||||
{ \
|
||||
using value = ::omnitrace::container::true_t; \
|
||||
using value = ::rocprofsys::container::true_t; \
|
||||
}; \
|
||||
\
|
||||
OMNITRACE_OPERATOR_TEMPLATE2(template_name##2) \
|
||||
OMNITRACE_OPERATOR_TEMPLATE1(template_name##1)
|
||||
ROCPROFSYS_OPERATOR_TEMPLATE2(template_name##2) \
|
||||
ROCPROFSYS_OPERATOR_TEMPLATE1(template_name##1)
|
||||
|
||||
#define OMNITRACE_BINARY_OPERATOR_COMMUTATIVE(NAME, OP) \
|
||||
#define ROCPROFSYS_BINARY_OPERATOR_COMMUTATIVE(NAME, OP) \
|
||||
template <typename T, typename U, typename B = empty_base<T>> \
|
||||
struct NAME##2 \
|
||||
: B{ friend T operator OP(T lhs, const U& rhs){ return lhs OP## = rhs; \
|
||||
@@ -96,7 +96,7 @@
|
||||
} \
|
||||
;
|
||||
|
||||
#define OMNITRACE_BINARY_OPERATOR_NON_COMMUTATIVE(NAME, OP) \
|
||||
#define ROCPROFSYS_BINARY_OPERATOR_NON_COMMUTATIVE(NAME, OP) \
|
||||
template <typename T, typename U, typename B = empty_base<T>> \
|
||||
struct NAME##2 \
|
||||
: B{ friend T operator OP(T lhs, const U& rhs){ return lhs OP## = rhs; \
|
||||
@@ -104,7 +104,7 @@
|
||||
} \
|
||||
;
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
@@ -124,10 +124,10 @@ struct is_chained_base
|
||||
using value = true_t;
|
||||
};
|
||||
|
||||
OMNITRACE_BINARY_OPERATOR_COMMUTATIVE(addable, +)
|
||||
OMNITRACE_BINARY_OPERATOR_NON_COMMUTATIVE(subtractable, -)
|
||||
ROCPROFSYS_BINARY_OPERATOR_COMMUTATIVE(addable, +)
|
||||
ROCPROFSYS_BINARY_OPERATOR_NON_COMMUTATIVE(subtractable, -)
|
||||
|
||||
OMNITRACE_OPERATOR_TEMPLATE(addable)
|
||||
ROCPROFSYS_OPERATOR_TEMPLATE(addable)
|
||||
|
||||
template <typename T, typename B = empty_base<T>>
|
||||
struct incrementable : B
|
||||
@@ -237,4 +237,4 @@ struct random_access_iterator_helper
|
||||
friend D requires_difference_operator(const T& x, const T& y) { return x - y; }
|
||||
}; // random_access_iterator_helper
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -34,11 +34,11 @@
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
template <typename Tp, size_t ChunkSizeV = OMNITRACE_MAX_THREADS,
|
||||
template <typename Tp, size_t ChunkSizeV = ROCPROFSYS_MAX_THREADS,
|
||||
size_t AlignN = alignof(Tp)>
|
||||
class stable_vector
|
||||
{
|
||||
@@ -299,7 +299,7 @@ template <typename Tp, size_t ChunkSizeV, size_t AlignN>
|
||||
typename stable_vector<Tp, ChunkSizeV, AlignN>::chunk_type&
|
||||
stable_vector<Tp, ChunkSizeV, AlignN>::last_chunk()
|
||||
{
|
||||
if(OMNITRACE_UNLIKELY(m_chunks.empty() || m_chunks.back()->size() == ChunkSizeV))
|
||||
if(ROCPROFSYS_UNLIKELY(m_chunks.empty() || m_chunks.back()->size() == ChunkSizeV))
|
||||
{
|
||||
add_chunk();
|
||||
}
|
||||
@@ -358,9 +358,9 @@ template <typename Tp, size_t ChunkSizeV, size_t AlignN>
|
||||
typename stable_vector<Tp, ChunkSizeV, AlignN>::reference
|
||||
stable_vector<Tp, ChunkSizeV, AlignN>::at(size_type i)
|
||||
{
|
||||
if(OMNITRACE_UNLIKELY(i >= size()))
|
||||
if(ROCPROFSYS_UNLIKELY(i >= size()))
|
||||
{
|
||||
throw ::omnitrace::exception<std::out_of_range>(
|
||||
throw ::rocprofsys::exception<std::out_of_range>(
|
||||
"stable_vector::at(" + std::to_string(i) + "). size is " +
|
||||
std::to_string(size()));
|
||||
}
|
||||
@@ -387,4 +387,4 @@ resize(stable_vector<Tp, ChunkSizeV, AlignN>& _v, size_t _n, Args&&... args)
|
||||
return _v.size();
|
||||
}
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace container
|
||||
{
|
||||
@@ -147,7 +147,7 @@ template <typename Tp, size_t N, bool AtomicSizeV>
|
||||
static_vector<Tp, N, AtomicSizeV>&
|
||||
static_vector<Tp, N, AtomicSizeV>::operator=(std::initializer_list<Tp>&& _v)
|
||||
{
|
||||
if(OMNITRACE_UNLIKELY(_v.size() > N))
|
||||
if(ROCPROFSYS_UNLIKELY(_v.size() > N))
|
||||
{
|
||||
throw exception<std::out_of_range>(
|
||||
std::string{ "static_vector::operator=(initializer_list) size > " } +
|
||||
@@ -227,4 +227,4 @@ static_vector<Tp, N, AtomicSizeV>::update_size(size_t _n)
|
||||
m_size = _n;
|
||||
}
|
||||
} // namespace container
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace debug
|
||||
{
|
||||
@@ -48,7 +48,7 @@ struct source_location_history
|
||||
const std::string&
|
||||
get_file_name()
|
||||
{
|
||||
static auto _fname = tim::get_env<std::string>("OMNITRACE_LOG_FILE", "");
|
||||
static auto _fname = tim::get_env<std::string>("ROCPROFSYS_LOG_FILE", "");
|
||||
return _fname;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ close_file()
|
||||
fclose(_file);
|
||||
// Write the trace into a file.
|
||||
if(get_verbose() >= 0)
|
||||
operation::file_output_message<tim::project::omnitrace>{}(
|
||||
operation::file_output_message<tim::project::rocprofsys>{}(
|
||||
get_file_name(), std::string{ "debug" });
|
||||
}
|
||||
}
|
||||
@@ -164,4 +164,4 @@ template std::string as_hex<int64_t>(int64_t, size_t);
|
||||
template std::string as_hex<uint64_t>(uint64_t, size_t);
|
||||
template std::string
|
||||
as_hex<void*>(void*, size_t);
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -43,30 +43,30 @@
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace config
|
||||
{
|
||||
bool
|
||||
get_debug() OMNITRACE_HOT;
|
||||
get_debug() ROCPROFSYS_HOT;
|
||||
|
||||
int
|
||||
get_verbose() OMNITRACE_HOT;
|
||||
get_verbose() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_env() OMNITRACE_HOT;
|
||||
get_debug_env() ROCPROFSYS_HOT;
|
||||
|
||||
int
|
||||
get_verbose_env() OMNITRACE_HOT;
|
||||
get_verbose_env() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_is_continuous_integration() OMNITRACE_HOT;
|
||||
get_is_continuous_integration() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_tid() OMNITRACE_HOT;
|
||||
get_debug_tid() ROCPROFSYS_HOT;
|
||||
|
||||
bool
|
||||
get_debug_pid() OMNITRACE_HOT;
|
||||
get_debug_pid() ROCPROFSYS_HOT;
|
||||
} // namespace config
|
||||
|
||||
namespace debug
|
||||
@@ -96,8 +96,8 @@ flush()
|
||||
fprintf(stdout, "%s", ::tim::log::color::end());
|
||||
fflush(stdout);
|
||||
std::cout << ::tim::log::color::end() << std::flush;
|
||||
fprintf(::omnitrace::debug::get_file(), "%s", ::tim::log::color::end());
|
||||
fflush(::omnitrace::debug::get_file());
|
||||
fprintf(::rocprofsys::debug::get_file(), "%s", ::tim::log::color::end());
|
||||
fflush(::rocprofsys::debug::get_file());
|
||||
std::cerr << ::tim::log::color::end() << std::flush;
|
||||
}
|
||||
//
|
||||
@@ -152,58 +152,58 @@ extern template std::string as_hex<int64_t>(int64_t, size_t);
|
||||
extern template std::string as_hex<uint64_t>(uint64_t, size_t);
|
||||
extern template std::string
|
||||
as_hex<void*>(void*, size_t);
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
#if !defined(OMNITRACE_DEBUG_BUFFER_LEN)
|
||||
# define OMNITRACE_DEBUG_BUFFER_LEN 1024
|
||||
#if !defined(ROCPROFSYS_DEBUG_BUFFER_LEN)
|
||||
# define ROCPROFSYS_DEBUG_BUFFER_LEN 1024
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_DEBUG_PROCESS_IDENTIFIER)
|
||||
#if !defined(ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER)
|
||||
# if defined(TIMEMORY_USE_MPI)
|
||||
# define OMNITRACE_DEBUG_PROCESS_IDENTIFIER static_cast<int>(::tim::dmp::rank())
|
||||
# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER static_cast<int>(::tim::dmp::rank())
|
||||
# elif defined(TIMEMORY_USE_MPI_HEADERS)
|
||||
# define OMNITRACE_DEBUG_PROCESS_IDENTIFIER \
|
||||
# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER \
|
||||
(::tim::dmp::is_initialized()) ? static_cast<int>(::tim::dmp::rank()) \
|
||||
: static_cast<int>(::tim::process::get_id())
|
||||
# else
|
||||
# define OMNITRACE_DEBUG_PROCESS_IDENTIFIER \
|
||||
# define ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER \
|
||||
static_cast<int>(::tim::process::get_id())
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_DEBUG_THREAD_IDENTIFIER)
|
||||
# define OMNITRACE_DEBUG_THREAD_IDENTIFIER ::omnitrace::debug::get_tid()
|
||||
#if !defined(ROCPROFSYS_DEBUG_THREAD_IDENTIFIER)
|
||||
# define ROCPROFSYS_DEBUG_THREAD_IDENTIFIER ::rocprofsys::debug::get_tid()
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_SOURCE_LOCATION)
|
||||
# define OMNITRACE_SOURCE_LOCATION \
|
||||
::omnitrace::debug::source_location { __PRETTY_FUNCTION__, __FILE__, __LINE__ }
|
||||
#if !defined(ROCPROFSYS_SOURCE_LOCATION)
|
||||
# define ROCPROFSYS_SOURCE_LOCATION \
|
||||
::rocprofsys::debug::source_location { __PRETTY_FUNCTION__, __FILE__, __LINE__ }
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_RECORD_SOURCE_LOCATION)
|
||||
# define OMNITRACE_RECORD_SOURCE_LOCATION \
|
||||
::omnitrace::debug::set_source_location(OMNITRACE_SOURCE_LOCATION)
|
||||
#if !defined(ROCPROFSYS_RECORD_SOURCE_LOCATION)
|
||||
# define ROCPROFSYS_RECORD_SOURCE_LOCATION \
|
||||
::rocprofsys::debug::set_source_location(ROCPROFSYS_SOURCE_LOCATION)
|
||||
#endif
|
||||
|
||||
#if defined(__clang__) || (__GNUC__ < 9)
|
||||
# define OMNITRACE_FUNCTION \
|
||||
# define ROCPROFSYS_FUNCTION \
|
||||
std::string{ __FUNCTION__ } \
|
||||
.substr(0, std::string_view{ __FUNCTION__ }.find("_hidden")) \
|
||||
.c_str()
|
||||
# define OMNITRACE_PRETTY_FUNCTION \
|
||||
# define ROCPROFSYS_PRETTY_FUNCTION \
|
||||
std::string{ __PRETTY_FUNCTION__ } \
|
||||
.substr(0, std::string_view{ __PRETTY_FUNCTION__ }.find("_hidden")) \
|
||||
.c_str()
|
||||
#else
|
||||
# define OMNITRACE_FUNCTION \
|
||||
::omnitrace::debug::get_chars( \
|
||||
# define ROCPROFSYS_FUNCTION \
|
||||
::rocprofsys::debug::get_chars( \
|
||||
std::string_view{ __FUNCTION__ }, \
|
||||
std::make_index_sequence<std::min( \
|
||||
std::string_view{ __FUNCTION__ }.find("_hidden"), \
|
||||
std::string_view{ __FUNCTION__ }.length())>{}) \
|
||||
.data()
|
||||
# define OMNITRACE_PRETTY_FUNCTION \
|
||||
::omnitrace::debug::get_chars( \
|
||||
# define ROCPROFSYS_PRETTY_FUNCTION \
|
||||
::rocprofsys::debug::get_chars( \
|
||||
std::string_view{ __PRETTY_FUNCTION__ }, \
|
||||
std::make_index_sequence<std::min( \
|
||||
std::string_view{ __PRETTY_FUNCTION__ }.find("_hidden"), \
|
||||
@@ -213,331 +213,332 @@ as_hex<void*>(void*, size_t);
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_FPRINTF_STDERR_COLOR(COLOR) \
|
||||
fprintf(::omnitrace::debug::get_file(), "%s", ::tim::log::color::COLOR())
|
||||
#define ROCPROFSYS_FPRINTF_STDERR_COLOR(COLOR) \
|
||||
fprintf(::rocprofsys::debug::get_file(), "%s", ::tim::log::color::COLOR())
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_PRINT_COLOR(COLOR, COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_PRINT_COLOR(COLOR, COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(COLOR); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(COLOR); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_PRINT_COLOR_F(COLOR, COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_PRINT_COLOR_F(COLOR, COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(COLOR); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(COLOR); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_PRINT_COLOR(COLOR, ...) \
|
||||
OMNITRACE_CONDITIONAL_PRINT_COLOR(COLOR, true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_PRINT_COLOR(COLOR, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_PRINT_COLOR(COLOR, true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_PRINT_COLOR_F(COLOR, ...) \
|
||||
OMNITRACE_CONDITIONAL_PRINT_COLOR_F(COLOR, true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_PRINT_COLOR_F(COLOR, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_PRINT_COLOR_F(COLOR, true, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_PRINT(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_PRINT(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_PRINT(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_PRINT(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_PRINT_F(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_PRINT_F(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_PRINT_F(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(info); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_WARN(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_WARN(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_WARN(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_WARN(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_WARN_F(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_WARN_F(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_WARN_F(COND, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND) && ::omnitrace::config::get_debug_tid() && \
|
||||
::omnitrace::config::get_debug_pid())) \
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_WARN_F(COND, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND) && ::rocprofsys::config::get_debug_tid() && \
|
||||
::rocprofsys::config::get_debug_pid())) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::debug::lock _debug_lk{}; \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::debug::lock _debug_lk{}; \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(warning); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_THROW_E(COND, TYPE, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND))) \
|
||||
#define ROCPROFSYS_CONDITIONAL_THROW_E(COND, TYPE, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND))) \
|
||||
{ \
|
||||
char _msg_buffer[OMNITRACE_DEBUG_BUFFER_LEN]; \
|
||||
snprintf(_msg_buffer, OMNITRACE_DEBUG_BUFFER_LEN, "[omnitrace][%i][%li][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
char _msg_buffer[ROCPROFSYS_DEBUG_BUFFER_LEN]; \
|
||||
snprintf(_msg_buffer, ROCPROFSYS_DEBUG_BUFFER_LEN, \
|
||||
"[rocprof-sys][%i][%li][%s]%s", ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \
|
||||
ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
auto len = strlen(_msg_buffer); \
|
||||
snprintf(_msg_buffer + len, OMNITRACE_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \
|
||||
throw ::omnitrace::exception<TYPE>( \
|
||||
snprintf(_msg_buffer + len, ROCPROFSYS_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \
|
||||
throw ::rocprofsys::exception<TYPE>( \
|
||||
::tim::log::string(::tim::log::color::fatal(), _msg_buffer)); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_THROW_E(COND, TYPE, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND))) \
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_THROW_E(COND, TYPE, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND))) \
|
||||
{ \
|
||||
char _msg_buffer[OMNITRACE_DEBUG_BUFFER_LEN]; \
|
||||
snprintf(_msg_buffer, OMNITRACE_DEBUG_BUFFER_LEN, "[omnitrace][%i][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
char _msg_buffer[ROCPROFSYS_DEBUG_BUFFER_LEN]; \
|
||||
snprintf(_msg_buffer, ROCPROFSYS_DEBUG_BUFFER_LEN, "[rocprof-sys][%i][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
auto len = strlen(_msg_buffer); \
|
||||
snprintf(_msg_buffer + len, OMNITRACE_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \
|
||||
throw ::omnitrace::exception<TYPE>( \
|
||||
snprintf(_msg_buffer + len, ROCPROFSYS_DEBUG_BUFFER_LEN - len, __VA_ARGS__); \
|
||||
throw ::rocprofsys::exception<TYPE>( \
|
||||
::tim::log::string(::tim::log::color::fatal(), _msg_buffer)); \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CI_THROW_E(COND, TYPE, ...) \
|
||||
OMNITRACE_CONDITIONAL_THROW_E( \
|
||||
::omnitrace::get_is_continuous_integration() && (COND), TYPE, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_THROW_E(COND, TYPE, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_THROW_E( \
|
||||
::rocprofsys::get_is_continuous_integration() && (COND), TYPE, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_BASIC_THROW_E(COND, TYPE, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_THROW_E( \
|
||||
::omnitrace::get_is_continuous_integration() && (COND), TYPE, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_BASIC_THROW_E(COND, TYPE, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_THROW_E( \
|
||||
::rocprofsys::get_is_continuous_integration() && (COND), TYPE, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_THROW(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_THROW(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_THROW(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_THROW(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_THROW(COND, ...) \
|
||||
OMNITRACE_CI_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_THROW(COND, ...) \
|
||||
ROCPROFSYS_CI_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_BASIC_THROW(COND, ...) \
|
||||
OMNITRACE_CI_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_BASIC_THROW(COND, ...) \
|
||||
ROCPROFSYS_CI_BASIC_THROW_E((COND), std::runtime_error, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_FAILURE(COND, METHOD, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND))) \
|
||||
#define ROCPROFSYS_CONDITIONAL_FAILURE(COND, METHOD, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND))) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::set_state(::omnitrace::State::Finalized); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::set_state(::rocprofsys::State::Finalized); \
|
||||
timemory_print_demangled_backtrace<64>(); \
|
||||
METHOD; \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_FAILURE(COND, METHOD, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND))) \
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_FAILURE(COND, METHOD, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND))) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::set_state(::omnitrace::State::Finalized); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::set_state(::rocprofsys::State::Finalized); \
|
||||
timemory_print_demangled_backtrace<64>(); \
|
||||
METHOD; \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_FAILURE_F(COND, METHOD, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND))) \
|
||||
#define ROCPROFSYS_CONDITIONAL_FAILURE_F(COND, METHOD, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND))) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%li][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_DEBUG_THREAD_IDENTIFIER, \
|
||||
OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::set_state(::omnitrace::State::Finalized); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%li][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_DEBUG_THREAD_IDENTIFIER, \
|
||||
ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::set_state(::rocprofsys::State::Finalized); \
|
||||
timemory_print_demangled_backtrace<64>(); \
|
||||
METHOD; \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_FAILURE_F(COND, METHOD, ...) \
|
||||
if(OMNITRACE_UNLIKELY((COND))) \
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_FAILURE_F(COND, METHOD, ...) \
|
||||
if(ROCPROFSYS_UNLIKELY((COND))) \
|
||||
{ \
|
||||
::omnitrace::debug::flush(); \
|
||||
OMNITRACE_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::omnitrace::debug::get_file(), "[omnitrace][%i][%s]%s", \
|
||||
OMNITRACE_DEBUG_PROCESS_IDENTIFIER, OMNITRACE_FUNCTION, \
|
||||
::omnitrace::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::omnitrace::debug::get_file(), __VA_ARGS__); \
|
||||
::omnitrace::debug::flush(); \
|
||||
::omnitrace::set_state(::omnitrace::State::Finalized); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
ROCPROFSYS_FPRINTF_STDERR_COLOR(fatal); \
|
||||
fprintf(::rocprofsys::debug::get_file(), "[rocprof-sys][%i][%s]%s", \
|
||||
ROCPROFSYS_DEBUG_PROCESS_IDENTIFIER, ROCPROFSYS_FUNCTION, \
|
||||
::rocprofsys::debug::is_bracket(__VA_ARGS__) ? "" : " "); \
|
||||
fprintf(::rocprofsys::debug::get_file(), __VA_ARGS__); \
|
||||
::rocprofsys::debug::flush(); \
|
||||
::rocprofsys::set_state(::rocprofsys::State::Finalized); \
|
||||
timemory_print_demangled_backtrace<64>(); \
|
||||
METHOD; \
|
||||
}
|
||||
|
||||
#define OMNITRACE_CI_FAILURE(COND, METHOD, ...) \
|
||||
OMNITRACE_CONDITIONAL_FAILURE( \
|
||||
::omnitrace::get_is_continuous_integration() && (COND), METHOD, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_FAILURE(COND, METHOD, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_FAILURE( \
|
||||
::rocprofsys::get_is_continuous_integration() && (COND), METHOD, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_BASIC_FAILURE(COND, METHOD, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_FAILURE( \
|
||||
::omnitrace::get_is_continuous_integration() && (COND), METHOD, __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_BASIC_FAILURE(COND, METHOD, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_FAILURE( \
|
||||
::rocprofsys::get_is_continuous_integration() && (COND), METHOD, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_FAIL(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_FAIL(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_FAILURE(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_FAIL(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_FAIL(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_FAILURE( \
|
||||
COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_FAIL_F(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_FAILURE_F(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_FAIL_F(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_FAILURE_F(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_FAIL_F(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_FAILURE_F( \
|
||||
COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_FAIL_F(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_FAILURE_F( \
|
||||
COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_FAIL(COND, ...) \
|
||||
OMNITRACE_CI_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_FAIL(COND, ...) \
|
||||
ROCPROFSYS_CI_FAILURE(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_BASIC_FAIL(COND, ...) \
|
||||
OMNITRACE_CI_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::exit(EXIT_FAILURE)), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_BASIC_FAIL(COND, ...) \
|
||||
ROCPROFSYS_CI_BASIC_FAILURE(COND, ROCPROFSYS_ESC(::std::exit(EXIT_FAILURE)), \
|
||||
__VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_ABORT(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_ABORT(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_ABORT(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_ABORT(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_ABORT_F(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_FAILURE_F(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_ABORT_F(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_FAILURE_F(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CONDITIONAL_BASIC_ABORT_F(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_FAILURE_F(COND, OMNITRACE_ESC(::std::abort()), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_CONDITIONAL_BASIC_ABORT_F(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_FAILURE_F(COND, ROCPROFSYS_ESC(::std::abort()), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_ABORT(COND, ...) \
|
||||
OMNITRACE_CI_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_ABORT(COND, ...) \
|
||||
ROCPROFSYS_CI_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_CI_BASIC_ABORT(COND, ...) \
|
||||
OMNITRACE_CI_BASIC_FAILURE(COND, OMNITRACE_ESC(::std::abort()), __VA_ARGS__)
|
||||
#define ROCPROFSYS_CI_BASIC_ABORT(COND, ...) \
|
||||
ROCPROFSYS_CI_BASIC_FAILURE(COND, ROCPROFSYS_ESC(::std::abort()), __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -545,17 +546,17 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_DEBUG(...) \
|
||||
OMNITRACE_CONDITIONAL_PRINT(::omnitrace::get_debug(), __VA_ARGS__)
|
||||
#define ROCPROFSYS_DEBUG(...) \
|
||||
ROCPROFSYS_CONDITIONAL_PRINT(::rocprofsys::get_debug(), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_DEBUG(...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_PRINT(::omnitrace::get_debug_env(), __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_DEBUG(...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_PRINT(::rocprofsys::get_debug_env(), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_DEBUG_F(...) \
|
||||
OMNITRACE_CONDITIONAL_PRINT_F(::omnitrace::get_debug(), __VA_ARGS__)
|
||||
#define ROCPROFSYS_DEBUG_F(...) \
|
||||
ROCPROFSYS_CONDITIONAL_PRINT_F(::rocprofsys::get_debug(), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_DEBUG_F(...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_PRINT_F(::omnitrace::get_debug_env(), __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_DEBUG_F(...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(::rocprofsys::get_debug_env(), __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -563,23 +564,25 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_VERBOSE(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_PRINT( \
|
||||
::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__)
|
||||
#define ROCPROFSYS_VERBOSE(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_PRINT(::rocprofsys::get_debug() || \
|
||||
(::rocprofsys::get_verbose() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_VERBOSE(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_PRINT(::omnitrace::get_debug_env() || \
|
||||
(::omnitrace::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_VERBOSE(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_PRINT(::rocprofsys::get_debug_env() || \
|
||||
(::rocprofsys::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_VERBOSE_F(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_PRINT_F( \
|
||||
::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__)
|
||||
#define ROCPROFSYS_VERBOSE_F(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_PRINT_F(::rocprofsys::get_debug() || \
|
||||
(::rocprofsys::get_verbose() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_VERBOSE_F(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_PRINT_F(::omnitrace::get_debug_env() || \
|
||||
(::omnitrace::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_VERBOSE_F(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(::rocprofsys::get_debug_env() || \
|
||||
(::rocprofsys::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -587,49 +590,51 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_WARNING(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_WARN( \
|
||||
::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__)
|
||||
#define ROCPROFSYS_WARNING(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_WARN(::rocprofsys::get_debug() || \
|
||||
(::rocprofsys::get_verbose() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_WARNING(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_WARN(::omnitrace::get_debug_env() || \
|
||||
(::omnitrace::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_WARNING(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_WARN(::rocprofsys::get_debug_env() || \
|
||||
(::rocprofsys::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_WARNING_F(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_WARN_F( \
|
||||
::omnitrace::get_debug() || (::omnitrace::get_verbose() >= LEVEL), __VA_ARGS__)
|
||||
#define ROCPROFSYS_WARNING_F(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_WARN_F(::rocprofsys::get_debug() || \
|
||||
(::rocprofsys::get_verbose() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_WARNING_F(LEVEL, ...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_WARN_F(::omnitrace::get_debug_env() || \
|
||||
(::omnitrace::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_WARNING_F(LEVEL, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_WARN_F(::rocprofsys::get_debug_env() || \
|
||||
(::rocprofsys::get_verbose_env() >= LEVEL), \
|
||||
__VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_WARNING_IF(COND, ...) OMNITRACE_CONDITIONAL_WARN((COND), __VA_ARGS__)
|
||||
#define ROCPROFSYS_WARNING_IF(COND, ...) ROCPROFSYS_CONDITIONAL_WARN((COND), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_WARNING_IF_F(COND, ...) \
|
||||
OMNITRACE_CONDITIONAL_WARN_F((COND), __VA_ARGS__)
|
||||
#define ROCPROFSYS_WARNING_IF_F(COND, ...) \
|
||||
ROCPROFSYS_CONDITIONAL_WARN_F((COND), __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_WARNING_OR_CI_THROW(LEVEL, ...) \
|
||||
#define ROCPROFSYS_WARNING_OR_CI_THROW(LEVEL, ...) \
|
||||
{ \
|
||||
if(OMNITRACE_UNLIKELY(::omnitrace::get_is_continuous_integration())) \
|
||||
if(ROCPROFSYS_UNLIKELY(::rocprofsys::get_is_continuous_integration())) \
|
||||
{ \
|
||||
OMNITRACE_CI_THROW(true, __VA_ARGS__); \
|
||||
ROCPROFSYS_CI_THROW(true, __VA_ARGS__); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
OMNITRACE_CONDITIONAL_WARN(::omnitrace::get_debug() || \
|
||||
(::omnitrace::get_verbose() >= LEVEL), \
|
||||
__VA_ARGS__) \
|
||||
ROCPROFSYS_CONDITIONAL_WARN(::rocprofsys::get_debug() || \
|
||||
(::rocprofsys::get_verbose() >= LEVEL), \
|
||||
__VA_ARGS__) \
|
||||
} \
|
||||
}
|
||||
|
||||
#define OMNITRACE_REQUIRE(...) TIMEMORY_REQUIRE(__VA_ARGS__)
|
||||
#define OMNITRACE_PREFER(COND) \
|
||||
((OMNITRACE_LIKELY(COND)) \
|
||||
#define ROCPROFSYS_REQUIRE(...) TIMEMORY_REQUIRE(__VA_ARGS__)
|
||||
#define ROCPROFSYS_PREFER(COND) \
|
||||
((ROCPROFSYS_LIKELY(COND)) \
|
||||
? ::tim::log::base() \
|
||||
: ((::omnitrace::get_is_continuous_integration()) ? TIMEMORY_FATAL \
|
||||
: TIMEMORY_WARNING))
|
||||
: ((::rocprofsys::get_is_continuous_integration()) ? TIMEMORY_FATAL \
|
||||
: TIMEMORY_WARNING))
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -638,10 +643,10 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_BASIC_PRINT(...) OMNITRACE_CONDITIONAL_BASIC_PRINT(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_PRINT(...) ROCPROFSYS_CONDITIONAL_BASIC_PRINT(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_PRINT_F(...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_PRINT_F(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_PRINT_F(...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_PRINT_F(true, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -649,9 +654,9 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_PRINT(...) OMNITRACE_CONDITIONAL_PRINT(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_PRINT(...) ROCPROFSYS_CONDITIONAL_PRINT(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_PRINT_F(...) OMNITRACE_CONDITIONAL_PRINT_F(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_PRINT_F(...) ROCPROFSYS_CONDITIONAL_PRINT_F(true, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -659,9 +664,9 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_THROW(...) OMNITRACE_CONDITIONAL_THROW(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_THROW(...) ROCPROFSYS_CONDITIONAL_THROW(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_THROW(...) OMNITRACE_CONDITIONAL_BASIC_THROW(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_THROW(...) ROCPROFSYS_CONDITIONAL_BASIC_THROW(true, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -669,13 +674,14 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_FAIL(...) OMNITRACE_CONDITIONAL_FAIL(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_FAIL(...) ROCPROFSYS_CONDITIONAL_FAIL(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_FAIL_F(...) OMNITRACE_CONDITIONAL_FAIL_F(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_FAIL_F(...) ROCPROFSYS_CONDITIONAL_FAIL_F(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_FAIL(...) OMNITRACE_CONDITIONAL_BASIC_FAIL(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_FAIL(...) ROCPROFSYS_CONDITIONAL_BASIC_FAIL(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_FAIL_F(...) OMNITRACE_CONDITIONAL_BASIC_FAIL_F(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_FAIL_F(...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_FAIL_F(true, __VA_ARGS__)
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
@@ -683,14 +689,14 @@ as_hex<void*>(void*, size_t);
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
#define OMNITRACE_ABORT(...) OMNITRACE_CONDITIONAL_ABORT(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_ABORT(...) ROCPROFSYS_CONDITIONAL_ABORT(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_ABORT_F(...) OMNITRACE_CONDITIONAL_ABORT_F(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_ABORT_F(...) ROCPROFSYS_CONDITIONAL_ABORT_F(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_ABORT(...) OMNITRACE_CONDITIONAL_BASIC_ABORT(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_ABORT(...) ROCPROFSYS_CONDITIONAL_BASIC_ABORT(true, __VA_ARGS__)
|
||||
|
||||
#define OMNITRACE_BASIC_ABORT_F(...) \
|
||||
OMNITRACE_CONDITIONAL_BASIC_ABORT_F(true, __VA_ARGS__)
|
||||
#define ROCPROFSYS_BASIC_ABORT_F(...) \
|
||||
ROCPROFSYS_CONDITIONAL_BASIC_ABORT_F(true, __VA_ARGS__)
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
#include "common/defines.h"
|
||||
|
||||
#define OMNITRACE_METADATA(...) ::tim::manager::add_metadata(__VA_ARGS__)
|
||||
#define ROCPROFSYS_METADATA(...) ::tim::manager::add_metadata(__VA_ARGS__)
|
||||
|
||||
#if !defined(OMNITRACE_DEFAULT_OBJECT)
|
||||
# define OMNITRACE_DEFAULT_OBJECT(NAME) \
|
||||
#if !defined(ROCPROFSYS_DEFAULT_OBJECT)
|
||||
# define ROCPROFSYS_DEFAULT_OBJECT(NAME) \
|
||||
NAME() = default; \
|
||||
NAME(const NAME&) = default; \
|
||||
NAME(NAME&&) noexcept = default; \
|
||||
@@ -35,8 +35,8 @@
|
||||
NAME& operator=(NAME&&) noexcept = default;
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_DEFAULT_COPY_MOVE)
|
||||
# define OMNITRACE_DEFAULT_COPY_MOVE(NAME) \
|
||||
#if !defined(ROCPROFSYS_DEFAULT_COPY_MOVE)
|
||||
# define ROCPROFSYS_DEFAULT_COPY_MOVE(NAME) \
|
||||
NAME(const NAME&) = default; \
|
||||
NAME(NAME&&) noexcept = default; \
|
||||
NAME& operator=(const NAME&) = default; \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace procfs = ::tim::procfs;
|
||||
|
||||
@@ -100,14 +100,15 @@ dynamic_library::dynamic_library(std::string _env, std::string _fname, int _flag
|
||||
}
|
||||
else if(_env_val.find('/') == 0)
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(1,
|
||||
"Ignoring environment variable %s=\"%s\" because the "
|
||||
"filepath does not exist. Using \"%s\" instead...\n",
|
||||
envname.c_str(), _env_val.c_str(), filename.c_str())
|
||||
ROCPROFSYS_VERBOSE_F(
|
||||
1,
|
||||
"Ignoring environment variable %s=\"%s\" because the "
|
||||
"filepath does not exist. Using \"%s\" instead...\n",
|
||||
envname.c_str(), _env_val.c_str(), filename.c_str())
|
||||
}
|
||||
else if(_env_val.find('/') != 0 && filename.find('/') == 0)
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(
|
||||
ROCPROFSYS_VERBOSE_F(
|
||||
1,
|
||||
"Ignoring environment variable %s=\"%s\" because the "
|
||||
"filepath is relative. Using absolute path \"%s\" instead...\n",
|
||||
@@ -129,8 +130,8 @@ dynamic_library::open()
|
||||
handle = dlopen(filename.c_str(), flags);
|
||||
if(!handle)
|
||||
{
|
||||
OMNITRACE_VERBOSE(2, "[dynamic_library] Error opening %s=\"%s\" :: %s.\n",
|
||||
envname.c_str(), filename.c_str(), dlerror());
|
||||
ROCPROFSYS_VERBOSE(2, "[dynamic_library] Error opening %s=\"%s\" :: %s.\n",
|
||||
envname.c_str(), filename.c_str(), dlerror());
|
||||
}
|
||||
dlerror(); // Clear any existing error
|
||||
}
|
||||
@@ -149,4 +150,4 @@ dynamic_library::is_open() const
|
||||
{
|
||||
return (handle != nullptr);
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
std::string
|
||||
find_library_path(const std::string& _name, const std::vector<std::string>& _env_vars,
|
||||
@@ -77,10 +77,10 @@ dynamic_library::invoke(std::string_view _name, RetT (*&_func)(Args...), Args...
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "[omnitrace][pid=%i]> %s :: %s\n", getpid(), _name.data(),
|
||||
fprintf(stderr, "[rocprof-sys][pid=%i]> %s :: %s\n", getpid(), _name.data(),
|
||||
dlerror());
|
||||
}
|
||||
}
|
||||
return RetT{};
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <typeinfo>
|
||||
#include <variant>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace
|
||||
{
|
||||
@@ -125,4 +125,4 @@ template class exception<std::underflow_error>;
|
||||
// template class exception<std::bad_weak_ptr>;
|
||||
// template class exception<std::bad_any_cast>;
|
||||
// template class exception<std::bad_variant_access>;
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <timemory/utility/backtrace.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
template <typename Tp>
|
||||
class exception : public Tp
|
||||
@@ -50,4 +50,4 @@ public:
|
||||
private:
|
||||
char* m_what = nullptr;
|
||||
};
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,17 +22,17 @@
|
||||
|
||||
#include "common/defines.h"
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCM_SMI)
|
||||
# define OMNITRACE_USE_ROCM_SMI 0
|
||||
#if !defined(ROCPROFSYS_USE_ROCM_SMI)
|
||||
# define ROCPROFSYS_USE_ROCM_SMI 0
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_HIP)
|
||||
# define OMNITRACE_USE_HIP 0
|
||||
#if !defined(ROCPROFSYS_USE_HIP)
|
||||
# define ROCPROFSYS_USE_HIP 0
|
||||
#endif
|
||||
|
||||
#include "core/hip_runtime.hpp"
|
||||
|
||||
#if OMNITRACE_USE_HIP > 0
|
||||
#if ROCPROFSYS_USE_HIP > 0
|
||||
# if !defined(TIMEMORY_USE_HIP)
|
||||
# define TIMEMORY_USE_HIP 1
|
||||
# endif
|
||||
@@ -44,19 +44,19 @@
|
||||
|
||||
#include <timemory/manager.hpp>
|
||||
|
||||
#if OMNITRACE_USE_ROCM_SMI > 0
|
||||
#if ROCPROFSYS_USE_ROCM_SMI > 0
|
||||
# include <rocm_smi/rocm_smi.h>
|
||||
#endif
|
||||
|
||||
#if OMNITRACE_USE_HIP > 0
|
||||
#if ROCPROFSYS_USE_HIP > 0
|
||||
# include <timemory/components/hip/backends.hpp>
|
||||
|
||||
# if !defined(OMNITRACE_HIP_RUNTIME_CALL)
|
||||
# define OMNITRACE_HIP_RUNTIME_CALL(err) \
|
||||
# if !defined(ROCPROFSYS_HIP_RUNTIME_CALL)
|
||||
# define ROCPROFSYS_HIP_RUNTIME_CALL(err) \
|
||||
{ \
|
||||
if(err != ::tim::hip::success_v && (int) err != 0) \
|
||||
{ \
|
||||
OMNITRACE_THROW( \
|
||||
ROCPROFSYS_THROW( \
|
||||
"[%s:%d] Warning! HIP API call failed with code %i :: %s\n", \
|
||||
__FILE__, __LINE__, (int) err, hipGetErrorString(err)); \
|
||||
} \
|
||||
@@ -64,7 +64,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace gpu
|
||||
{
|
||||
@@ -72,9 +72,9 @@ namespace
|
||||
{
|
||||
namespace scope = ::tim::scope;
|
||||
|
||||
#if OMNITRACE_USE_ROCM_SMI > 0
|
||||
# define OMNITRACE_ROCM_SMI_CALL(ERROR_CODE) \
|
||||
::omnitrace::gpu::check_rsmi_error(ERROR_CODE, __FILE__, __LINE__)
|
||||
#if ROCPROFSYS_USE_ROCM_SMI > 0
|
||||
# define ROCPROFSYS_ROCM_SMI_CALL(ERROR_CODE) \
|
||||
::rocprofsys::gpu::check_rsmi_error(ERROR_CODE, __FILE__, __LINE__)
|
||||
|
||||
void
|
||||
check_rsmi_error(rsmi_status_t _code, const char* _file, int _line)
|
||||
@@ -83,11 +83,11 @@ check_rsmi_error(rsmi_status_t _code, const char* _file, int _line)
|
||||
const char* _msg = nullptr;
|
||||
auto _err = rsmi_status_string(_code, &_msg);
|
||||
if(_err != RSMI_STATUS_SUCCESS)
|
||||
OMNITRACE_THROW("rsmi_status_string failed. No error message available. "
|
||||
"Error code %i originated at %s:%i\n",
|
||||
static_cast<int>(_code), _file, _line);
|
||||
OMNITRACE_THROW("[%s:%i] Error code %i :: %s", _file, _line, static_cast<int>(_code),
|
||||
_msg);
|
||||
ROCPROFSYS_THROW("rsmi_status_string failed. No error message available. "
|
||||
"Error code %i originated at %s:%i\n",
|
||||
static_cast<int>(_code), _file, _line);
|
||||
ROCPROFSYS_THROW("[%s:%i] Error code %i :: %s", _file, _line, static_cast<int>(_code),
|
||||
_msg);
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -96,11 +96,11 @@ rsmi_init()
|
||||
auto _rsmi_init = []() {
|
||||
try
|
||||
{
|
||||
OMNITRACE_ROCM_SMI_CALL(::rsmi_init(0));
|
||||
ROCPROFSYS_ROCM_SMI_CALL(::rsmi_init(0));
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(1, "Exception thrown initializing rocm-smi: %s\n",
|
||||
_e.what());
|
||||
ROCPROFSYS_BASIC_VERBOSE(1, "Exception thrown initializing rocm-smi: %s\n",
|
||||
_e.what());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -110,7 +110,7 @@ rsmi_init()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OMNITRACE_HIP_VERSION >= 60000
|
||||
#if ROCPROFSYS_HIP_VERSION >= 60000
|
||||
template <typename ArchiveT, typename ArgT,
|
||||
std::enable_if_t<!std::is_pointer<ArgT>::value, int> = 0>
|
||||
void
|
||||
@@ -164,7 +164,7 @@ device_prop_serialize(ArchiveT& archive, const char* name, hipDeviceArch_t arg)
|
||||
namespace cereal = tim::cereal;
|
||||
using cereal::make_nvp;
|
||||
|
||||
# define OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(NAME) \
|
||||
# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(NAME) \
|
||||
{ \
|
||||
auto val = arg.NAME; \
|
||||
archive(make_nvp(#NAME, val)); \
|
||||
@@ -172,26 +172,26 @@ device_prop_serialize(ArchiveT& archive, const char* name, hipDeviceArch_t arg)
|
||||
|
||||
archive.setNextName(name);
|
||||
archive.startNode();
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt32Atomics)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalFloatAtomicExch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt32Atomics)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSharedFloatAtomicExch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasFloatAtomicAdd)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt64Atomics)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt64Atomics)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasDoubles)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasWarpVote)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasWarpBallot)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasWarpShuffle)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasFunnelShift)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasThreadFenceSystem)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSyncThreadsExt)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasSurfaceFuncs)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(has3dGrid)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH(hasDynamicParallelism)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt32Atomics)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalFloatAtomicExch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt32Atomics)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSharedFloatAtomicExch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasFloatAtomicAdd)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasGlobalInt64Atomics)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSharedInt64Atomics)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasDoubles)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasWarpVote)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasWarpBallot)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasWarpShuffle)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasFunnelShift)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasThreadFenceSystem)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSyncThreadsExt)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasSurfaceFuncs)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(has3dGrid)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH(hasDynamicParallelism)
|
||||
archive.finishNode();
|
||||
|
||||
# undef OMNITRACE_SERIALIZE_HIP_DEVICE_ARCH
|
||||
# undef ROCPROFSYS_SERIALIZE_HIP_DEVICE_ARCH
|
||||
}
|
||||
#endif
|
||||
} // namespace
|
||||
@@ -199,7 +199,7 @@ device_prop_serialize(ArchiveT& archive, const char* name, hipDeviceArch_t arg)
|
||||
int
|
||||
hip_device_count()
|
||||
{
|
||||
#if OMNITRACE_USE_HIP > 0
|
||||
#if ROCPROFSYS_USE_HIP > 0
|
||||
return ::tim::hip::device_count();
|
||||
#else
|
||||
return 0;
|
||||
@@ -209,17 +209,17 @@ hip_device_count()
|
||||
int
|
||||
rsmi_device_count()
|
||||
{
|
||||
#if OMNITRACE_USE_ROCM_SMI > 0
|
||||
#if ROCPROFSYS_USE_ROCM_SMI > 0
|
||||
if(!rsmi_init()) return 0;
|
||||
|
||||
static auto _num_devices = []() {
|
||||
uint32_t _v = 0;
|
||||
try
|
||||
{
|
||||
OMNITRACE_ROCM_SMI_CALL(rsmi_num_monitor_devices(&_v));
|
||||
ROCPROFSYS_ROCM_SMI_CALL(rsmi_num_monitor_devices(&_v));
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE(
|
||||
ROCPROFSYS_BASIC_VERBOSE(
|
||||
1, "Exception thrown getting the rocm-smi devices: %s\n", _e.what());
|
||||
}
|
||||
return _v;
|
||||
@@ -234,10 +234,10 @@ rsmi_device_count()
|
||||
int
|
||||
device_count()
|
||||
{
|
||||
#if OMNITRACE_USE_ROCM_SMI > 0
|
||||
#if ROCPROFSYS_USE_ROCM_SMI > 0
|
||||
// store as static since calls after rsmi_shutdown will return zero
|
||||
return rsmi_device_count();
|
||||
#elif OMNITRACE_USE_HIP > 0
|
||||
#elif ROCPROFSYS_USE_HIP > 0
|
||||
return ::tim::hip::device_count();
|
||||
#else
|
||||
return 0;
|
||||
@@ -251,7 +251,7 @@ add_hip_device_metadata(ArchiveT& ar)
|
||||
namespace cereal = tim::cereal;
|
||||
using cereal::make_nvp;
|
||||
|
||||
#if OMNITRACE_USE_HIP > 0
|
||||
#if ROCPROFSYS_USE_HIP > 0
|
||||
int _device_count = 0;
|
||||
int _current_device = 0;
|
||||
hipError_t _device_count_err = hipGetDeviceCount(&_device_count);
|
||||
@@ -263,7 +263,7 @@ add_hip_device_metadata(ArchiveT& ar)
|
||||
scope::destructor _dtor{ [_current_device, _current_device_err]() {
|
||||
if(_current_device_err == hipSuccess)
|
||||
{
|
||||
OMNITRACE_HIP_RUNTIME_CALL(hipSetDevice(_current_device));
|
||||
ROCPROFSYS_HIP_RUNTIME_CALL(hipSetDevice(_current_device));
|
||||
}
|
||||
} };
|
||||
|
||||
@@ -279,20 +279,20 @@ add_hip_device_metadata(ArchiveT& ar)
|
||||
auto _device_prop = hipDeviceProp_t{};
|
||||
int _driver_version = 0;
|
||||
int _runtime_version = 0;
|
||||
OMNITRACE_HIP_RUNTIME_CALL(hipSetDevice(dev));
|
||||
OMNITRACE_HIP_RUNTIME_CALL(hipGetDeviceProperties(&_device_prop, dev));
|
||||
OMNITRACE_HIP_RUNTIME_CALL(hipDriverGetVersion(&_driver_version));
|
||||
OMNITRACE_HIP_RUNTIME_CALL(hipRuntimeGetVersion(&_runtime_version));
|
||||
ROCPROFSYS_HIP_RUNTIME_CALL(hipSetDevice(dev));
|
||||
ROCPROFSYS_HIP_RUNTIME_CALL(hipGetDeviceProperties(&_device_prop, dev));
|
||||
ROCPROFSYS_HIP_RUNTIME_CALL(hipDriverGetVersion(&_driver_version));
|
||||
ROCPROFSYS_HIP_RUNTIME_CALL(hipRuntimeGetVersion(&_runtime_version));
|
||||
|
||||
ar.startNode();
|
||||
|
||||
# if OMNITRACE_HIP_VERSION < 60000
|
||||
# if ROCPROFSYS_HIP_VERSION < 60000
|
||||
using intvec_t = std::vector<int>;
|
||||
|
||||
# define OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(NAME) \
|
||||
# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(NAME) \
|
||||
ar(make_nvp(#NAME, _device_prop.NAME));
|
||||
|
||||
# define OMNITRACE_SERIALIZE_HIP_DEVICE_PROP_ARRAY(NAME, ...) \
|
||||
# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP_ARRAY(NAME, ...) \
|
||||
ar(make_nvp(NAME, __VA_ARGS__));
|
||||
|
||||
ar(make_nvp("name", std::string{ _device_prop.name }));
|
||||
@@ -301,162 +301,162 @@ add_hip_device_metadata(ArchiveT& ar)
|
||||
ar(make_nvp("capability.major_version", _device_prop.major));
|
||||
ar(make_nvp("capability.minor_version", _device_prop.minor));
|
||||
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalConstMem)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockRate)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalConstMem)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockRate)
|
||||
|
||||
# if OMNITRACE_HIP_VERSION >= 50000
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize)
|
||||
# if ROCPROFSYS_HIP_VERSION >= 50000
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize)
|
||||
# endif
|
||||
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(warpSize)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP_ARRAY(
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(warpSize)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP_ARRAY(
|
||||
"maxThreadsDim",
|
||||
intvec_t{ _device_prop.maxThreadsDim[0], _device_prop.maxThreadsDim[1],
|
||||
_device_prop.maxThreadsDim[2] })
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP_ARRAY("maxGridSize",
|
||||
intvec_t{ _device_prop.maxGridSize[0],
|
||||
_device_prop.maxGridSize[1],
|
||||
_device_prop.maxGridSize[2] })
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memPitch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(textureAlignment)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(integrated)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDomainID)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciBusID)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(computeMode)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gcnArch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gcnArchName)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(asicRevision)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP_ARRAY(
|
||||
"maxGridSize",
|
||||
intvec_t{ _device_prop.maxGridSize[0], _device_prop.maxGridSize[1],
|
||||
_device_prop.maxGridSize[2] })
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memPitch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(textureAlignment)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(integrated)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDomainID)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciBusID)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(computeMode)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gcnArch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gcnArchName)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(asicRevision)
|
||||
# else
|
||||
# define OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(NAME) \
|
||||
# define ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(NAME) \
|
||||
device_prop_serialize(ar, #NAME, _device_prop.NAME);
|
||||
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(name)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(uuid)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(luid)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(luidDeviceNodeMask)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(warpSize)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memPitch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsDim)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxGridSize)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockRate)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(totalConstMem)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(major)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(minor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(textureAlignment)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(texturePitchAlignment)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(deviceOverlap)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(integrated)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(computeMode)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1D)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DMipmap)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLinear)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2D)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DMipmap)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLinear)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DGather)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture3D)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture3DAlt)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemap)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLayered)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLayered)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemapLayered)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface1D)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface2D)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface3D)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface1DLayered)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurface2DLayered)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemap)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemapLayered)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(surfaceAlignment)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciBusID)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pciDomainID)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(tccDriver)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(asyncEngineCount)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(unifiedAddressing)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(persistingL2CacheMaxSize)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(streamPrioritiesSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(globalL1CacheSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(localL1CacheSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerMultiprocessor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(regsPerMultiprocessor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(managedMemory)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(multiGpuBoardGroupID)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hostNativeAtomicSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(singleToDoublePrecisionPerfRatio)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(computePreemptionSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(canUseHostPointerForRegisteredMem)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlockOptin)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxBlocksPerMultiProcessor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(accessPolicyMaxWindowSize)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(reservedSharedMemPerBlock)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hostRegisterSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(sparseHipArraySupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hostRegisterReadOnlySupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(timelineSemaphoreInteropSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryPoolsSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMASupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAFlushWritesOptions)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAWritesOrdering)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(memoryPoolSupportedHandleTypes)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(deferredMappingHipArraySupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(ipcEventSupported)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clusterLaunch)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(unifiedFunctionPointers)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(gcnArchName)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(arch)
|
||||
// OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hdpMemFlushCntl)
|
||||
// OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(hdpRegFlushCntl)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedFunc)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedGridDim)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedBlockDim)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedSharedMem)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(isLargeBar)
|
||||
OMNITRACE_SERIALIZE_HIP_DEVICE_PROP(asicRevision)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(name)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(uuid)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(luid)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(luidDeviceNodeMask)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalGlobalMem)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlock)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(regsPerBlock)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(warpSize)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memPitch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerBlock)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsDim)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxGridSize)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockRate)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(totalConstMem)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(major)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(minor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(textureAlignment)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(texturePitchAlignment)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(deviceOverlap)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(multiProcessorCount)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(kernelExecTimeoutEnabled)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(integrated)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(canMapHostMemory)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(computeMode)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1D)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DMipmap)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLinear)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2D)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DMipmap)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLinear)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DGather)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture3D)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture3DAlt)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemap)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture1DLayered)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTexture2DLayered)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxTextureCubemapLayered)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface1D)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface2D)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface3D)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface1DLayered)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurface2DLayered)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemap)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSurfaceCubemapLayered)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(surfaceAlignment)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentKernels)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(ECCEnabled)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciBusID)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDeviceID)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pciDomainID)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(tccDriver)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(asyncEngineCount)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(unifiedAddressing)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryClockRate)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryBusWidth)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(l2CacheSize)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(persistingL2CacheMaxSize)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxThreadsPerMultiProcessor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(streamPrioritiesSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(globalL1CacheSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(localL1CacheSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerMultiprocessor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(regsPerMultiprocessor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(managedMemory)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(isMultiGpuBoard)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(multiGpuBoardGroupID)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hostNativeAtomicSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(singleToDoublePrecisionPerfRatio)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccess)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(concurrentManagedAccess)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(computePreemptionSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(canUseHostPointerForRegisteredMem)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeLaunch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceLaunch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sharedMemPerBlockOptin)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(pageableMemoryAccessUsesHostPageTables)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(directManagedMemAccessFromHost)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxBlocksPerMultiProcessor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(accessPolicyMaxWindowSize)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(reservedSharedMemPerBlock)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hostRegisterSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(sparseHipArraySupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hostRegisterReadOnlySupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(timelineSemaphoreInteropSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryPoolsSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMASupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAFlushWritesOptions)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gpuDirectRDMAWritesOrdering)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(memoryPoolSupportedHandleTypes)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(deferredMappingHipArraySupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(ipcEventSupported)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clusterLaunch)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(unifiedFunctionPointers)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(gcnArchName)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(maxSharedMemoryPerMultiProcessor)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(clockInstructionRate)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(arch)
|
||||
// ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hdpMemFlushCntl)
|
||||
// ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(hdpRegFlushCntl)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedFunc)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedGridDim)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedBlockDim)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(cooperativeMultiDeviceUnmatchedSharedMem)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(isLargeBar)
|
||||
ROCPROFSYS_SERIALIZE_HIP_DEVICE_PROP(asicRevision)
|
||||
# endif
|
||||
|
||||
const auto _compute_mode_descr = std::array<const char*, 6>{
|
||||
@@ -487,15 +487,15 @@ add_hip_device_metadata()
|
||||
{
|
||||
if(device_count() == 0) return;
|
||||
|
||||
OMNITRACE_METADATA([](auto& ar) {
|
||||
ROCPROFSYS_METADATA([](auto& ar) {
|
||||
try
|
||||
{
|
||||
add_hip_device_metadata(ar);
|
||||
} catch(std::runtime_error& _e)
|
||||
{
|
||||
OMNITRACE_VERBOSE(2, "%s\n", _e.what());
|
||||
ROCPROFSYS_VERBOSE(2, "%s\n", _e.what());
|
||||
}
|
||||
});
|
||||
}
|
||||
} // namespace gpu
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace gpu
|
||||
{
|
||||
@@ -38,4 +38,4 @@ rsmi_device_count();
|
||||
void
|
||||
add_hip_device_metadata();
|
||||
} // namespace gpu
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "core/defines.hpp"
|
||||
|
||||
#if defined(OMNITRACE_USE_HIP) && OMNITRACE_USE_HIP > 0
|
||||
#if defined(ROCPROFSYS_USE_HIP) && ROCPROFSYS_USE_HIP > 0
|
||||
|
||||
# if defined(HIP_INCLUDE_HIP_HIP_RUNTIME_H) || \
|
||||
defined(HIP_INCLUDE_HIP_HIP_RUNTIME_API_H)
|
||||
@@ -35,7 +35,7 @@
|
||||
# define HIP_PROF_HIP_API_STRING 1
|
||||
|
||||
// following must be included before <roctracer_hip.h> for ROCm 6.0+
|
||||
# if OMNITRACE_HIP_VERSION >= 60000
|
||||
# if ROCPROFSYS_HIP_VERSION >= 60000
|
||||
# if defined(USE_PROF_API)
|
||||
# undef USE_PROF_API
|
||||
# endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,11 +27,11 @@
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace locking
|
||||
{
|
||||
using atomic_mutex = ::tim::locking::spin_mutex;
|
||||
using atomic_lock = ::tim::locking::spin_lock;
|
||||
} // namespace locking
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <thread>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace mproc
|
||||
{
|
||||
@@ -46,7 +46,7 @@ get_concurrent_processes(int _ppid)
|
||||
std::ifstream _ifs{ _inp };
|
||||
if(!_ifs)
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(2, "Warning! File '%s' cannot be read\n", _inp.c_str());
|
||||
ROCPROFSYS_VERBOSE_F(2, "Warning! File '%s' cannot be read\n", _inp.c_str());
|
||||
return _children;
|
||||
}
|
||||
|
||||
@@ -191,4 +191,4 @@ diagnose_status(pid_t _pid, int _status, int _verbose)
|
||||
return _ec;
|
||||
}
|
||||
} // namespace mproc
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <set>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace mproc
|
||||
{
|
||||
@@ -42,4 +42,4 @@ wait_pid(pid_t _pid, int _opts = 0);
|
||||
int
|
||||
diagnose_status(pid_t _pid, int _status, int _verbose = 0);
|
||||
} // namespace mproc
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <timemory/units.hpp>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace perf
|
||||
{
|
||||
@@ -101,7 +101,7 @@ get_hw_config(std::string_view _v)
|
||||
return hw_config::reference_cpu_cycles;
|
||||
else
|
||||
{
|
||||
OMNITRACE_THROW("Unknown perf hardware config: %s", _v.data());
|
||||
ROCPROFSYS_THROW("Unknown perf hardware config: %s", _v.data());
|
||||
}
|
||||
|
||||
#undef HW_CONFIG_REGEX
|
||||
@@ -134,7 +134,7 @@ get_sw_config(std::string_view _v)
|
||||
return sw_config::emulation_faults;
|
||||
else
|
||||
{
|
||||
OMNITRACE_THROW("Unknown perf hw cache config: %s", _v.data());
|
||||
ROCPROFSYS_THROW("Unknown perf hw cache config: %s", _v.data());
|
||||
}
|
||||
|
||||
#undef SW_CONFIG_REGEX
|
||||
@@ -165,7 +165,7 @@ get_hw_cache_config(std::string_view _v)
|
||||
else if(HW_CACHE_CONFIG_REGEX("NODE"))
|
||||
_value |= static_cast<int>(hw_cache_config::node);
|
||||
else
|
||||
OMNITRACE_THROW("Unknown perf software config: %s", _v.data());
|
||||
ROCPROFSYS_THROW("Unknown perf software config: %s", _v.data());
|
||||
|
||||
#undef HW_CACHE_CONFIG_REGEX
|
||||
#define HW_CACHE_OP_REGEX(KEY) \
|
||||
@@ -226,7 +226,7 @@ config_overflow_sampling(struct perf_event_attr& _pe, std::string_view _event,
|
||||
case PERF_TYPE_MAX:
|
||||
default:
|
||||
{
|
||||
OMNITRACE_THROW("unsupported perf type");
|
||||
ROCPROFSYS_THROW("unsupported perf type");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -241,4 +241,4 @@ config_overflow_sampling(struct perf_event_attr& _pe, std::string_view _event,
|
||||
}
|
||||
}
|
||||
} // namespace perf
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -42,7 +42,7 @@ enum
|
||||
HW_BREAKPOINT_X = 4
|
||||
};
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace perf
|
||||
{
|
||||
@@ -288,4 +288,4 @@ int get_hw_cache_config(std::string_view);
|
||||
void
|
||||
config_overflow_sampling(struct perf_event_attr&, std::string_view, double);
|
||||
} // namespace perf
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "perfetto_fwd.hpp"
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace perfetto
|
||||
{
|
||||
@@ -86,8 +86,8 @@ setup()
|
||||
|
||||
for(const auto& itr : config::get_disabled_categories())
|
||||
{
|
||||
OMNITRACE_VERBOSE_F(1, "Disabling perfetto track event category: %s\n",
|
||||
itr.c_str());
|
||||
ROCPROFSYS_VERBOSE_F(1, "Disabling perfetto track event category: %s\n",
|
||||
itr.c_str());
|
||||
track_event_cfg.add_disabled_categories(itr);
|
||||
}
|
||||
|
||||
@@ -124,12 +124,12 @@ start()
|
||||
}
|
||||
else
|
||||
{
|
||||
OMNITRACE_VERBOSE(2, "Resuming perfetto...\n");
|
||||
ROCPROFSYS_VERBOSE(2, "Resuming perfetto...\n");
|
||||
_tmp_file->fopen("a+");
|
||||
}
|
||||
}
|
||||
|
||||
OMNITRACE_VERBOSE(2, "Setup perfetto...\n");
|
||||
ROCPROFSYS_VERBOSE(2, "Setup perfetto...\n");
|
||||
int _fd = (_tmp_file) ? _tmp_file->fd : -1;
|
||||
auto& cfg = get_config();
|
||||
tracing_session->Setup(cfg, _fd);
|
||||
@@ -143,16 +143,17 @@ stop()
|
||||
|
||||
auto& tracing_session = get_perfetto_session();
|
||||
|
||||
OMNITRACE_CI_THROW(tracing_session == nullptr, "Null pointer to the tracing session");
|
||||
ROCPROFSYS_CI_THROW(tracing_session == nullptr,
|
||||
"Null pointer to the tracing session");
|
||||
|
||||
if(tracing_session)
|
||||
{
|
||||
// Make sure the last event is closed
|
||||
OMNITRACE_VERBOSE(2, "Flushing the perfetto trace data...\n");
|
||||
ROCPROFSYS_VERBOSE(2, "Flushing the perfetto trace data...\n");
|
||||
::perfetto::TrackEvent::Flush();
|
||||
tracing_session->FlushBlocking();
|
||||
|
||||
OMNITRACE_VERBOSE(2, "Stopping the perfetto trace session (blocking)...\n");
|
||||
ROCPROFSYS_VERBOSE(2, "Stopping the perfetto trace session (blocking)...\n");
|
||||
tracing_session->StopBlocking();
|
||||
}
|
||||
}
|
||||
@@ -177,7 +178,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error)
|
||||
|
||||
if(!_fdata)
|
||||
{
|
||||
OMNITRACE_VERBOSE(
|
||||
ROCPROFSYS_VERBOSE(
|
||||
-1, "Error! perfetto temp trace file '%s' could not be read",
|
||||
_tmp_file->filename.c_str());
|
||||
return char_vec_t{ tracing_session->ReadTraceBlocking() };
|
||||
@@ -191,7 +192,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error)
|
||||
auto _fnum_read = fread(_data.data(), sizeof(char), _fnum_elem, _fdata);
|
||||
fclose(_fdata);
|
||||
|
||||
OMNITRACE_CI_THROW(
|
||||
ROCPROFSYS_CI_THROW(
|
||||
_fnum_read != _fnum_elem,
|
||||
"Error! read %zu elements from perfetto trace file '%s'. Expected %zu\n",
|
||||
_fnum_read, _tmp_file->filename.c_str(), _fnum_elem);
|
||||
@@ -233,7 +234,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error)
|
||||
auto _filename = config::get_perfetto_output_filename();
|
||||
if(!trace_data.empty())
|
||||
{
|
||||
operation::file_output_message<tim::project::omnitrace> _fom{};
|
||||
operation::file_output_message<tim::project::rocprofsys> _fom{};
|
||||
// Write the trace into a file.
|
||||
if(config::get_verbose() >= 0)
|
||||
_fom(_filename, std::string{ "perfetto" },
|
||||
@@ -259,7 +260,7 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error)
|
||||
}
|
||||
else if(dmp::rank() == 0)
|
||||
{
|
||||
OMNITRACE_VERBOSE(
|
||||
ROCPROFSYS_VERBOSE(
|
||||
0, "perfetto trace data is empty. File '%s' will not be written...\n",
|
||||
_filename.c_str());
|
||||
}
|
||||
@@ -278,8 +279,8 @@ post_process(tim::manager* _timemory_manager, bool& _perfetto_output_error)
|
||||
std::unique_ptr<::perfetto::TracingSession>&
|
||||
get_perfetto_session(pid_t _pid)
|
||||
{
|
||||
return ::omnitrace::perfetto::get_session(_pid);
|
||||
return ::rocprofsys::perfetto::get_session(_pid);
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
PERFETTO_TRACK_EVENT_STATIC_STORAGE();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -29,7 +29,7 @@
|
||||
# include <timemory/components/perfetto/backends.hpp>
|
||||
#else
|
||||
# include <perfetto.h>
|
||||
PERFETTO_DEFINE_CATEGORIES(OMNITRACE_PERFETTO_CATEGORIES);
|
||||
PERFETTO_DEFINE_CATEGORIES(ROCPROFSYS_PERFETTO_CATEGORIES);
|
||||
#endif
|
||||
|
||||
#include "debug.hpp"
|
||||
@@ -43,7 +43,7 @@ PERFETTO_DEFINE_CATEGORIES(OMNITRACE_PERFETTO_CATEGORIES);
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
std::unique_ptr<::perfetto::TracingSession>& get_perfetto_session(
|
||||
pid_t = process::get_id());
|
||||
@@ -143,15 +143,15 @@ perfetto_counter_track<Tp>::emplace(size_t _idx, const std::string& _v,
|
||||
std::stringstream _css{};
|
||||
for(auto&& eitr : _curr)
|
||||
_css << " " << std::hex << std::setw(12) << std::left << eitr;
|
||||
OMNITRACE_THROW("perfetto_counter_track emplace method for '%s' (%p) "
|
||||
"invalidated C-string '%s' (%p).\n%8s: %s\n%8s: %s\n",
|
||||
_v.c_str(), (void*) _name->c_str(),
|
||||
std::get<0>(itr).c_str(),
|
||||
(void*) std::get<0>(itr).c_str(), "previous",
|
||||
_pss.str().c_str(), "current", _css.str().c_str());
|
||||
ROCPROFSYS_THROW("perfetto_counter_track emplace method for '%s' (%p) "
|
||||
"invalidated C-string '%s' (%p).\n%8s: %s\n%8s: %s\n",
|
||||
_v.c_str(), (void*) _name->c_str(),
|
||||
std::get<0>(itr).c_str(),
|
||||
(void*) std::get<0>(itr).c_str(), "previous",
|
||||
_pss.str().c_str(), "current", _css.str().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
return _index;
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -27,7 +27,7 @@ namespace tim
|
||||
class manager;
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace perfetto
|
||||
{
|
||||
@@ -43,4 +43,4 @@ stop();
|
||||
void
|
||||
post_process(tim::manager*, bool&);
|
||||
} // namespace perfetto
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -25,9 +25,9 @@
|
||||
#include "core/defines.hpp"
|
||||
#include "core/hip_runtime.hpp"
|
||||
|
||||
#if defined(OMNITRACE_USE_HIP) && OMNITRACE_USE_HIP > 0 && \
|
||||
defined(OMNITRACE_USE_RCCL) && OMNITRACE_USE_RCCL > 0
|
||||
# if OMNITRACE_HIP_VERSION == 0 || OMNITRACE_HIP_VERSION >= 50200
|
||||
#if defined(ROCPROFSYS_USE_HIP) && ROCPROFSYS_USE_HIP > 0 && \
|
||||
defined(ROCPROFSYS_USE_RCCL) && ROCPROFSYS_USE_RCCL > 0
|
||||
# if ROCPROFSYS_HIP_VERSION == 0 || ROCPROFSYS_HIP_VERSION >= 50200
|
||||
# include <rccl/rccl.h>
|
||||
# else
|
||||
# include <rccl.h>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -31,15 +31,15 @@
|
||||
#include <streambuf>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
inline namespace config
|
||||
{
|
||||
bool
|
||||
get_debug() OMNITRACE_HOT;
|
||||
get_debug() ROCPROFSYS_HOT;
|
||||
|
||||
int
|
||||
get_verbose() OMNITRACE_HOT;
|
||||
get_verbose() ROCPROFSYS_HOT;
|
||||
} // namespace config
|
||||
|
||||
struct redirect
|
||||
@@ -68,10 +68,11 @@ struct redirect
|
||||
if(_v != _expect)
|
||||
{
|
||||
if(get_verbose() > 0)
|
||||
std::cerr << "[omnitrace::redirect] Expected:\n[omnitrace::redirect] "
|
||||
<< _expect
|
||||
<< "\n[omnitrace::redirect] Found:\n[omnitrace::redirect] "
|
||||
<< _v << "\n";
|
||||
std::cerr
|
||||
<< "[rocprofsys::redirect] Expected:\n[rocprofsys::redirect] "
|
||||
<< _expect
|
||||
<< "\n[rocprofsys::redirect] Found:\n[rocprofsys::redirect] " << _v
|
||||
<< "\n";
|
||||
if(get_verbose() <= 0 || (&m_os != &std::cerr && &m_os != &std::cout))
|
||||
m_os << m_buffer.str() << std::flush;
|
||||
}
|
||||
@@ -99,4 +100,4 @@ private:
|
||||
std::stringstream m_buffer{};
|
||||
std::streambuf* m_strm_buffer = nullptr;
|
||||
};
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <atomic>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace
|
||||
{
|
||||
@@ -49,10 +49,10 @@ get_thread_state_value()
|
||||
auto&
|
||||
get_thread_state_history(int64_t _idx = utility::get_thread_index())
|
||||
{
|
||||
static auto _v = utility::get_filled_array<OMNITRACE_MAX_THREADS>(
|
||||
static auto _v = utility::get_filled_array<ROCPROFSYS_MAX_THREADS>(
|
||||
[]() { return utility::get_reserved_vector<ThreadState>(32); });
|
||||
|
||||
if(_idx >= OMNITRACE_MAX_THREADS)
|
||||
if(_idx >= ROCPROFSYS_MAX_THREADS)
|
||||
{
|
||||
static thread_local auto _tl_v = utility::get_reserved_vector<ThreadState>(32);
|
||||
return _tl_v;
|
||||
@@ -77,11 +77,11 @@ get_thread_state()
|
||||
State
|
||||
set_state(State _n)
|
||||
{
|
||||
OMNITRACE_CONDITIONAL_PRINT_F(get_debug_init(), "Setting state :: %s -> %s\n",
|
||||
std::to_string(get_state()).c_str(),
|
||||
std::to_string(_n).c_str());
|
||||
ROCPROFSYS_CONDITIONAL_PRINT_F(get_debug_init(), "Setting state :: %s -> %s\n",
|
||||
std::to_string(get_state()).c_str(),
|
||||
std::to_string(_n).c_str());
|
||||
// state should always be increased, not decreased
|
||||
OMNITRACE_CI_BASIC_THROW(
|
||||
ROCPROFSYS_CI_BASIC_THROW(
|
||||
_n < get_state(), "State is being assigned to a lesser value :: %s -> %s",
|
||||
std::to_string(get_state()).c_str(), std::to_string(_n).c_str());
|
||||
auto _v = get_state();
|
||||
@@ -118,57 +118,57 @@ pop_thread_state()
|
||||
}
|
||||
return get_thread_state();
|
||||
}
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
namespace std
|
||||
{
|
||||
std::string
|
||||
to_string(omnitrace::State _v)
|
||||
to_string(rocprofsys::State _v)
|
||||
{
|
||||
switch(_v)
|
||||
{
|
||||
case omnitrace::State::PreInit: return "PreInit";
|
||||
case omnitrace::State::Init: return "Init";
|
||||
case omnitrace::State::Active: return "Active";
|
||||
case omnitrace::State::Disabled: return "Disabled";
|
||||
case omnitrace::State::Finalized: return "Finalized";
|
||||
case rocprofsys::State::PreInit: return "PreInit";
|
||||
case rocprofsys::State::Init: return "Init";
|
||||
case rocprofsys::State::Active: return "Active";
|
||||
case rocprofsys::State::Disabled: return "Disabled";
|
||||
case rocprofsys::State::Finalized: return "Finalized";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string
|
||||
to_string(omnitrace::ThreadState _v)
|
||||
to_string(rocprofsys::ThreadState _v)
|
||||
{
|
||||
switch(_v)
|
||||
{
|
||||
case omnitrace::ThreadState::Enabled: return "Enabled";
|
||||
case omnitrace::ThreadState::Internal: return "Internal";
|
||||
case omnitrace::ThreadState::Completed: return "Completed";
|
||||
case omnitrace::ThreadState::Disabled: return "Disabled";
|
||||
case rocprofsys::ThreadState::Enabled: return "Enabled";
|
||||
case rocprofsys::ThreadState::Internal: return "Internal";
|
||||
case rocprofsys::ThreadState::Completed: return "Completed";
|
||||
case rocprofsys::ThreadState::Disabled: return "Disabled";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string
|
||||
to_string(omnitrace::Mode _v)
|
||||
to_string(rocprofsys::Mode _v)
|
||||
{
|
||||
switch(_v)
|
||||
{
|
||||
case omnitrace::Mode::Trace: return "Trace";
|
||||
case omnitrace::Mode::Sampling: return "Sampling";
|
||||
case omnitrace::Mode::Causal: return "Causal";
|
||||
case omnitrace::Mode::Coverage: return "Coverage";
|
||||
case rocprofsys::Mode::Trace: return "Trace";
|
||||
case rocprofsys::Mode::Sampling: return "Sampling";
|
||||
case rocprofsys::Mode::Causal: return "Causal";
|
||||
case rocprofsys::Mode::Coverage: return "Coverage";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string
|
||||
to_string(omnitrace::CausalMode _v)
|
||||
to_string(rocprofsys::CausalMode _v)
|
||||
{
|
||||
switch(_v)
|
||||
{
|
||||
case omnitrace::CausalMode::Line: return "Line";
|
||||
case omnitrace::CausalMode::Function: return "Function";
|
||||
case rocprofsys::CausalMode::Line: return "Line";
|
||||
case rocprofsys::CausalMode::Function: return "Function";
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -28,9 +28,9 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
// used for specifying the state of omnitrace
|
||||
// used for specifying the state of rocprof-sys
|
||||
enum class State : unsigned short
|
||||
{
|
||||
PreInit = 0,
|
||||
@@ -40,7 +40,7 @@ enum class State : unsigned short
|
||||
Disabled,
|
||||
};
|
||||
|
||||
// used for specifying the state of omnitrace
|
||||
// used for specifying the state of rocprof-sys
|
||||
enum class ThreadState : unsigned short
|
||||
{
|
||||
Enabled = 0,
|
||||
@@ -74,48 +74,49 @@ enum class CausalMode : unsigned short
|
||||
// Runtime configuration data
|
||||
//
|
||||
State
|
||||
get_state() OMNITRACE_HOT;
|
||||
get_state() ROCPROFSYS_HOT;
|
||||
|
||||
ThreadState
|
||||
get_thread_state() OMNITRACE_HOT;
|
||||
get_thread_state() ROCPROFSYS_HOT;
|
||||
|
||||
/// returns old state
|
||||
State set_state(State) OMNITRACE_COLD; // does not change often
|
||||
State set_state(State) ROCPROFSYS_COLD; // does not change often
|
||||
|
||||
/// returns old state
|
||||
ThreadState set_thread_state(ThreadState) OMNITRACE_HOT; // changes often
|
||||
ThreadState set_thread_state(ThreadState) ROCPROFSYS_HOT; // changes often
|
||||
|
||||
/// return current state (state change may be ignored)
|
||||
ThreadState push_thread_state(ThreadState) OMNITRACE_HOT;
|
||||
ThreadState push_thread_state(ThreadState) ROCPROFSYS_HOT;
|
||||
|
||||
/// return current state (state change may be ignored)
|
||||
ThreadState
|
||||
pop_thread_state() OMNITRACE_HOT;
|
||||
pop_thread_state() ROCPROFSYS_HOT;
|
||||
|
||||
struct scoped_thread_state
|
||||
{
|
||||
OMNITRACE_INLINE scoped_thread_state(ThreadState _v) { push_thread_state(_v); }
|
||||
OMNITRACE_INLINE ~scoped_thread_state() { pop_thread_state(); }
|
||||
ROCPROFSYS_INLINE scoped_thread_state(ThreadState _v) { push_thread_state(_v); }
|
||||
ROCPROFSYS_INLINE ~scoped_thread_state() { pop_thread_state(); }
|
||||
};
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
#define OMNITRACE_SCOPED_THREAD_STATE(STATE) \
|
||||
::omnitrace::scoped_thread_state OMNITRACE_VARIABLE(_scoped_thread_state_, __LINE__) \
|
||||
#define ROCPROFSYS_SCOPED_THREAD_STATE(STATE) \
|
||||
::rocprofsys::scoped_thread_state ROCPROFSYS_VARIABLE(_scoped_thread_state_, \
|
||||
__LINE__) \
|
||||
{ \
|
||||
::omnitrace::STATE \
|
||||
::rocprofsys::STATE \
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
std::string
|
||||
to_string(omnitrace::State _v);
|
||||
to_string(rocprofsys::State _v);
|
||||
|
||||
std::string
|
||||
to_string(omnitrace::ThreadState _v);
|
||||
to_string(rocprofsys::ThreadState _v);
|
||||
|
||||
std::string
|
||||
to_string(omnitrace::Mode _v);
|
||||
to_string(rocprofsys::Mode _v);
|
||||
|
||||
std::string
|
||||
to_string(omnitrace::CausalMode _v);
|
||||
to_string(rocprofsys::CausalMode _v);
|
||||
} // namespace std
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
#include "timemory.hpp"
|
||||
|
||||
using namespace omnitrace;
|
||||
using namespace rocprofsys;
|
||||
|
||||
TIMEMORY_INITIALIZE_STORAGE(comp::wall_clock, comp::user_global_bundle)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <timemory/utility/signals.hpp>
|
||||
#include <timemory/variadic.hpp>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace audit = ::tim::audit; // NOLINT
|
||||
namespace comp = ::tim::component; // NOLINT
|
||||
@@ -56,4 +56,4 @@ using settings = ::tim::settings; // NOLINT
|
||||
|
||||
using ::tim::get_env; // NOLINT
|
||||
using ::tim::set_env; // NOLINT
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "utility.hpp"
|
||||
#include "debug.hpp"
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace utility
|
||||
{
|
||||
@@ -71,7 +71,7 @@ parse_numeric_range(std::string _input_string, const std::string& _label, Up _in
|
||||
{
|
||||
if(_v.find_first_not_of("0123456789-:") != std::string::npos)
|
||||
{
|
||||
OMNITRACE_BASIC_VERBOSE_F(
|
||||
ROCPROFSYS_BASIC_VERBOSE_F(
|
||||
0,
|
||||
"Invalid %s specification. Only numerical values (e.g., 0), ranges "
|
||||
"(e.g., 0-7), and ranges with increments (e.g. 20-40:10) are permitted. "
|
||||
@@ -92,7 +92,7 @@ parse_numeric_range(std::string _input_string, const std::string& _label, Up _in
|
||||
if(_v.find('-') != std::string::npos)
|
||||
{
|
||||
auto _vv = tim::delimit(_v, "-");
|
||||
OMNITRACE_CONDITIONAL_THROW(
|
||||
ROCPROFSYS_CONDITIONAL_THROW(
|
||||
_vv.size() != 2,
|
||||
"Invalid %s range specification: %s. Required format N-M, e.g. 0-4",
|
||||
_label.c_str(), _v.c_str());
|
||||
@@ -120,4 +120,4 @@ template std::unordered_set<int64_t>
|
||||
parse_numeric_range<int64_t, std::unordered_set<int64_t>>(std::string, const std::string&,
|
||||
long);
|
||||
} // namespace utility
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace omnitrace
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace utility
|
||||
{
|
||||
@@ -253,4 +253,4 @@ extern template std::unordered_set<int64_t>
|
||||
parse_numeric_range<int64_t, std::unordered_set<int64_t>>(std::string, const std::string&,
|
||||
long);
|
||||
} // namespace utility
|
||||
} // namespace omnitrace
|
||||
} // namespace rocprofsys
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace dl library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
set(CMAKE_SKIP_RPATH OFF)
|
||||
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET "internal")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library(omnitrace-dl-library SHARED)
|
||||
add_library(omnitrace::omnitrace-dl-library ALIAS omnitrace-dl-library)
|
||||
|
||||
target_sources(
|
||||
omnitrace-dl-library
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp)
|
||||
target_include_directories(
|
||||
omnitrace-dl-library
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../omnitrace-user>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../omnitrace>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
target_link_libraries(
|
||||
omnitrace-dl-library
|
||||
PUBLIC $<BUILD_INTERFACE:${dl_LIBRARY}> $<BUILD_INTERFACE:omnitrace::common-library>
|
||||
$<BUILD_INTERFACE:omnitrace::omnitrace-compile-definitions>
|
||||
$<BUILD_INTERFACE:Threads::Threads>)
|
||||
|
||||
add_target_cxx_flag_if_avail(omnitrace-dl-library "-ftls-model=global-dynamic")
|
||||
add_target_cxx_flag_if_avail(omnitrace-dl-library "-g3")
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-dl-library
|
||||
PROPERTIES OUTPUT_NAME omnitrace-dl
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN")
|
||||
|
||||
omnitrace_strip_target(omnitrace-dl-library)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/omnitrace/dl)
|
||||
|
||||
install(TARGETS omnitrace-dl-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
ファイル差分が大きすぎるため省略します
差分を読み込み
@@ -1,211 +0,0 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef OMNITRACE_DL_HPP_
|
||||
#define OMNITRACE_DL_HPP_
|
||||
|
||||
#if defined(OMNITRACE_DL_SOURCE) && (OMNITRACE_DL_SOURCE > 0)
|
||||
# include "common/defines.h"
|
||||
#else
|
||||
# if !defined(OMNITRACE_PUBLIC_API)
|
||||
# define OMNITRACE_PUBLIC_API
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "omnitrace/user.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <dlfcn.h>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(OMNITRACE_USE_OMPT)
|
||||
# define OMNITRACE_USE_OMPT 0
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCTRACER)
|
||||
# define OMNITRACE_USE_ROCTRACER 0
|
||||
#endif
|
||||
|
||||
#if !defined(OMNITRACE_USE_ROCPROFILER)
|
||||
# define OMNITRACE_USE_ROCPROFILER 0
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
// omnitrace symbols
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void omnitrace_init_library(void) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_init_tooling(void) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_init(const char*, bool, const char*) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_finalize(void) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_set_env(const char* env_name,
|
||||
const char* env_val) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_set_mpi(bool use, bool attached) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_set_instrumented(int) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_push_trace(const char* name) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_pop_trace(const char* name) OMNITRACE_PUBLIC_API;
|
||||
int omnitrace_push_region(const char*) OMNITRACE_PUBLIC_API;
|
||||
int omnitrace_pop_region(const char*) OMNITRACE_PUBLIC_API;
|
||||
int omnitrace_push_category_region(omnitrace_category_t, const char*,
|
||||
omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
int omnitrace_pop_category_region(omnitrace_category_t, const char*,
|
||||
omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
void omnitrace_register_source(const char* file, const char* func, size_t line,
|
||||
size_t address,
|
||||
const char* source) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_register_coverage(const char* file, const char* func,
|
||||
size_t address) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_progress(const char*) OMNITRACE_PUBLIC_API;
|
||||
void omnitrace_annotated_progress(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
#if defined(OMNITRACE_DL_SOURCE) && (OMNITRACE_DL_SOURCE > 0)
|
||||
void omnitrace_preinit_library(void) OMNITRACE_HIDDEN_API;
|
||||
int omnitrace_preload_library(void) OMNITRACE_HIDDEN_API;
|
||||
|
||||
int omnitrace_user_start_trace_dl(void) OMNITRACE_HIDDEN_API;
|
||||
int omnitrace_user_stop_trace_dl(void) OMNITRACE_HIDDEN_API;
|
||||
|
||||
int omnitrace_user_start_thread_trace_dl(void) OMNITRACE_HIDDEN_API;
|
||||
int omnitrace_user_stop_thread_trace_dl(void) OMNITRACE_HIDDEN_API;
|
||||
|
||||
int omnitrace_user_push_region_dl(const char*) OMNITRACE_HIDDEN_API;
|
||||
int omnitrace_user_pop_region_dl(const char*) OMNITRACE_HIDDEN_API;
|
||||
|
||||
int omnitrace_user_push_annotated_region_dl(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_HIDDEN_API;
|
||||
int omnitrace_user_pop_annotated_region_dl(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_HIDDEN_API;
|
||||
|
||||
int omnitrace_user_progress_dl(const char* name) OMNITRACE_HIDDEN_API;
|
||||
int omnitrace_user_annotated_progress_dl(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_HIDDEN_API;
|
||||
// KokkosP
|
||||
struct OMNITRACE_HIDDEN_API SpaceHandle
|
||||
{
|
||||
char name[64];
|
||||
};
|
||||
|
||||
struct OMNITRACE_HIDDEN_API Kokkos_Tools_ToolSettings
|
||||
{
|
||||
bool requires_global_fencing;
|
||||
bool padding[255];
|
||||
};
|
||||
|
||||
void kokkosp_print_help(char*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_parse_args(int, char**) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_declare_metadata(const char*, const char*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_request_tool_settings(const uint32_t,
|
||||
Kokkos_Tools_ToolSettings*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_init_library(const int, const uint64_t, const uint32_t,
|
||||
void*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_finalize_library() OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_begin_parallel_for(const char*, uint32_t,
|
||||
uint64_t*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_end_parallel_for(uint64_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_begin_parallel_reduce(const char*, uint32_t,
|
||||
uint64_t*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_end_parallel_reduce(uint64_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_begin_parallel_scan(const char*, uint32_t,
|
||||
uint64_t*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_end_parallel_scan(uint64_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_begin_fence(const char*, uint32_t, uint64_t*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_end_fence(uint64_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_push_profile_region(const char*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_pop_profile_region() OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_create_profile_section(const char*, uint32_t*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_destroy_profile_section(uint32_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_start_profile_section(uint32_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_stop_profile_section(uint32_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_allocate_data(const SpaceHandle, const char*, const void* const,
|
||||
const uint64_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_deallocate_data(const SpaceHandle, const char*, const void* const,
|
||||
const uint64_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_begin_deep_copy(SpaceHandle, const char*, const void*, SpaceHandle,
|
||||
const char*, const void*, uint64_t) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_end_deep_copy() OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_profile_event(const char*) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_dual_view_sync(const char*, const void* const,
|
||||
bool) OMNITRACE_PUBLIC_API;
|
||||
void kokkosp_dual_view_modify(const char*, const void* const,
|
||||
bool) OMNITRACE_PUBLIC_API;
|
||||
|
||||
// OpenMP Tools (OMPT)
|
||||
# if OMNITRACE_USE_OMPT > 0
|
||||
struct ompt_start_tool_result_t;
|
||||
|
||||
ompt_start_tool_result_t* ompt_start_tool(unsigned int,
|
||||
const char*) OMNITRACE_PUBLIC_API;
|
||||
# endif
|
||||
|
||||
# if OMNITRACE_USE_ROCTRACER > 0
|
||||
// HSA
|
||||
struct HsaApiTable;
|
||||
bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count,
|
||||
const char* const* failed_tool_names) OMNITRACE_PUBLIC_API;
|
||||
void OnUnload() OMNITRACE_PUBLIC_API;
|
||||
# endif
|
||||
|
||||
# if OMNITRACE_USE_ROCPROFILER > 0
|
||||
// ROCP
|
||||
void OnLoadToolProp(void* settings) OMNITRACE_PUBLIC_API;
|
||||
void OnUnloadTool() OMNITRACE_PUBLIC_API;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace omnitrace
|
||||
{
|
||||
namespace dl
|
||||
{
|
||||
enum class InstrumentMode : int
|
||||
{
|
||||
None = -1,
|
||||
BinaryRewrite = 0,
|
||||
ProcessCreate = 1, // runtime instrumentation at start of process
|
||||
ProcessAttach = 2, // runtime instrumentation of running process
|
||||
PythonProfile = 3, // python setprofile
|
||||
Last,
|
||||
};
|
||||
}
|
||||
} // namespace omnitrace
|
||||
|
||||
#endif // OMNITRACE_DL_HPP_ 1
|
||||
@@ -1,54 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace user library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
set(CMAKE_SKIP_RPATH OFF)
|
||||
set(BUILD_RPATH_USE_ORIGIN ON)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
||||
|
||||
add_library(omnitrace-user-library SHARED)
|
||||
add_library(omnitrace::omnitrace-user-library ALIAS omnitrace-user-library)
|
||||
|
||||
set(_user_headers
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/user.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/types.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/causal.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/omnitrace/categories.h)
|
||||
|
||||
set(_user_sources ${CMAKE_CURRENT_SOURCE_DIR}/user.cpp)
|
||||
|
||||
target_sources(omnitrace-user-library PRIVATE ${_user_sources} ${_user_headers})
|
||||
target_include_directories(
|
||||
omnitrace-user-library PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
target_link_libraries(omnitrace-user-library
|
||||
PRIVATE $<BUILD_INTERFACE:omnitrace::omnitrace-compile-definitions>)
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-user-library
|
||||
PROPERTIES OUTPUT_NAME omnitrace-user
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN")
|
||||
|
||||
omnitrace_strip_target(omnitrace-user-library)
|
||||
|
||||
foreach(_HEADER ${_user_headers})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/"
|
||||
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/" _DEST
|
||||
"${_HEADER}")
|
||||
configure_file(${_HEADER} ${_DEST} COPYONLY)
|
||||
endforeach()
|
||||
|
||||
install(FILES ${_user_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/omnitrace)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-user-library
|
||||
EXPORT omnitrace-library-targets
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
@@ -1,191 +0,0 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef OMNITRACE_CATEGORIES_H_
|
||||
#define OMNITRACE_CATEGORIES_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/// @typedef omnitrace_category_t
|
||||
/// @brief Identifier for categories
|
||||
///
|
||||
typedef enum OMNITRACE_CATEGORIES
|
||||
{
|
||||
// Do not use first enum value
|
||||
OMNITRACE_CATEGORY_NONE = 0,
|
||||
// arrange these in the order most likely to
|
||||
// be used since they have to be iterated over
|
||||
OMNITRACE_CATEGORY_PYTHON,
|
||||
OMNITRACE_CATEGORY_USER,
|
||||
OMNITRACE_CATEGORY_HOST,
|
||||
OMNITRACE_CATEGORY_DEVICE_HIP,
|
||||
OMNITRACE_CATEGORY_DEVICE_HSA,
|
||||
OMNITRACE_CATEGORY_ROCM_HIP,
|
||||
OMNITRACE_CATEGORY_ROCM_HSA,
|
||||
OMNITRACE_CATEGORY_ROCM_ROCTX,
|
||||
OMNITRACE_CATEGORY_ROCM_SMI,
|
||||
OMNITRACE_CATEGORY_ROCM_SMI_BUSY,
|
||||
OMNITRACE_CATEGORY_ROCM_SMI_TEMP,
|
||||
OMNITRACE_CATEGORY_ROCM_SMI_POWER,
|
||||
OMNITRACE_CATEGORY_ROCM_SMI_MEMORY_USAGE,
|
||||
OMNITRACE_CATEGORY_ROCM_RCCL,
|
||||
OMNITRACE_CATEGORY_ROCTRACER,
|
||||
OMNITRACE_CATEGORY_ROCPROFILER,
|
||||
OMNITRACE_CATEGORY_SAMPLING,
|
||||
OMNITRACE_CATEGORY_PTHREAD,
|
||||
OMNITRACE_CATEGORY_KOKKOS,
|
||||
OMNITRACE_CATEGORY_MPI,
|
||||
OMNITRACE_CATEGORY_OMPT,
|
||||
OMNITRACE_CATEGORY_PROCESS_SAMPLING,
|
||||
OMNITRACE_CATEGORY_COMM_DATA,
|
||||
OMNITRACE_CATEGORY_CAUSAL,
|
||||
OMNITRACE_CATEGORY_CPU_FREQ,
|
||||
OMNITRACE_CATEGORY_PROCESS_PAGE,
|
||||
OMNITRACE_CATEGORY_PROCESS_VIRT,
|
||||
OMNITRACE_CATEGORY_PROCESS_PEAK,
|
||||
OMNITRACE_CATEGORY_PROCESS_CONTEXT_SWITCH,
|
||||
OMNITRACE_CATEGORY_PROCESS_PAGE_FAULT,
|
||||
OMNITRACE_CATEGORY_PROCESS_USER_MODE_TIME,
|
||||
OMNITRACE_CATEGORY_PROCESS_KERNEL_MODE_TIME,
|
||||
OMNITRACE_CATEGORY_THREAD_WALL_TIME,
|
||||
OMNITRACE_CATEGORY_THREAD_CPU_TIME,
|
||||
OMNITRACE_CATEGORY_THREAD_PAGE_FAULT,
|
||||
OMNITRACE_CATEGORY_THREAD_PEAK_MEMORY,
|
||||
OMNITRACE_CATEGORY_THREAD_CONTEXT_SWITCH,
|
||||
OMNITRACE_CATEGORY_THREAD_HARDWARE_COUNTER,
|
||||
OMNITRACE_CATEGORY_KERNEL_HARDWARE_COUNTER,
|
||||
OMNITRACE_CATEGORY_NUMA,
|
||||
OMNITRACE_CATEGORY_TIMER_SAMPLING,
|
||||
OMNITRACE_CATEGORY_OVERFLOW_SAMPLING,
|
||||
OMNITRACE_CATEGORY_LAST
|
||||
// the value of below enum is used for iterating
|
||||
// over the enum in C++ templates. It MUST
|
||||
// be the last enumerated id
|
||||
} omnitrace_category_t;
|
||||
|
||||
/// @enum OMNITRACE_ANNOTATION_TYPE
|
||||
/// @brief Identifier for the data type of the annotation.
|
||||
/// if the data type is not a pointer, pass the address of
|
||||
/// data.
|
||||
/// @typedef OMNITRACE_ANNOTATION_TYPE omnitrace_annotation_type_t
|
||||
typedef enum OMNITRACE_ANNOTATION_TYPE
|
||||
{
|
||||
// Do not use first enum value
|
||||
OMNITRACE_VALUE_NONE = 0,
|
||||
// arrange these in the order most likely to
|
||||
// be used since they have to be iterated over
|
||||
OMNITRACE_VALUE_CSTR = 1,
|
||||
OMNITRACE_STRING = OMNITRACE_VALUE_CSTR,
|
||||
OMNITRACE_VALUE_SIZE_T = 2,
|
||||
OMNITRACE_SIZE_T = OMNITRACE_VALUE_SIZE_T,
|
||||
OMNITRACE_VALUE_INT64 = 3,
|
||||
OMNITRACE_INT64 = OMNITRACE_VALUE_INT64,
|
||||
OMNITRACE_I64 = OMNITRACE_VALUE_INT64,
|
||||
OMNITRACE_VALUE_UINT64 = 4,
|
||||
OMNITRACE_UINT64 = OMNITRACE_VALUE_UINT64,
|
||||
OMNITRACE_U64 = OMNITRACE_VALUE_UINT64,
|
||||
OMNITRACE_VALUE_FLOAT64 = 5,
|
||||
OMNITRACE_FLOAT64 = OMNITRACE_VALUE_FLOAT64,
|
||||
OMNITRACE_FP64 = OMNITRACE_VALUE_FLOAT64,
|
||||
OMNITRACE_VALUE_VOID_P = 6,
|
||||
OMNITRACE_VOID_P = OMNITRACE_VALUE_VOID_P,
|
||||
OMNITRACE_PTR = OMNITRACE_VALUE_VOID_P,
|
||||
OMNITRACE_VALUE_INT32 = 7,
|
||||
OMNITRACE_INT32 = OMNITRACE_VALUE_INT32,
|
||||
OMNITRACE_I32 = OMNITRACE_VALUE_INT32,
|
||||
OMNITRACE_VALUE_UINT32 = 8,
|
||||
OMNITRACE_UINT32 = OMNITRACE_VALUE_UINT32,
|
||||
OMNITRACE_U32 = OMNITRACE_VALUE_UINT32,
|
||||
OMNITRACE_VALUE_FLOAT32 = 9,
|
||||
OMNITRACE_FLOAT32 = OMNITRACE_VALUE_FLOAT32,
|
||||
OMNITRACE_FP32 = OMNITRACE_VALUE_FLOAT32,
|
||||
OMNITRACE_VALUE_INT16 = 10,
|
||||
OMNITRACE_INT16 = OMNITRACE_VALUE_INT16,
|
||||
OMNITRACE_I16 = OMNITRACE_VALUE_INT16,
|
||||
OMNITRACE_VALUE_UINT16 = 11,
|
||||
OMNITRACE_UINT16 = OMNITRACE_VALUE_UINT16,
|
||||
OMNITRACE_U16 = OMNITRACE_VALUE_UINT16,
|
||||
// the value of below enum is used for iterating
|
||||
// over the enum in C++ templates. It MUST
|
||||
// be the last enumerated id
|
||||
OMNITRACE_VALUE_LAST
|
||||
} omnitrace_annotation_type_t;
|
||||
|
||||
/// @struct omnitrace_annotation
|
||||
/// @brief A struct containing annotation data to be included in the perfetto trace.
|
||||
///
|
||||
/// @code{.cpp}
|
||||
/// #include <cstddef>
|
||||
/// #include <cstdint>
|
||||
///
|
||||
/// double
|
||||
/// compute_residual(size_t n, double* data);
|
||||
///
|
||||
/// double
|
||||
/// compute(size_t n, double* data, size_t nitr, double tolerance)
|
||||
/// {
|
||||
/// omnitrace_annotation_t _annotations[] = {
|
||||
/// { "iteration", OMNITRACE_VALUE_SIZE_T, nullptr },
|
||||
/// { "residual", OMNITRACE_VALUE_FLOAT64, nullptr },
|
||||
/// { "data", OMNITRACE_VALUE_PTR, data },
|
||||
/// { "size", OMNITRACE_VALUE_SIZE_T, &n },
|
||||
/// { "tolerance", OMNITRACE_VALUE_FLOAT64, &tolerance },
|
||||
/// nullptr
|
||||
/// };
|
||||
///
|
||||
/// double residual = tolerance;
|
||||
/// for(size_t i = 0; i < nitr; ++i)
|
||||
/// {
|
||||
/// omnitrace_user_push_annotated_region("compute", &_annotations);
|
||||
///
|
||||
/// residual = compute_residual(n, data);
|
||||
///
|
||||
/// _annotations[0].value = &i;
|
||||
/// _annotations[1].value = &residual;
|
||||
/// omnitrace_user_pop_annotated_region("compute", &_annotations);
|
||||
/// }
|
||||
///
|
||||
/// return residual;
|
||||
/// }
|
||||
/// @endcode
|
||||
/// @typedef omnitrace_annotation omnitrace_annotation_t
|
||||
typedef struct omnitrace_annotation
|
||||
{
|
||||
/// label for annotation
|
||||
const char* name;
|
||||
/// omnitrace_annotation_type_t
|
||||
uintptr_t type;
|
||||
/// data to annotate
|
||||
void* value;
|
||||
} omnitrace_annotation_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OMNITRACE_TYPES_H_
|
||||
@@ -1,117 +0,0 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef OMNITRACE_TYPES_H_
|
||||
#define OMNITRACE_TYPES_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct omnitrace_annotation;
|
||||
typedef int (*omnitrace_trace_func_t)(void);
|
||||
typedef int (*omnitrace_region_func_t)(const char*);
|
||||
typedef int (*omnitrace_annotated_region_func_t)(const char*, omnitrace_annotation*,
|
||||
size_t);
|
||||
|
||||
/// @struct omnitrace_user_callbacks
|
||||
/// @brief Struct containing the callbacks for the user API
|
||||
///
|
||||
/// @typedef omnitrace_user_callbacks omnitrace_user_callbacks_t
|
||||
typedef struct omnitrace_user_callbacks
|
||||
{
|
||||
omnitrace_trace_func_t start_trace;
|
||||
omnitrace_trace_func_t stop_trace;
|
||||
omnitrace_trace_func_t start_thread_trace;
|
||||
omnitrace_trace_func_t stop_thread_trace;
|
||||
omnitrace_region_func_t push_region;
|
||||
omnitrace_region_func_t pop_region;
|
||||
omnitrace_region_func_t progress;
|
||||
omnitrace_annotated_region_func_t push_annotated_region;
|
||||
omnitrace_annotated_region_func_t pop_annotated_region;
|
||||
omnitrace_annotated_region_func_t annotated_progress;
|
||||
|
||||
/// @var start_trace
|
||||
/// @brief callback for enabling tracing globally
|
||||
/// @var stop_trace
|
||||
/// @brief callback for disabling tracing globally
|
||||
/// @var start_thread_trace
|
||||
/// @brief callback for enabling tracing on current thread
|
||||
/// @var stop_thread_trace
|
||||
/// @brief callback for disabling tracing on current thread
|
||||
/// @var push_region
|
||||
/// @brief callback for starting a trace region
|
||||
/// @var pop_region
|
||||
/// @brief callback for ending a trace region
|
||||
/// @var progress
|
||||
/// @brief callback for marking an causal profiling event
|
||||
/// @var push_annotated_region
|
||||
/// @brief callback for starting a trace region + annotations
|
||||
/// @var pop_annotated_region
|
||||
/// @brief callback for ending a trace region + annotations
|
||||
/// @var annotated_progress
|
||||
/// @brief callback for marking an causal profiling event + annotations
|
||||
} omnitrace_user_callbacks_t;
|
||||
|
||||
/// @enum OMNITRACE_USER_CONFIGURE_MODE
|
||||
/// @brief Identifier for errors
|
||||
/// @typedef OMNITRACE_USER_CONFIGURE_MODE omnitrace_user_configure_mode_t
|
||||
typedef enum OMNITRACE_USER_CONFIGURE_MODE
|
||||
{
|
||||
// clang-format off
|
||||
OMNITRACE_USER_UNION_CONFIG = 0, ///< Replace the callbacks in the current config with the non-null callbacks in the provided config
|
||||
OMNITRACE_USER_REPLACE_CONFIG, ///< Replace the entire config even if the provided config has null callbacks
|
||||
OMNITRACE_USER_INTERSECT_CONFIG, ///< Produce a config which is the intersection of the current config and the provided config
|
||||
OMNITRACE_USER_CONFIGURE_MODE_LAST
|
||||
// clang-format on
|
||||
} omnitrace_user_configure_mode_t;
|
||||
|
||||
/// @enum OMNITRACE_USER_ERROR
|
||||
/// @brief Identifier for errors
|
||||
/// @typedef OMNITRACE_USER_ERROR omnitrace_user_error_t
|
||||
///
|
||||
typedef enum OMNITRACE_USER_ERROR
|
||||
{
|
||||
OMNITRACE_USER_SUCCESS = 0, ///< No error
|
||||
OMNITRACE_USER_ERROR_NO_BINDING, ///< Function pointer was not assigned
|
||||
OMNITRACE_USER_ERROR_BAD_VALUE, ///< Provided value was invalid
|
||||
OMNITRACE_USER_ERROR_INVALID_CATEGORY, ///< Invalid user binding category
|
||||
OMNITRACE_USER_ERROR_INTERNAL, ///< Internal error occurred within libomnitrace
|
||||
OMNITRACE_USER_ERROR_LAST
|
||||
} omnitrace_user_error_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef OMNITRACE_USER_CALLBACKS_INIT
|
||||
# define OMNITRACE_USER_CALLBACKS_INIT \
|
||||
{ \
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OMNITRACE_TYPES_H_
|
||||
@@ -1,158 +0,0 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef OMNITRACE_USER_H_
|
||||
#define OMNITRACE_USER_H_
|
||||
|
||||
#if defined(OMNITRACE_USER_SOURCE) && (OMNITRACE_USER_SOURCE > 0)
|
||||
# if !defined(OMNITRACE_PUBLIC_API)
|
||||
# define OMNITRACE_PUBLIC_API __attribute__((visibility("default")))
|
||||
# endif
|
||||
#else
|
||||
# if !defined(OMNITRACE_PUBLIC_API)
|
||||
# define OMNITRACE_PUBLIC_API
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "omnitrace/categories.h"
|
||||
#include "omnitrace/types.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/// @fn int omnitrace_user_start_trace(void)
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Enable tracing on this thread and all subsequently created threads
|
||||
extern int omnitrace_user_start_trace(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_stop_trace(void)
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Disable tracing on this thread and all subsequently created threads
|
||||
extern int omnitrace_user_stop_trace(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_start_thread_trace(void)
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Enable tracing on this specific thread. Does not apply to subsequently
|
||||
/// created threads
|
||||
extern int omnitrace_user_start_thread_trace(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_stop_thread_trace(void)
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Disable tracing on this specific thread. Does not apply to subsequently
|
||||
/// created threads
|
||||
extern int omnitrace_user_stop_thread_trace(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_push_region(const char* id)
|
||||
/// @param id The string identifier for the region
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Start a user defined region.
|
||||
extern int omnitrace_user_push_region(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_pop_region(const char* id)
|
||||
/// @param id The string identifier for the region
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief End a user defined region. In general, user regions should be popped in
|
||||
/// the inverse order that they were pushed, i.e. first-in, last-out (FILO). The
|
||||
/// timemory backend was designed to accommodate asynchronous tasking, where FILO may
|
||||
/// be violated, and will thus compenstate for out-of-order popping, however, the
|
||||
/// perfetto backend will not; thus, out-of-order popping will result in different
|
||||
/// results in timemory vs. perfetto.
|
||||
extern int omnitrace_user_pop_region(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @typedef omnitrace_annotation omnitrace_annotation_t
|
||||
///
|
||||
/// @fn int omnitrace_user_push_annotated_region(const char* id,
|
||||
/// omnitrace_annotation_t* annotations,
|
||||
/// size_t num_annotations)
|
||||
/// @param id The string identifier for the region
|
||||
/// @param annotations Array of @ref omnitrace_annotation instances
|
||||
/// @param num_annotations Number of annotations
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Start a user defined region and adds the annotations to the perfetto trace.
|
||||
extern int omnitrace_user_push_annotated_region(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_pop_annotated_region(const char* id,
|
||||
/// omnitrace_annotation_t* annotations,
|
||||
/// size_t num_annotations)
|
||||
/// @param id The string identifier for the region
|
||||
/// @param annotations Array of @ref omnitrace_annotation instances
|
||||
/// @param num_annotations Number of annotations
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Stop a user defined region and adds the annotations to the perfetto trace.
|
||||
extern int omnitrace_user_pop_annotated_region(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// mark causal progress
|
||||
extern int omnitrace_user_progress(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// mark causal progress with annotations
|
||||
extern int omnitrace_user_annotated_progress(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_configure(omnitrace_user_configure_mode_t mode,
|
||||
/// omnitrace_user_callbacks_t inp,
|
||||
/// omnitrace_user_callbacks_t* out)
|
||||
/// @param[in] mode Specifies how the new callbacks are merged with the old
|
||||
/// callbacks
|
||||
/// @param[in] inp An @ref omnitrace_user_callbacks instance specifying
|
||||
/// the callbacks which should be invoked by the user API.
|
||||
/// @param[out] out Pointer to @ref omnitrace_user_callbacks which,
|
||||
/// when non-NULL, will be assigned the former callbacks.
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Configure the function pointers invoked by the omnitrace user API.
|
||||
/// The initial callbacks are set via the omnitrace-dl library when it is loaded but
|
||||
/// the user can user this feature to turn on/off the user API or customize how the
|
||||
/// the user callbacks occur. For example, the user could maintain one set of
|
||||
/// callbacks which discard any annotation data or redirect all unannotated user
|
||||
/// regions to the annotated user regions with annotations about some global state.
|
||||
/// Changing the callbacks is thread-safe but not thread-local.
|
||||
extern int omnitrace_user_configure(
|
||||
omnitrace_user_configure_mode_t mode, omnitrace_user_callbacks_t inp,
|
||||
omnitrace_user_callbacks_t* out) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn int omnitrace_user_get_callbacks(int category, void** begin_func, void**
|
||||
/// end_func)
|
||||
/// @param[in] category An @ref OMNITRACE_USER_BINDINGS value
|
||||
/// @param[out] begin_func The pointer to the function which corresponds to "starting"
|
||||
/// the category, e.g. omnitrace_user_start_trace or omnitrace_user_push_region
|
||||
/// @param[out] end_func The pointer to the function which corresponds to "ending" the
|
||||
/// category, e.g. omnitrace_user_stop_trace or omnitrace_user_pop_region
|
||||
/// @return omnitrace_user_error_t value
|
||||
/// @brief Get the current function pointers for a given category. The initial values
|
||||
/// are assigned by omnitrace-dl at start up.
|
||||
extern int omnitrace_user_get_callbacks(omnitrace_user_callbacks_t*)
|
||||
OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// @fn const char* omnitrace_user_error_string(int error_category)
|
||||
/// @param error_category OMNITRACE_USER_ERROR value
|
||||
/// @return String descripting the error code
|
||||
/// @brief Return a descriptor for the provided error code
|
||||
extern const char* omnitrace_user_error_string(int) OMNITRACE_PUBLIC_API;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OMNITRACE_USER_H_
|
||||
@@ -1,64 +0,0 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace object library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(omnitrace-object-library OBJECT)
|
||||
add_library(omnitrace::omnitrace-object-library ALIAS omnitrace-object-library)
|
||||
|
||||
target_sources(
|
||||
omnitrace-object-library
|
||||
PRIVATE ${CMAKE_CURRENT_LIST_DIR}/library.cpp ${CMAKE_CURRENT_LIST_DIR}/regions.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/progress.cpp ${CMAKE_CURRENT_LIST_DIR}/api.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/timeout.cpp ${CMAKE_CURRENT_LIST_DIR}/api.hpp)
|
||||
|
||||
add_subdirectory(library)
|
||||
|
||||
target_link_libraries(omnitrace-object-library
|
||||
PRIVATE omnitrace::omnitrace-interface-library)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace static library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(omnitrace-static-library STATIC $<TARGET_OBJECTS:omnitrace-object-library>)
|
||||
add_library(omnitrace::libomnitrace-static ALIAS omnitrace-static-library)
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-static-library
|
||||
PRIVATE omnitrace::omnitrace-interface-library omnitrace::omnitrace-core
|
||||
omnitrace::omnitrace-binary)
|
||||
|
||||
set_target_properties(omnitrace-static-library PROPERTIES OUTPUT_NAME omnitrace)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# omnitrace shared library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
add_library(omnitrace-shared-library SHARED $<TARGET_OBJECTS:omnitrace-object-library>)
|
||||
add_library(omnitrace::libomnitrace-shared ALIAS omnitrace-shared-library)
|
||||
add_library(omnitrace::omnitrace-library ALIAS omnitrace-shared-library)
|
||||
|
||||
target_link_libraries(
|
||||
omnitrace-shared-library
|
||||
PRIVATE omnitrace::omnitrace-interface-library omnitrace::omnitrace-core
|
||||
omnitrace::omnitrace-binary)
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-shared-library
|
||||
PROPERTIES OUTPUT_NAME omnitrace
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
INSTALL_RPATH "${OMNITRACE_LIB_INSTALL_RPATH}")
|
||||
|
||||
omnitrace_strip_target(omnitrace-shared-library)
|
||||
|
||||
install(
|
||||
TARGETS omnitrace-shared-library
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
OPTIONAL)
|
||||
@@ -1,169 +0,0 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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 "api.hpp"
|
||||
#include "core/debug.hpp"
|
||||
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
|
||||
extern "C" void
|
||||
omnitrace_push_trace(const char* _name)
|
||||
{
|
||||
omnitrace_push_trace_hidden(_name);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_pop_trace(const char* _name)
|
||||
{
|
||||
omnitrace_pop_trace_hidden(_name);
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
omnitrace_push_region(const char* _name)
|
||||
{
|
||||
try
|
||||
{
|
||||
omnitrace_push_region_hidden(_name);
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
omnitrace_pop_region(const char* _name)
|
||||
{
|
||||
try
|
||||
{
|
||||
omnitrace_pop_region_hidden(_name);
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
omnitrace_push_category_region(omnitrace_category_t _category, const char* _name,
|
||||
omnitrace_annotation_t* _annotations,
|
||||
size_t _annotation_count)
|
||||
{
|
||||
try
|
||||
{
|
||||
omnitrace_push_category_region_hidden(_category, _name, _annotations,
|
||||
_annotation_count);
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" int
|
||||
omnitrace_pop_category_region(omnitrace_category_t _category, const char* _name,
|
||||
omnitrace_annotation_t* _annotations,
|
||||
size_t _annotation_count)
|
||||
{
|
||||
try
|
||||
{
|
||||
omnitrace_pop_category_region_hidden(_category, _name, _annotations,
|
||||
_annotation_count);
|
||||
} catch(std::exception& _e)
|
||||
{
|
||||
OMNITRACE_WARNING_F(1, "Exception caught: %s\n", _e.what());
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_progress(const char* _name)
|
||||
{
|
||||
omnitrace_progress_hidden(_name);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_annotated_progress(const char* _name, omnitrace_annotation_t* _annotations,
|
||||
size_t _annotation_count)
|
||||
{
|
||||
omnitrace_annotated_progress_hidden(_name, _annotations, _annotation_count);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_init_library(void)
|
||||
{
|
||||
omnitrace_init_library_hidden();
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_init_tooling(void)
|
||||
{
|
||||
omnitrace_init_tooling_hidden();
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_init(const char* _mode, bool _rewrite, const char* _arg0)
|
||||
{
|
||||
omnitrace_init_hidden(_mode, _rewrite, _arg0);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_finalize(void)
|
||||
{
|
||||
omnitrace_finalize_hidden();
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_reset_preload(void)
|
||||
{
|
||||
omnitrace_reset_preload_hidden();
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_set_env(const char* env_name, const char* env_val)
|
||||
{
|
||||
omnitrace_set_env_hidden(env_name, env_val);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_set_mpi(bool use, bool attached)
|
||||
{
|
||||
omnitrace_set_mpi_hidden(use, attached);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_register_source(const char* file, const char* func, size_t line, size_t address,
|
||||
const char* source)
|
||||
{
|
||||
omnitrace_register_source_hidden(file, func, line, address, source);
|
||||
}
|
||||
|
||||
extern "C" void
|
||||
omnitrace_register_coverage(const char* file, const char* func, size_t address)
|
||||
{
|
||||
omnitrace_register_coverage_hidden(file, func, address);
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/defines.hpp"
|
||||
#include "omnitrace/categories.h" // in omnitrace-user
|
||||
|
||||
#include <timemory/compat/macros.h>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
// forward decl of the API
|
||||
extern "C"
|
||||
{
|
||||
/// handles configuration logic
|
||||
void omnitrace_init_library(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// handles configuration logic
|
||||
void omnitrace_init_tooling(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// starts gotcha wrappers
|
||||
void omnitrace_init(const char*, bool, const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// shuts down all tooling and generates output
|
||||
void omnitrace_finalize(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// remove libomnitrace from LD_PRELOAD
|
||||
void omnitrace_reset_preload(void) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// sets an environment variable
|
||||
void omnitrace_set_env(const char*, const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// sets whether MPI should be used
|
||||
void omnitrace_set_mpi(bool, bool) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// starts an instrumentation region
|
||||
void omnitrace_push_trace(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// stops an instrumentation region
|
||||
void omnitrace_pop_trace(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// starts an instrumentation region (user-defined)
|
||||
int omnitrace_push_region(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// stops an instrumentation region (user-defined)
|
||||
int omnitrace_pop_region(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// starts an instrumentation region in a user-defined category and (optionally)
|
||||
/// adds annotations to the perfetto trace.
|
||||
int omnitrace_push_category_region(omnitrace_category_t, const char*,
|
||||
omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// stops an instrumentation region in a user-defined category and (optionally)
|
||||
/// adds annotations to the perfetto trace.
|
||||
int omnitrace_pop_category_region(omnitrace_category_t, const char*,
|
||||
omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// stores source code information
|
||||
void omnitrace_register_source(const char* file, const char* func, size_t line,
|
||||
size_t address,
|
||||
const char* source) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// increments coverage values
|
||||
void omnitrace_register_coverage(const char* file, const char* func,
|
||||
size_t address) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// mark causal progress
|
||||
void omnitrace_progress(const char*) OMNITRACE_PUBLIC_API;
|
||||
|
||||
/// mark causal progress with annotations
|
||||
void omnitrace_annotated_progress(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_PUBLIC_API;
|
||||
|
||||
// these are the real implementations for internal calling convention
|
||||
void omnitrace_init_library_hidden(void) OMNITRACE_HIDDEN_API;
|
||||
bool omnitrace_init_tooling_hidden(void) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_init_hidden(const char*, bool, const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_finalize_hidden(void) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_reset_preload_hidden(void) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_set_env_hidden(const char*, const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_set_mpi_hidden(bool, bool) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_push_trace_hidden(const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_pop_trace_hidden(const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_push_region_hidden(const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_pop_region_hidden(const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_push_category_region_hidden(omnitrace_category_t, const char*,
|
||||
omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_pop_category_region_hidden(omnitrace_category_t, const char*,
|
||||
omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_register_source_hidden(const char*, const char*, size_t, size_t,
|
||||
const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_register_coverage_hidden(const char*, const char*,
|
||||
size_t) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_progress_hidden(const char*) OMNITRACE_HIDDEN_API;
|
||||
void omnitrace_annotated_progress_hidden(const char*, omnitrace_annotation_t*,
|
||||
size_t) OMNITRACE_HIDDEN_API;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
#
|
||||
set(coverage_sources)
|
||||
set(coverage_headers ${CMAKE_CURRENT_LIST_DIR}/impl.hpp)
|
||||
|
||||
target_sources(omnitrace-object-library PRIVATE ${coverage_sources} ${coverage_headers})
|
||||
@@ -1,6 +0,0 @@
|
||||
#
|
||||
if(OMNITRACE_USE_ROCPROFILER OR OMNITRACE_USE_ROCTRACER)
|
||||
target_sources(
|
||||
omnitrace-object-library PRIVATE ${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/hsa_rsrc_factory.cpp)
|
||||
endif()
|
||||
@@ -1,5 +0,0 @@
|
||||
#
|
||||
set(tracing_sources ${CMAKE_CURRENT_LIST_DIR}/annotation.cpp)
|
||||
set(tracing_headers ${CMAKE_CURRENT_LIST_DIR}/annotation.hpp)
|
||||
|
||||
target_sources(omnitrace-object-library PRIVATE ${tracing_sources} ${tracing_headers})
|
||||
@@ -0,0 +1,52 @@
|
||||
# ------------------------------------------------------------------------------#
|
||||
#
|
||||
# rocprofiler-systems dl library
|
||||
#
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
set(CMAKE_SKIP_RPATH OFF)
|
||||
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET "internal")
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library(rocprofiler-systems-dl-library SHARED)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-dl-library ALIAS
|
||||
rocprofiler-systems-dl-library)
|
||||
|
||||
target_sources(
|
||||
rocprofiler-systems-dl-library
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/dl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp)
|
||||
target_include_directories(
|
||||
rocprofiler-systems-dl-library
|
||||
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../rocprof-sys-user>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../rocprof-sys>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
target_link_libraries(
|
||||
rocprofiler-systems-dl-library
|
||||
PUBLIC $<BUILD_INTERFACE:${dl_LIBRARY}>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::common-library>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
|
||||
$<BUILD_INTERFACE:Threads::Threads>)
|
||||
|
||||
add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-ftls-model=global-dynamic")
|
||||
add_target_cxx_flag_if_avail(rocprofiler-systems-dl-library "-g3")
|
||||
|
||||
set_target_properties(
|
||||
rocprofiler-systems-dl-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-dl
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN")
|
||||
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-dl-library)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dl/dl.hpp
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/dl)
|
||||
|
||||
install(TARGETS rocprofiler-systems-dl-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
ファイル差分が大きすぎるため省略します
差分を読み込み
@@ -0,0 +1,212 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// 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.
|
||||
|
||||
#ifndef ROCPROFSYS_DL_HPP_
|
||||
#define ROCPROFSYS_DL_HPP_
|
||||
|
||||
#if defined(ROCPROFSYS_DL_SOURCE) && (ROCPROFSYS_DL_SOURCE > 0)
|
||||
# include "common/defines.h"
|
||||
#else
|
||||
# if !defined(ROCPROFSYS_PUBLIC_API)
|
||||
# define ROCPROFSYS_PUBLIC_API
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "rocprofiler-systems/user.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <dlfcn.h>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_OMPT)
|
||||
# define ROCPROFSYS_USE_OMPT 0
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_ROCTRACER)
|
||||
# define ROCPROFSYS_USE_ROCTRACER 0
|
||||
#endif
|
||||
|
||||
#if !defined(ROCPROFSYS_USE_ROCPROFILER)
|
||||
# define ROCPROFSYS_USE_ROCPROFILER 0
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
// rocprof-sys symbols
|
||||
//
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
extern "C"
|
||||
{
|
||||
void rocprofsys_init_library(void) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_init_tooling(void) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_init(const char*, bool, const char*) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_finalize(void) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_set_env(const char* env_name,
|
||||
const char* env_val) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_set_mpi(bool use, bool attached) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_set_instrumented(int) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_push_trace(const char* name) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_pop_trace(const char* name) ROCPROFSYS_PUBLIC_API;
|
||||
int rocprofsys_push_region(const char*) ROCPROFSYS_PUBLIC_API;
|
||||
int rocprofsys_pop_region(const char*) ROCPROFSYS_PUBLIC_API;
|
||||
int rocprofsys_push_category_region(rocprofsys_category_t, const char*,
|
||||
rocprofsys_annotation_t*,
|
||||
size_t) ROCPROFSYS_PUBLIC_API;
|
||||
int rocprofsys_pop_category_region(rocprofsys_category_t, const char*,
|
||||
rocprofsys_annotation_t*,
|
||||
size_t) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
void rocprofsys_register_source(const char* file, const char* func, size_t line,
|
||||
size_t address,
|
||||
const char* source) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_register_coverage(const char* file, const char* func,
|
||||
size_t address) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_progress(const char*) ROCPROFSYS_PUBLIC_API;
|
||||
void rocprofsys_annotated_progress(const char*, rocprofsys_annotation_t*,
|
||||
size_t) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
#if defined(ROCPROFSYS_DL_SOURCE) && (ROCPROFSYS_DL_SOURCE > 0)
|
||||
void rocprofsys_preinit_library(void) ROCPROFSYS_HIDDEN_API;
|
||||
int rocprofsys_preload_library(void) ROCPROFSYS_HIDDEN_API;
|
||||
|
||||
int rocprofsys_user_start_trace_dl(void) ROCPROFSYS_HIDDEN_API;
|
||||
int rocprofsys_user_stop_trace_dl(void) ROCPROFSYS_HIDDEN_API;
|
||||
|
||||
int rocprofsys_user_start_thread_trace_dl(void) ROCPROFSYS_HIDDEN_API;
|
||||
int rocprofsys_user_stop_thread_trace_dl(void) ROCPROFSYS_HIDDEN_API;
|
||||
|
||||
int rocprofsys_user_push_region_dl(const char*) ROCPROFSYS_HIDDEN_API;
|
||||
int rocprofsys_user_pop_region_dl(const char*) ROCPROFSYS_HIDDEN_API;
|
||||
|
||||
int rocprofsys_user_push_annotated_region_dl(const char*, rocprofsys_annotation_t*,
|
||||
size_t) ROCPROFSYS_HIDDEN_API;
|
||||
int rocprofsys_user_pop_annotated_region_dl(const char*, rocprofsys_annotation_t*,
|
||||
size_t) ROCPROFSYS_HIDDEN_API;
|
||||
|
||||
int rocprofsys_user_progress_dl(const char* name) ROCPROFSYS_HIDDEN_API;
|
||||
int rocprofsys_user_annotated_progress_dl(const char*, rocprofsys_annotation_t*,
|
||||
size_t) ROCPROFSYS_HIDDEN_API;
|
||||
// KokkosP
|
||||
struct ROCPROFSYS_HIDDEN_API SpaceHandle
|
||||
{
|
||||
char name[64];
|
||||
};
|
||||
|
||||
struct ROCPROFSYS_HIDDEN_API Kokkos_Tools_ToolSettings
|
||||
{
|
||||
bool requires_global_fencing;
|
||||
bool padding[255];
|
||||
};
|
||||
|
||||
void kokkosp_print_help(char*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_parse_args(int, char**) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_declare_metadata(const char*, const char*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_request_tool_settings(const uint32_t,
|
||||
Kokkos_Tools_ToolSettings*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_init_library(const int, const uint64_t, const uint32_t,
|
||||
void*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_finalize_library() ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_begin_parallel_for(const char*, uint32_t,
|
||||
uint64_t*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_end_parallel_for(uint64_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_begin_parallel_reduce(const char*, uint32_t,
|
||||
uint64_t*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_end_parallel_reduce(uint64_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_begin_parallel_scan(const char*, uint32_t,
|
||||
uint64_t*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_end_parallel_scan(uint64_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_begin_fence(const char*, uint32_t, uint64_t*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_end_fence(uint64_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_push_profile_region(const char*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_pop_profile_region() ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_create_profile_section(const char*, uint32_t*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_destroy_profile_section(uint32_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_start_profile_section(uint32_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_stop_profile_section(uint32_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_allocate_data(const SpaceHandle, const char*, const void* const,
|
||||
const uint64_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_deallocate_data(const SpaceHandle, const char*, const void* const,
|
||||
const uint64_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_begin_deep_copy(SpaceHandle, const char*, const void*, SpaceHandle,
|
||||
const char*, const void*,
|
||||
uint64_t) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_end_deep_copy() ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_profile_event(const char*) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_dual_view_sync(const char*, const void* const,
|
||||
bool) ROCPROFSYS_PUBLIC_API;
|
||||
void kokkosp_dual_view_modify(const char*, const void* const,
|
||||
bool) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
// OpenMP Tools (OMPT)
|
||||
# if ROCPROFSYS_USE_OMPT > 0
|
||||
struct ompt_start_tool_result_t;
|
||||
|
||||
ompt_start_tool_result_t* ompt_start_tool(unsigned int,
|
||||
const char*) ROCPROFSYS_PUBLIC_API;
|
||||
# endif
|
||||
|
||||
# if ROCPROFSYS_USE_ROCTRACER > 0
|
||||
// HSA
|
||||
struct HsaApiTable;
|
||||
bool OnLoad(HsaApiTable* table, uint64_t runtime_version, uint64_t failed_tool_count,
|
||||
const char* const* failed_tool_names) ROCPROFSYS_PUBLIC_API;
|
||||
void OnUnload() ROCPROFSYS_PUBLIC_API;
|
||||
# endif
|
||||
|
||||
# if ROCPROFSYS_USE_ROCPROFILER > 0
|
||||
// ROCP
|
||||
void OnLoadToolProp(void* settings) ROCPROFSYS_PUBLIC_API;
|
||||
void OnUnloadTool() ROCPROFSYS_PUBLIC_API;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace dl
|
||||
{
|
||||
enum class InstrumentMode : int
|
||||
{
|
||||
None = -1,
|
||||
BinaryRewrite = 0,
|
||||
ProcessCreate = 1, // runtime instrumentation at start of process
|
||||
ProcessAttach = 2, // runtime instrumentation of running process
|
||||
PythonProfile = 3, // python setprofile
|
||||
Last,
|
||||
};
|
||||
}
|
||||
} // namespace rocprofsys
|
||||
|
||||
#endif // ROCPROFSYS_DL_HPP_ 1
|
||||
+27
-27
@@ -1,6 +1,6 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
// Copyright (c) 2022-2024 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#define OMNITRACE_PUBLIC_API __attribute__((visibility("default")));
|
||||
#define OMNITRACE_HIDDEN_API __attribute__((visibility("hidden")));
|
||||
#define OMNITRACE_INTERNAL_API __attribute__((visibility("internal")));
|
||||
#define ROCPROFSYS_PUBLIC_API __attribute__((visibility("default")));
|
||||
#define ROCPROFSYS_HIDDEN_API __attribute__((visibility("hidden")));
|
||||
#define ROCPROFSYS_INTERNAL_API __attribute__((visibility("internal")));
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <stdbool.h>
|
||||
@@ -45,49 +45,49 @@ typedef int (*start_main_t)(int (*)(int, char**, char**), int, char**,
|
||||
// local function declarations
|
||||
//
|
||||
int
|
||||
omnitrace_libc_start_main(int (*)(int, char**, char**), int, char**,
|
||||
int (*)(int, char**, char**), void (*)(void), void (*)(void),
|
||||
void*) OMNITRACE_INTERNAL_API;
|
||||
rocprofsys_libc_start_main(int (*)(int, char**, char**), int, char**,
|
||||
int (*)(int, char**, char**), void (*)(void), void (*)(void),
|
||||
void*) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
int
|
||||
__libc_start_main(int (*)(int, char**, char**), int, char**, int (*)(int, char**, char**),
|
||||
void (*)(void), void (*)(void), void*) OMNITRACE_PUBLIC_API;
|
||||
void (*)(void), void (*)(void), void*) ROCPROFSYS_PUBLIC_API;
|
||||
|
||||
//
|
||||
// external function declarations
|
||||
//
|
||||
extern int
|
||||
omnitrace_preload_library(void);
|
||||
rocprofsys_preload_library(void);
|
||||
|
||||
extern void
|
||||
omnitrace_finalize(void);
|
||||
rocprofsys_finalize(void);
|
||||
|
||||
extern void
|
||||
omnitrace_push_trace(const char* name);
|
||||
rocprofsys_push_trace(const char* name);
|
||||
|
||||
extern void
|
||||
omnitrace_pop_trace(const char* name);
|
||||
rocprofsys_pop_trace(const char* name);
|
||||
|
||||
extern void
|
||||
omnitrace_init_tooling(void);
|
||||
rocprofsys_init_tooling(void);
|
||||
|
||||
extern void
|
||||
omnitrace_init(const char*, bool, const char*);
|
||||
rocprofsys_init(const char*, bool, const char*);
|
||||
|
||||
extern char*
|
||||
basename(const char*);
|
||||
|
||||
extern void omnitrace_set_main(main_func_t) OMNITRACE_INTERNAL_API;
|
||||
extern void rocprofsys_set_main(main_func_t) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
extern int
|
||||
omnitrace_main(int argc, char** argv, char** envp) OMNITRACE_INTERNAL_API;
|
||||
rocprofsys_main(int argc, char** argv, char** envp) ROCPROFSYS_INTERNAL_API;
|
||||
|
||||
int
|
||||
omnitrace_libc_start_main(int (*_main)(int, char**, char**), int _argc, char** _argv,
|
||||
int (*_init)(int, char**, char**), void (*_fini)(void),
|
||||
void (*_rtld_fini)(void), void* _stack_end)
|
||||
rocprofsys_libc_start_main(int (*_main)(int, char**, char**), int _argc, char** _argv,
|
||||
int (*_init)(int, char**, char**), void (*_fini)(void),
|
||||
void (*_rtld_fini)(void), void* _stack_end)
|
||||
{
|
||||
int _preload = omnitrace_preload_library();
|
||||
int _preload = rocprofsys_preload_library();
|
||||
|
||||
// prevent re-entry
|
||||
static int _reentry = 0;
|
||||
@@ -98,13 +98,13 @@ omnitrace_libc_start_main(int (*_main)(int, char**, char**), int _argc, char** _
|
||||
void* _this_func = __builtin_return_address(0);
|
||||
|
||||
// Save the real main function address
|
||||
omnitrace_set_main(_main);
|
||||
rocprofsys_set_main(_main);
|
||||
|
||||
// Find the real __libc_start_main()
|
||||
start_main_t user_main = dlsym(RTLD_NEXT, "__libc_start_main");
|
||||
|
||||
// disable future LD_PRELOADs
|
||||
setenv("OMNITRACE_PRELOAD", "0", 1);
|
||||
setenv("ROCPROFSYS_PRELOAD", "0", 1);
|
||||
|
||||
if(user_main && user_main != _this_func)
|
||||
{
|
||||
@@ -115,14 +115,14 @@ omnitrace_libc_start_main(int (*_main)(int, char**, char**), int _argc, char** _
|
||||
}
|
||||
else
|
||||
{
|
||||
// call omnitrace main function wrapper
|
||||
return user_main(omnitrace_main, _argc, _argv, _init, _fini, _rtld_fini,
|
||||
// call rocprof-sys main function wrapper
|
||||
return user_main(rocprofsys_main, _argc, _argv, _init, _fini, _rtld_fini,
|
||||
_stack_end);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs("Error! omnitrace could not find __libc_start_main!", stderr);
|
||||
fputs("Error! rocprof-sys could not find __libc_start_main!", stderr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -132,6 +132,6 @@ __libc_start_main(int (*_main)(int, char**, char**), int _argc, char** _argv,
|
||||
int (*_init)(int, char**, char**), void (*_fini)(void),
|
||||
void (*_rtld_fini)(void), void* _stack_end)
|
||||
{
|
||||
return omnitrace_libc_start_main(_main, _argc, _argv, _init, _fini, _rtld_fini,
|
||||
_stack_end);
|
||||
return rocprofsys_libc_start_main(_main, _argc, _argv, _init, _fini, _rtld_fini,
|
||||
_stack_end);
|
||||
}
|
||||
+20
-17
@@ -91,45 +91,48 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(omnitrace-rt-library SHARED)
|
||||
add_library(omnitrace::omnitrace-rt-library ALIAS omnitrace-rt-library)
|
||||
add_library(rocprofiler-systems-rt-library SHARED)
|
||||
add_library(rocprofiler-systems::rocprofiler-systems-rt-library ALIAS
|
||||
rocprofiler-systems-rt-library)
|
||||
|
||||
target_sources(omnitrace-rt-library PRIVATE ${SRC_LIST})
|
||||
target_sources(rocprofiler-systems-rt-library PRIVATE ${SRC_LIST})
|
||||
target_include_directories(
|
||||
omnitrace-rt-library PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/h>)
|
||||
target_compile_definitions(omnitrace-rt-library PRIVATE ${UNIFIED_DEFINES})
|
||||
rocprofiler-systems-rt-library
|
||||
PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/h>)
|
||||
target_compile_definitions(rocprofiler-systems-rt-library PRIVATE ${UNIFIED_DEFINES})
|
||||
target_link_libraries(
|
||||
omnitrace-rt-library
|
||||
rocprofiler-systems-rt-library
|
||||
PUBLIC $<BUILD_INTERFACE:${dl_LIBRARY}>
|
||||
PRIVATE omnitrace::omnitrace-threading)
|
||||
PRIVATE rocprofiler-systems::rocprofiler-systems-threading)
|
||||
|
||||
add_target_cxx_flag_if_avail(omnitrace-rt-library "-g3")
|
||||
add_target_cxx_flag_if_avail(rocprofiler-systems-rt-library "-g3")
|
||||
|
||||
set_target_properties(
|
||||
omnitrace-rt-library
|
||||
PROPERTIES OUTPUT_NAME omnitrace-rt
|
||||
rocprofiler-systems-rt-library
|
||||
PROPERTIES OUTPUT_NAME ${BINARY_NAME_PREFIX}-rt
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
BUILD_RPATH "\$ORIGIN"
|
||||
INSTALL_RPATH "\$ORIGIN")
|
||||
|
||||
omnitrace_strip_target(omnitrace-rt-library)
|
||||
rocprofiler_systems_strip_target(rocprofiler-systems-rt-library)
|
||||
|
||||
install(TARGETS omnitrace-rt-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(TARGETS rocprofiler-systems-rt-library DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if(NOT EXISTS ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
|
||||
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
add_custom_target(
|
||||
omnitrace-rt-library-dyninstAPI_RT-symlink ALL
|
||||
${CMAKE_COMMAND} -E create_symlink ../$<TARGET_FILE_NAME:omnitrace-rt-library>
|
||||
rocprofiler-systems-rt-library-dyninstAPI_RT-symlink ALL
|
||||
${CMAKE_COMMAND} -E create_symlink
|
||||
../$<TARGET_FILE_NAME:rocprofiler-systems-rt-library>
|
||||
${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
|
||||
DEPENDS omnitrace-rt-library
|
||||
DEPENDS rocprofiler-systems-rt-library
|
||||
COMMENT
|
||||
"Creating ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} to omnitrace-rt..."
|
||||
"Creating ${CMAKE_SHARED_LIBRARY_PREFIX}dyninstAPI_RT${CMAKE_SHARED_LIBRARY_SUFFIX} to rocprof-sys-rt..."
|
||||
)
|
||||
|
||||
install(
|
||||
+3
-3
@@ -29,14 +29,14 @@ if(INVALID_PLATFORM)
|
||||
OUTPUT_VARIABLE DYNSYSNAME_OUT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE "\n" "" PLATFORM ${DYNSYSNAME_OUT})
|
||||
omnitrace_message(STATUS
|
||||
"-- Attempting to automatically identify platform: ${PLATFORM}")
|
||||
rocprofiler_systems_message(
|
||||
STATUS "-- Attempting to automatically identify platform: ${PLATFORM}")
|
||||
endif()
|
||||
|
||||
list(FIND VALID_PLATFORMS ${PLATFORM} PLATFORM_FOUND)
|
||||
|
||||
if(PLATFORM_FOUND EQUAL -1)
|
||||
omnitrace_message(
|
||||
rocprofiler_systems_message(
|
||||
FATAL_ERROR
|
||||
"Error: unknown platform ${PLATFORM}; please set the PLATFORM environment variable to one of the following options: ${VALID_PLATFORMS}"
|
||||
)
|
||||
変更されたファイルが多すぎるため、一部のファイルは表示されません さらに表示
新しいイシューから参照
ユーザーをブロックする