Use clang-format-18 for source formatting (#256)

* Updating clang-format to v18

- Updates the pre-commit-config
- Formats source files according to the utility

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update format source workflow

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update CONTRIBUTING

* Update comment in .clang-format

* Update CONTRIBUTING.md

* Update helper script

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>
This commit is contained in:
David Galiffi
2025-06-22 08:48:08 -04:00
کامیت شده توسط GitHub
والد e3741f678b
کامیت 1e13b590e7
76فایلهای تغییر یافته به همراه258 افزوده شده و 255 حذف شده
+1 -1
مشاهده پرونده
@@ -1,4 +1,4 @@
# clang-format v11
# clang-format v18
---
Language: Cpp
AccessModifierOffset: -4
@@ -63,7 +63,7 @@ jobs:
fi
source:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -71,16 +71,16 @@ jobs:
run: |
DISTRIB_CODENAME=$(cat /etc/lsb-release | grep DISTRIB_CODENAME | awk -F '=' '{print $NF}')
sudo apt-get update
sudo apt-get install -y software-properties-common wget curl clang-format-11
sudo apt-get install -y software-properties-common wget curl clang-format-18
- name: clang-format
run: |
set +e
FILES=$(find source examples tests -type f | egrep '\.(h|hpp|c|cpp)(|\.in)$')
FORMAT_OUT=$(clang-format-11 -output-replacements-xml ${FILES})
FORMAT_OUT=$(clang-format-18 -output-replacements-xml ${FILES})
RET=$(echo ${FORMAT_OUT} | grep -c '<replacement ')
if [ "${RET}" -ne 0 ]; then
echo -e "\nError! Code not formatted. Detected ${RET} lines\n"
clang-format-11 -i ${FILES}
clang-format-18 -i ${FILES}
git diff
exit ${RET}
fi
+1 -1
مشاهده پرونده
@@ -35,7 +35,7 @@ repos:
- id: end-of-file-fixer # Fix files to have a newline at the end
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v11.1.0 # Version 11 as specified in contributor guide
rev: v18.1.8 # Version 18 as specified in contributor guide
hooks:
- id: clang-format
files: \.(c|cpp|h.*)$
+2 -2
مشاهده پرونده
@@ -51,7 +51,7 @@ By creating a pull request, you agree to the statements made in the [code licens
* Fork the repository and create your branch from `amd-staging`.
* If you've added code that should be tested, add tests.
* Ensure the test suite passes.
* Make sure your code conforms to the format. Use clang-format-11 and/or cmake-format.
* Make sure your code conforms to the format. Use clang-format-18 and/or cmake-format.
* Use clear and descriptive commit messages.
* Submit your PR and work with the reviewer or maintainer to get your PR approved
* Once approved, the PR is brought onto internal CI systems and may be merged into the component during our release cycle, as coordinated by the maintainer.
@@ -77,7 +77,7 @@ By creating a pull request, you agree to the statements made in the [code licens
* Adhere to the coding style used in the project. This includes naming conventions, indentation, and commenting practices.
* Follow the existing directory structure and organization of the codebase.
* Group related files together and maintain a logical hierarchy.
* Use `clang-format-11` and `cmake-format` formatters to ensure consistency.
* Use `clang-format-18` and `cmake-format` formatters to ensure consistency.
### Using pre-commit hooks ###
+1 -2
مشاهده پرونده
@@ -37,8 +37,7 @@ endmacro()
#
# ------------------------------------------------------------------------------#
find_program(ROCPROFSYS_CLANG_FORMAT_EXE NAMES clang-format-11 clang-format-mp-11
clang-format)
find_program(ROCPROFSYS_CLANG_FORMAT_EXE NAMES clang-format-18 clang-format)
find_program(ROCPROFSYS_CMAKE_FORMAT_EXE NAMES cmake-format)
find_program(ROCPROFSYS_BLACK_FORMAT_EXE NAMES black)
+2 -1
مشاهده پرونده
@@ -75,7 +75,8 @@ run(const char* _name, int nchildren)
for(auto& itr : _children)
{
while(itr == 0)
{}
{
}
printf("[%s][%i] performing waitpid(%i, ...)\n", _name, getpid(), itr);
while((_wait_pid = waitpid(itr, &_status, WUNTRACED | WNOHANG)) <= 0)
{
@@ -471,8 +471,8 @@ public:
num_channels = 1;
output_image.pitch[0] = is_roi_valid ? roi_width : widths[0];
channel_sizes[0] = align(output_image.pitch[0] *
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
}
else
{
@@ -481,29 +481,29 @@ public:
output_image.pitch[1] = is_roi_valid ? roi_width : widths[1];
output_image.pitch[2] = is_roi_valid ? roi_width : widths[2];
channel_sizes[0] = align(output_image.pitch[0] *
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
channel_sizes[1] = align(output_image.pitch[1] *
(is_roi_valid ? roi_height : heights[1]),
mem_alignment);
(is_roi_valid ? roi_height : heights[1]),
mem_alignment);
channel_sizes[2] = align(output_image.pitch[2] *
(is_roi_valid ? roi_height : heights[2]),
mem_alignment);
(is_roi_valid ? roi_height : heights[2]),
mem_alignment);
}
break;
case ROCJPEG_OUTPUT_Y:
num_channels = 1;
output_image.pitch[0] = is_roi_valid ? roi_width : widths[0];
channel_sizes[0] = align(output_image.pitch[0] *
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
break;
case ROCJPEG_OUTPUT_RGB:
num_channels = 1;
output_image.pitch[0] = (is_roi_valid ? roi_width : widths[0]) * 3;
channel_sizes[0] = align(output_image.pitch[0] *
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
(is_roi_valid ? roi_height : heights[0]),
mem_alignment);
break;
case ROCJPEG_OUTPUT_RGB_PLANAR:
num_channels = 3;
+3 -3
مشاهده پرونده
@@ -2169,7 +2169,7 @@ main(int argc, char* argv[])
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
#else
numRanks = 1;
myRank = 0;
myRank = 0;
#endif
Kokkos::initialize(argc, argv);
@@ -2246,7 +2246,7 @@ main(int argc, char* argv[])
while((locDom.time() < locDom.stoptime()) && (locDom.cycle() < opts.its))
{
Kokkos::Tools::startSection(_time_incrp);
//CAUSAL_BEGIN("Iteration")
// CAUSAL_BEGIN("Iteration")
TimeIncrement(locDom);
Kokkos::Tools::stopSection(_time_incrp);
@@ -2254,7 +2254,7 @@ main(int argc, char* argv[])
LagrangeLeapFrog(locDom);
Kokkos::Tools::stopSection(_leap_frogp);
CAUSAL_PROGRESS_NAMED("Iteration")
//CAUSAL_END("Iteration")
// CAUSAL_END("Iteration")
if((opts.showProg != 0) && (opts.quiet == 0) && (myRank == 0))
{
+1 -1
مشاهده پرونده
@@ -407,7 +407,7 @@ main(int /*argc*/, char** /*argv*/)
x[j] = norm_temp2 * z[j];
}
} /* end of main iter inv pow meth */
} /* end parallel */
} /* end parallel */
timer_stop(T_BENCH);
/*
@@ -48,7 +48,7 @@ template <typename T>
void
vmul(T* a, T* b, T* c, int N)
{
#pragma omp target map(to : a [0:N], b [0:N]) map(from : c [0:N])
#pragma omp target map(to : a[0 : N], b[0 : N]) map(from : c[0 : N])
#pragma omp teams distribute parallel for
for(int i = 0; i < N; i++)
{
@@ -84,16 +84,11 @@ typedef enum OutputSurfaceMemoryType_enum
#if DBGINFO
# define INFO(X) \
std::clog << "[INF] " \
<< " {" << __func__ << "} " \
<< " " << X << std::endl;
std::clog << "[INF] " << " {" << __func__ << "} " << " " << X << std::endl;
#else
# define INFO(X) ;
#endif
#define ERR(X) \
std::cerr << "[ERR] " \
<< " {" << __func__ << "} " \
<< " " << X << std::endl;
#define ERR(X) std::cerr << "[ERR] " << " {" << __func__ << "} " << " " << X << std::endl;
class RocVideoDecodeException : public std::exception
{
@@ -234,7 +234,7 @@ public:
if(pts)
{
*pts =
(int64_t)(packet_filtered_->pts * default_time_scale_ * time_base_);
(int64_t) (packet_filtered_->pts * default_time_scale_ * time_base_);
pkt_duration_ = packet_filtered_->duration;
}
}
@@ -277,7 +277,7 @@ public:
}
if(pts)
{
*pts = (int64_t)(packet_->pts * default_time_scale_ * time_base_);
*pts = (int64_t) (packet_->pts * default_time_scale_ * time_base_);
pkt_duration_ = packet_->duration;
}
}
@@ -293,8 +293,7 @@ main(int argc, char** argv)
{
_msg << "| " << std::setw(std::get<0>(_w) + 2) << "String";
if(_show) _msg << " | " << std::setw(std::get<1>(_w)) << "Value";
_msg << " | " << std::setw(std::get<2>(_w)) << "Encoding"
<< " |\n";
_msg << " | " << std::setw(std::get<2>(_w)) << "Encoding" << " |\n";
auto _dashes = [](int64_t _n) {
std::stringstream _dss{};
@@ -965,9 +964,9 @@ write_settings_info(std::ostream& os, const array_t<bool, N>& opts,
"C++ MEMBER ACCESSOR", "Python ACCESSOR", "DESCRIPTION", "CATEGORIES",
};
array_t<string_t, size> _keys = { "environ", "value",
"data_type", "static_accessor",
"member_accessor", "python_accessor",
"description", "categories" };
"data_type", "static_accessor",
"member_accessor", "python_accessor",
"description", "categories" };
array_t<bool, size> _center = {
false, true, true, false, false, false, false, false
};
@@ -162,8 +162,8 @@ private:
unique_set exclude_stream = {};
int_stack name_counter;
unique_set value_keys = { "name", "value", "description", "count",
"environ", "max_count", "cmdline", "data_type",
"initial", "categories" };
"environ", "max_count", "cmdline", "data_type",
"initial", "categories" };
};
//======================================================================================//
@@ -48,6 +48,6 @@ struct enumerated_list<TupT<T...>, std::index_sequence<I, Idx...>>
using Tp = tim::component::enumerator_t<I>;
static constexpr bool is_nothing = tim::concepts::is_placeholder<Tp>::value;
using type = typename enumerated_list<
std::conditional_t<is_nothing, type_list<T...>, type_list<T..., Tp>>,
std::index_sequence<Idx...>>::type;
std::conditional_t<is_nothing, type_list<T...>, type_list<T..., Tp>>,
std::index_sequence<Idx...>>::type;
};
@@ -161,7 +161,8 @@ struct setting_serialization<tsettings<Tp>, custom_setting_serializer>
} // namespace tim
template <typename... Tp>
void push(type_list<Tp...>)
void
push(type_list<Tp...>)
{
ROCPROFSYS_FOLD_EXPRESSION(
settings::push_serialize_map_callback<Tp, custom_setting_serializer>());
@@ -171,7 +172,8 @@ void push(type_list<Tp...>)
}
template <typename... Tp>
void pop(type_list<Tp...>)
void
pop(type_list<Tp...>)
{
ROCPROFSYS_FOLD_EXPRESSION(
settings::pop_serialize_map_callback<Tp, custom_setting_serializer>());
@@ -32,7 +32,8 @@
#include <string>
template <typename... Tp>
auto get_categories(type_list<Tp...>)
auto
get_categories(type_list<Tp...>)
{
auto _cleanup = [](std::string _type, const std::string& _pattern) {
auto _pos = std::string::npos;
@@ -122,7 +122,7 @@ int
get_verbose()
{
verbose = get_env("ROCPROFSYS_CAUSAL_VERBOSE",
get_env<int>("ROCPROFSYS_VERBOSE", verbose, false));
get_env<int>("ROCPROFSYS_VERBOSE", verbose, false));
auto _debug = get_env("ROCPROFSYS_CAUSAL_DEBUG",
get_env<bool>("ROCPROFSYS_DEBUG", false, false));
if(_debug) verbose += 8;
@@ -146,16 +146,12 @@ module_function::write_header(std::ostream& os)
auto w2 = std::min<size_t>(get_width()[2], absolute_max_width);
std::stringstream ss;
ss << std::setw(14) << "StartAddress"
<< " " << std::setw(14) << "AddressRange"
<< " " << std::setw(14) << "#Instructions"
<< " " << std::setw(6) << "Ratio"
<< " " << std::setw(7) << "Linkage"
<< " " << std::setw(10) << "Visibility"
<< " " << std::setw(w0 + 8) << std::left << "Module"
<< " " << std::setw(w1 + 8) << std::left << "Function"
<< " " << std::setw(w2 + 8) << std::left << "FunctionSignature"
<< "\n";
ss << std::setw(14) << "StartAddress" << " " << std::setw(14) << "AddressRange" << " "
<< std::setw(14) << "#Instructions" << " " << std::setw(6) << "Ratio" << " "
<< std::setw(7) << "Linkage" << " " << std::setw(10) << "Visibility" << " "
<< std::setw(w0 + 8) << std::left << "Module" << " " << std::setw(w1 + 8)
<< std::left << "Function" << " " << std::setw(w2 + 8) << std::left
<< "FunctionSignature" << "\n";
os << ss.str();
}
@@ -1015,7 +1011,7 @@ module_function::register_coverage(address_space_t* _addr_space,
auto _start_addr = itr.second.start_address;
auto& _signature = itr.second.signature;
auto _trace_entr = rocprofsys_call_expr(_signature.m_file,
_signature.m_name, _start_addr);
_signature.m_name, _start_addr);
auto _entr = _trace_entr.get(_entr_trace);
if(insert_instr(_addr_space, _entr, BPatch_entry, itr.first))
@@ -147,7 +147,7 @@ symtab_data_s symtab_data = {};
std::set<symbol_linkage_t> enabled_linkage = {};
std::set<symbol_visibility_t> enabled_visibility = {};
const std::set<symbol_linkage_t> default_enabled_linkage = { SL_GLOBAL, SL_LOCAL,
SL_UNIQUE };
SL_UNIQUE };
const std::set<symbol_visibility_t> default_enabled_visibility = { SV_DEFAULT, SV_HIDDEN,
SV_INTERNAL,
SV_PROTECTED };
@@ -272,8 +272,8 @@ activate_signal_handlers(const std::vector<sys_signal>& _signals)
TIMEMORY_PRINTF_FATAL(
stderr,
"These were the last %i log entries from rocprof-sys. You can control the "
"number of log entries via the '--log <N>' option or ROCPROFSYS_LOG_COUNT "
"env variable.\n",
"number of log entries via the '--log <N>' option or ROCPROFSYS_LOG_COUNT "
"env variable.\n",
num_log_entries);
if(log_ofs) log_ofs->close();
@@ -1207,8 +1207,7 @@ main(int argc, char** argv)
std::min<size_t>(std::get<0>(tim::utility::console::get_columns()) - 20,
strlen(_cmdv[0]) + 32);
_separator.fill('=');
_separator << "#" << std::setw(_width - 2) << ""
<< "#";
_separator << "#" << std::setw(_width - 2) << "" << "#";
verbprintf(0, "%s\n", _separator.str().c_str());
verbprintf(0, "\n");
verbprintf(0, "Warning! '%s' is not executable!\n", _cmdv[0]);
@@ -1708,7 +1707,7 @@ main(int argc, char** argv)
auto* user_start_func = find_function(app_image, "rocprofsys_user_start_trace",
{ "rocprofsys_user_start_thread_trace" });
auto* user_stop_func = find_function(app_image, "rocprofsys_user_stop_trace",
{ "rocprofsys_user_stop_thread_trace" });
{ "rocprofsys_user_stop_thread_trace" });
#if ROCPROFSYS_USE_MPI > 0 || ROCPROFSYS_USE_MPI_HEADERS > 0
// if any of the below MPI functions are found, enable MPI support
for(const auto* itr :
@@ -114,9 +114,9 @@ get_verbose(parser_data_t& _data)
{
auto& verbose = _data.verbose;
verbose = get_env("ROCPROFSYS_CAUSAL_VERBOSE",
get_env<int>("ROCPROFSYS_VERBOSE", verbose, false));
get_env<int>("ROCPROFSYS_VERBOSE", verbose, false));
auto _debug = get_env("ROCPROFSYS_CAUSAL_DEBUG",
get_env<bool>("ROCPROFSYS_DEBUG", false, false));
get_env<bool>("ROCPROFSYS_DEBUG", false, false));
if(_debug) verbose += 8;
return verbose;
}
+1 -1
مشاهده پرونده
@@ -57,7 +57,7 @@ struct symbol : private tim::unwind::bfd_file::symbol
symbol(const symbol&) = default;
symbol(symbol&&) noexcept = default;
symbol& operator=(const symbol&) = default;
symbol& operator=(const symbol&) = default;
symbol& operator=(symbol&&) noexcept = default;
bool operator==(const symbol&) const;
@@ -34,16 +34,16 @@ namespace
{
template <typename ContainerT, typename... Args>
inline auto
emplace_impl(ContainerT& _c, int, Args&&... _args)
-> decltype(_c.emplace_back(std::forward<Args>(_args)...))
emplace_impl(ContainerT& _c, int,
Args&&... _args) -> decltype(_c.emplace_back(std::forward<Args>(_args)...))
{
return _c.emplace_back(std::forward<Args>(_args)...);
}
template <typename ContainerT, typename... Args>
inline auto
emplace_impl(ContainerT& _c, long, Args&&... _args)
-> decltype(_c.emplace(std::forward<Args>(_args)...))
emplace_impl(ContainerT& _c, long,
Args&&... _args) -> decltype(_c.emplace(std::forward<Args>(_args)...))
{
return _c.emplace(std::forward<Args>(_args)...);
}
+4 -4
مشاهده پرونده
@@ -135,11 +135,11 @@ struct ROCPROFSYS_INTERNAL_API path_type
};
inline path_type(const std::string&);
~path_type() = default;
path_type(const path_type&) = default;
path_type(path_type&&) = default;
~path_type() = default;
path_type(const path_type&) = default;
path_type(path_type&&) = default;
path_type& operator=(const path_type&) = default;
path_type& operator=(path_type&&) = default;
path_type& operator=(path_type&&) = default;
bool exists() const { return m_type < unknown; }
explicit operator bool() const { return exists(); }
@@ -76,11 +76,11 @@ static_buffer_size()
template <typename Tp, typename ContextT = anonymous>
struct static_object
{
static_object() = delete;
~static_object() = delete;
static_object(const static_object&) = delete;
static_object(static_object&&) noexcept = delete;
static_object& operator=(const static_object&) = delete;
static_object() = delete;
~static_object() = delete;
static_object(const static_object&) = delete;
static_object(static_object&&) noexcept = delete;
static_object& operator=(const static_object&) = delete;
static_object& operator=(static_object&&) noexcept = delete;
template <typename... Args>
@@ -67,7 +67,7 @@ public:
: m_data{ std::move(data) }
{}
synchronized(synchronized&& data) noexcept = default;
synchronized(synchronized&& data) noexcept = default;
synchronized& operator=(synchronized&& data) noexcept = default;
// Do not allow this data structure to be copied, std::move only.
@@ -54,8 +54,7 @@ address_range::as_string(int _depth) const
_ss << std::hex;
_ss << std::setw(2 * _depth) << "";
_ss.fill('0');
_ss << "0x" << std::setw(16) << low << "-"
<< "0x" << std::setw(16) << high;
_ss << "0x" << std::setw(16) << low << "-" << "0x" << std::setw(16) << high;
return _ss.str();
}
+3 -2
مشاهده پرونده
@@ -89,8 +89,9 @@ template <typename Tp>
struct can_stringify
{
private:
static constexpr auto sfinae(int)
-> decltype(std::declval<std::ostream&>() << std::declval<Tp>(), bool())
static constexpr auto sfinae(int) -> decltype(std::declval<std::ostream&>()
<< std::declval<Tp>(),
bool())
{
return true;
}
+4 -4
مشاهده پرونده
@@ -1292,7 +1292,8 @@ get_use_sampling_cputime()
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
std::set<int> get_sampling_signals(int64_t)
std::set<int>
get_sampling_signals(int64_t)
{
auto _v = std::set<int>{};
if(get_use_causal())
@@ -1561,7 +1562,7 @@ print_settings(
{
size_t _wextra = (_md && i < 2) ? 2 : 0;
_widths.at(i) = std::max<size_t>(_widths.at(i),
_data.back().at(i).length() + _wextra);
_data.back().at(i).length() + _wextra);
}
}
}
@@ -1593,8 +1594,7 @@ print_settings(
_spacer_extra -= 1;
std::stringstream _spacer{};
_spacer.fill('-');
_spacer << "#" << std::setw(tot_width + _spacer_extra) << ""
<< "#";
_spacer << "#" << std::setw(tot_width + _spacer_extra) << "" << "#";
_os << _spacer.str() << "\n";
for(const auto& itr : _data)
{
@@ -262,7 +262,8 @@ spec::operator()(const stages& _stages) const
auto _del = (_dur * units::sec);
auto _end = _now + _del;
while(get_clock_now(_spec.clock_id.value) < _end && (_ret = _func(_spec)))
{}
{
}
return _ret;
};
@@ -275,7 +276,8 @@ spec::operator()(const stages& _stages) const
if(_stages.init(_spec) && _wait(_stages.wait, _spec.delay) &&
_stages.start(_spec) && _wait(_stages.collect, _spec.duration) &&
_stages.stop(_spec))
{}
{
}
else
{
break;
@@ -69,10 +69,10 @@ struct aligned_static_vector
using size_type = size_t;
using difference_type = std::ptrdiff_t;
aligned_static_vector() = default;
aligned_static_vector(const aligned_static_vector&) = default;
aligned_static_vector(aligned_static_vector&&) noexcept = default;
aligned_static_vector& operator=(const aligned_static_vector&) = default;
aligned_static_vector() = default;
aligned_static_vector(const aligned_static_vector&) = default;
aligned_static_vector(aligned_static_vector&&) noexcept = default;
aligned_static_vector& operator=(const aligned_static_vector&) = default;
aligned_static_vector& operator=(aligned_static_vector&&) noexcept = default;
aligned_static_vector(size_t _n, Tp _v = {});
@@ -44,9 +44,9 @@ struct c_array
, m_size{ _size }
{}
~c_array() = default;
c_array(const c_array&) = default;
c_array& operator=(const c_array&) = default;
~c_array() = default;
c_array(const c_array&) = default;
c_array& operator=(const c_array&) = default;
c_array& operator=(c_array&&) noexcept = default;
// Get the size of the wrapped array
@@ -51,10 +51,10 @@ struct static_vector
using size_type = size_t;
using difference_type = std::ptrdiff_t;
static_vector() = default;
static_vector(const static_vector&) = default;
static_vector(static_vector&&) noexcept = default;
static_vector& operator=(const static_vector&) = default;
static_vector() = default;
static_vector(const static_vector&) = default;
static_vector(static_vector&&) noexcept = default;
static_vector& operator=(const static_vector&) = default;
static_vector& operator=(static_vector&&) noexcept = default;
static_vector(size_t _n, Tp _v = {});
+1 -1
مشاهده پرونده
@@ -56,7 +56,7 @@ std::atomic<FILE*>&
get_file_pointer()
{
static auto _v = std::atomic<FILE*>{ []() {
const auto&_fname= get_file_name();
const auto& _fname = get_file_name();
if(!_fname.empty()) tim::log::monochrome() = true;
return (_fname.empty())
? stderr
@@ -28,17 +28,17 @@
#if !defined(ROCPROFSYS_DEFAULT_OBJECT)
# define ROCPROFSYS_DEFAULT_OBJECT(NAME) \
NAME() = default; \
NAME(const NAME&) = default; \
NAME(NAME&&) noexcept = default; \
NAME& operator=(const NAME&) = default; \
NAME() = default; \
NAME(const NAME&) = default; \
NAME(NAME&&) noexcept = default; \
NAME& operator=(const NAME&) = default; \
NAME& operator=(NAME&&) noexcept = default;
#endif
#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; \
NAME(const NAME&) = default; \
NAME(NAME&&) noexcept = default; \
NAME& operator=(const NAME&) = default; \
NAME& operator=(NAME&&) noexcept = default;
#endif
@@ -38,10 +38,10 @@ find_library_path(const std::string& _name, const std::vector<std::string>& _env
struct dynamic_library
{
dynamic_library() = delete;
dynamic_library(const dynamic_library&) = delete;
dynamic_library(dynamic_library&&) noexcept = default;
dynamic_library& operator=(const dynamic_library&) = delete;
dynamic_library() = delete;
dynamic_library(const dynamic_library&) = delete;
dynamic_library(dynamic_library&&) noexcept = default;
dynamic_library& operator=(const dynamic_library&) = delete;
dynamic_library& operator=(dynamic_library&&) noexcept = default;
dynamic_library(std::string _env, std::string _fname,
@@ -92,7 +92,7 @@ exception<Tp>::operator=(const exception& _rhs)
if(this != &_rhs)
{
Tp::operator=(_rhs);
m_what = strdup(_rhs.m_what);
m_what = strdup(_rhs.m_what);
}
return *this;
}
@@ -39,7 +39,7 @@ public:
~exception() override;
exception(exception&&) noexcept = default;
exception(exception&&) noexcept = default;
exception& operator=(exception&&) noexcept = default;
exception(const exception&);
+12 -8
مشاهده پرونده
@@ -92,12 +92,12 @@ struct dummy_data_type
# if defined(MPICH) && (MPICH > 0)
static constexpr bool is_mpich = true;
# else
static constexpr bool is_mpich = false;
static constexpr bool is_mpich = false;
# endif
# if defined(OPEN_MPI) && (OPEN_MPI > 0)
static constexpr bool is_openmpi = true;
# else
static constexpr bool is_openmpi = false;
static constexpr bool is_openmpi = false;
# endif
#endif
@@ -116,9 +116,9 @@ static const comm_t comm_world_v = nullptr;
static const comm_t comm_self_v = nullptr;
static const info_t info_null_v = nullptr;
# else
static const comm_t comm_world_v = MPI_COMM_WORLD;
static const comm_t comm_self_v = MPI_COMM_SELF;
static const info_t info_null_v = MPI_INFO_NULL;
static const comm_t comm_world_v = MPI_COMM_WORLD;
static const comm_t comm_self_v = MPI_COMM_SELF;
static const info_t info_null_v = MPI_INFO_NULL;
# endif
static const int success_v = MPI_SUCCESS;
static const int comm_type_shared_v = MPI_COMM_TYPE_SHARED;
@@ -236,7 +236,7 @@ quiet()
//--------------------------------------------------------------------------------------//
#if !defined(ROCPROFSYS_MPI_ERROR_FUNCTION)
# define ROCPROFSYS_MPI_ERROR_FUNCTION(FUNC, ...) # FUNC
# define ROCPROFSYS_MPI_ERROR_FUNCTION(FUNC, ...) #FUNC
#endif
#if !defined(ROCPROFSYS_MPI_ERROR_CHECK)
@@ -454,8 +454,12 @@ size(comm_t comm)
return std::max(_size, (int32_t) 1);
}
void set_rank(int32_t, comm_t) {}
void set_size(int32_t, comm_t) {}
void
set_rank(int32_t, comm_t)
{}
void
set_size(int32_t, comm_t)
{}
#else
+21 -21
مشاهده پرونده
@@ -61,7 +61,7 @@ enum class sample : uint64_t
#if defined(PERF_SAMPLE_READ)
read = PERF_SAMPLE_READ,
#else
read = 0,
read = 0,
#endif
callchain = PERF_SAMPLE_CALLCHAIN,
@@ -70,61 +70,61 @@ enum class sample : uint64_t
#if defined(PERF_SAMPLE_BRANCH_STACK)
branch_stack = PERF_SAMPLE_BRANCH_STACK,
#else
branch_stack = 0,
branch_stack = 0,
#endif
#if defined(PERF_SAMPLE_REGS_USER)
regs = PERF_SAMPLE_REGS_USER,
#else
regs = 0,
regs = 0,
#endif
#if defined(PERF_SAMPLE_STACK_USER)
stack = PERF_SAMPLE_STACK_USER,
#else
stack = 0,
stack = 0,
#endif
#if defined(PERF_SAMPLE_WEIGHT)
weight = PERF_SAMPLE_WEIGHT,
#else
weight = 0,
weight = 0,
#endif
#if defined(PERF_SAMPLE_DATA_SRC)
data_src = PERF_SAMPLE_DATA_SRC,
#else
data_src = 0,
data_src = 0,
#endif
#if defined(PERF_SAMPLE_IDENTIFIER)
identifier = PERF_SAMPLE_IDENTIFIER,
#else
identifier = 0,
identifier = 0,
#endif
#if defined(PERF_SAMPLE_TRANSACTION)
transaction = PERF_SAMPLE_TRANSACTION,
#else
transaction = 0,
transaction = 0,
#endif
#if defined(PERF_SAMPLE_REGS_INTR)
regs_intr = PERF_SAMPLE_REGS_INTR,
#else
regs_intr = 0,
regs_intr = 0,
#endif
#if defined(PERF_SAMPLE_PHYS_ADDR)
phys_addr = PERF_SAMPLE_PHYS_ADDR,
#else
phys_addr = 0,
phys_addr = 0,
#endif
#if defined(PERF_SAMPLE_CGROUP)
cgroup = PERF_SAMPLE_CGROUP,
#else
cgroup = 0,
cgroup = 0,
#endif
last = PERF_SAMPLE_MAX
@@ -213,31 +213,31 @@ enum class record_type
#if defined(PERF_RECORD_MMAP2)
mmap2 = PERF_RECORD_MMAP2,
#else
mmap2 = 0,
mmap2 = 0,
#endif
#if defined(PERF_RECORD_AUX)
aux = PERF_RECORD_AUX,
#else
aux = 0,
aux = 0,
#endif
#if defined(PERF_RECORD_ITRACE_START)
itrace_start = PERF_RECORD_ITRACE_START,
#else
itrace_start = 0,
itrace_start = 0,
#endif
#if defined(PERF_RECORD_LOST_SAMPLES)
lost_samples = PERF_RECORD_LOST_SAMPLES,
#else
lost_samples = 0,
lost_samples = 0,
#endif
#if defined(PERF_RECORD_SWITCH)
switch_record = PERF_RECORD_SWITCH,
#else
switch_record = 0,
switch_record = 0,
#endif
#if defined(PERF_RECORD_SWITCH_CPU_WIDE)
@@ -249,31 +249,31 @@ enum class record_type
#if defined(PERF_RECORD_NAMESPACES)
namespaces = PERF_RECORD_NAMESPACES,
#else
namespaces = 0,
namespaces = 0,
#endif
#if defined(PERF_RECORD_KSYMBOL)
ksymbol = PERF_RECORD_KSYMBOL,
#else
ksymbol = 0,
ksymbol = 0,
#endif
#if defined(PERF_RECORD_BPF_EVENT)
bpf_event = PERF_RECORD_BPF_EVENT,
#else
bpf_event = 0,
bpf_event = 0,
#endif
#if defined(PERF_RECORD_CGROUP)
cgroup = PERF_RECORD_CGROUP,
#else
cgroup = 0,
cgroup = 0,
#endif
#if defined(PERF_RECORD_TEXT_POKE)
text_poke = PERF_RECORD_TEXT_POKE,
#else
text_poke = 0,
text_poke = 0,
#endif
};
@@ -476,14 +476,13 @@ std::unordered_set<rocprofiler_buffer_tracing_kind_t>
get_buffered_domains()
{
const auto buffer_tracing_info = rocprofiler::sdk::get_buffer_tracing_names();
const auto supported = std::unordered_set<rocprofiler_buffer_tracing_kind_t>
{
const auto supported = std::unordered_set<rocprofiler_buffer_tracing_kind_t>{
ROCPROFILER_BUFFER_TRACING_KERNEL_DISPATCH,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
ROCPROFILER_BUFFER_TRACING_MEMORY_COPY,
# if(ROCPROFILER_VERSION < 10000)
ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION,
ROCPROFILER_BUFFER_TRACING_PAGE_MIGRATION,
# endif
ROCPROFILER_BUFFER_TRACING_SCRATCH_MEMORY,
ROCPROFILER_BUFFER_TRACING_SCRATCH_MEMORY,
};
auto _data = std::unordered_set<rocprofiler_buffer_tracing_kind_t>{};
+4 -4
مشاهده پرونده
@@ -31,16 +31,16 @@ namespace
{
template <typename ContainerT, typename Arg>
auto
emplace_impl(ContainerT& _targ, Arg&& _v, int)
-> decltype(_targ.emplace(std::forward<Arg>(_v)))
emplace_impl(ContainerT& _targ, Arg&& _v,
int) -> decltype(_targ.emplace(std::forward<Arg>(_v)))
{
return _targ.emplace(std::forward<Arg>(_v));
}
template <typename ContainerT, typename Arg>
auto
emplace_impl(ContainerT& _targ, Arg&& _v, long)
-> decltype(_targ.emplace_back(std::forward<Arg>(_v)))
emplace_impl(ContainerT& _targ, Arg&& _v,
long) -> decltype(_targ.emplace_back(std::forward<Arg>(_v)))
{
return _targ.emplace_back(std::forward<Arg>(_v));
}
@@ -81,7 +81,7 @@ typedef unsigned __int8 uint8_t;
# if defined(arch_x86_64) || defined(arch_64bit)
# define TYPE64BIT
# endif
typedef long double double128_t;
typedef long double double128_t;
# elif defined(os_freebsd)
# if !defined(__STDC_CONSTANT_MACROS)
@@ -136,7 +136,7 @@ typedef int64_t time64;
# if defined(__cplusplus)
# include "h/dyntypes.h"
using namespace Dyninst;
static const Address ADDR_NULL = (Address)(0);
static const Address ADDR_NULL = (Address) (0);
# else
# define ADDR_NULL (0)
typedef unsigned long Address;
@@ -152,9 +152,9 @@ typedef long long int RegValue; /* register content 64-bit */
/* This needs to be an int since it is sometimes used to pass offsets
to the code generator (i.e. if-statement) - jkh 5/24/99 */
typedef unsigned int Register; /* a register number, e.g., [0..31] */
static const Register Null_Register = (Register)(-1); /* '255' */
static const Register Null_Register = (Register) (-1); /* '255' */
/* Easily noticeable name... */
static const Register REG_NULL = (Register)(-1);
static const Register REG_NULL = (Register) (-1);
// Virtual Memory Map -- shared between platforms
# define PREMS_PRIVATE (1 << 4)
@@ -91,10 +91,10 @@ typedef DWORD psaddr_t; // for breakpoints; match the debug struct
# define NULL_THR_ID INVALID_HANDLE_VALUE
# define DYNINST_SINGLETHREADED INVALID_HANDLE_VALUE
# else
typedef int PID;
typedef int PROC_HANDLE;
typedef int LWP;
typedef long THR_ID;
typedef int PID;
typedef int PROC_HANDLE;
typedef int LWP;
typedef long THR_ID;
# define NULL_PID -1
# define NULL_LWP -1
@@ -273,7 +273,7 @@ DYNINST_instForkEntry()
DLLEXPORT void
DYNINST_instForkExit(void* arg1)
{
//#warning "This function is not implemented for AARCH64 yet!"
// #warning "This function is not implemented for AARCH64 yet!"
#if !defined(arch_aarch64)
tc_lock_lock(&DYNINST_trace_lock);
@@ -306,7 +306,7 @@ DYNINST_instForkExit(void* arg1)
DLLEXPORT void
DYNINST_instExecEntry(void* arg1)
{
//#warning "This function is not implemented for AARCH64 yet!"
// #warning "This function is not implemented for AARCH64 yet!"
#if !defined(arch_aarch64)
tc_lock_lock(&DYNINST_trace_lock);
@@ -446,7 +446,7 @@ cacheLookup(void* calculation)
* bit 1: true if interpAsTarget
* bit 2: true if interpAsReturnAddr
**/
//#define STACKDUMP
// #define STACKDUMP
void
DYNINST_stopThread(void* pointAddr, void* callBackID, void* flags, void* calculation)
{
@@ -61,7 +61,7 @@ map_region(void* addr, int len, int fd)
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, lastError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)(lpMessage), 0, NULL);
(LPTSTR) (lpMessage), 0, NULL);
fprintf(stderr, "VirtualAlloc failed in RTlib: %s\n", lpMessage);
LocalFree((LPVOID) lpMessage);
}
@@ -377,8 +377,8 @@ DYNINST_am_initial_thread(dyntid_t tid)
# define UC_PC(x) x->uc_mcontext.uc_regs->gregs[32]
# endif // power
# elif defined(arch_aarch64)
//#warning "UC_PC: in aarch64, pc is not directly accessable."
// aarch64 pc is not one of 31 GPRs, but an independent reg
// #warning "UC_PC: in aarch64, pc is not directly accessable."
// aarch64 pc is not one of 31 GPRs, but an independent reg
# define UC_PC(x) x->uc_mcontext.pc
# endif // UC_PC
@@ -55,7 +55,7 @@ struct MemoryMapper RTmemoryMapper = { 0, 0, 0, 0, { { 0 } } };
#endif
extern FILE* stOut;
//#define DEBUG_MEM_EM
// #define DEBUG_MEM_EM
unsigned long
RTtranslateMemory(unsigned long input, unsigned long origAddr, unsigned long currAddr)
@@ -28,7 +28,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
//#warning "This file is not implemented yet!"
// #warning "This file is not implemented yet!"
#if defined(DYNINST_RT_STATIC_LIB)
@@ -37,19 +37,19 @@
void (*DYNINSTctors_addr)(void);
void (*DYNINSTdtors_addr)(void);
//#if defined(MUTATEE64)
// static const unsigned long long CTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long CTOR_LIST_START = 0xffffffffffffffffULL;
// static const unsigned long long DTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long DTOR_LIST_START = 0xffffffffffffffffULL;
//#else
// #if defined(MUTATEE64)
// static const unsigned long long CTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long CTOR_LIST_START = 0xffffffffffffffffULL;
// static const unsigned long long DTOR_LIST_TERM = 0x0000000000000000ULL;
// static const unsigned long long DTOR_LIST_START = 0xffffffffffffffffULL;
// #else
/*
static const unsigned CTOR_LIST_TERM = 0x00000000;
static const unsigned CTOR_LIST_START = 0xffffffff;
static const unsigned DTOR_LIST_TERM = 0x00000000;
static const unsigned DTOR_LIST_START = 0xffffffff;
*/
//#endif
// #endif
extern void
DYNINSTBaseInit();
@@ -68,14 +68,14 @@ DYNINSTBaseInit();
void
DYNINSTglobal_ctors_handler()
{
//#warning "This function is not implemented yet!"
// #warning "This function is not implemented yet!"
assert(0);
}
void
DYNINSTglobal_dtors_handler()
{
//#warning "This function is not implemented yet!"
// #warning "This function is not implemented yet!"
assert(0);
}
@@ -119,7 +119,7 @@ DYNINSTglobal_irel_handler()
long (*ptr)(void) = 0;
long result = 0;
if(rel->info != 0x2a) continue;
ptr = (funcptr)(*rel->offset);
ptr = (funcptr) (*rel->offset);
result = ptr();
*(rel->offset) = result;
}
@@ -45,7 +45,7 @@ extern int DYNINST_multithread_capable;
typedef dyninst_lock_t tc_lock_t;
#define DECLARE_TC_LOCK(l) tc_lock_t l = { 0, (dyntid_t) -1 }
#define DECLARE_TC_LOCK(l) tc_lock_t l = { 0, (dyntid_t) - 1 }
int
tc_lock_init(tc_lock_t*);
@@ -363,10 +363,10 @@ getStaticTrapMap(unsigned long addr, unsigned long* allocBase)
// see if the last section has been tagged with "DYNINST_REWRITE"
numSections = peHdr->FileHeader.NumberOfSections;
curSecn = *(PIMAGE_SECTION_HEADER)(((unsigned char*) peHdr) + sizeof(DWORD) +
sizeof(IMAGE_FILE_HEADER) +
peHdr->FileHeader.SizeOfOptionalHeader +
sizeof(IMAGE_SECTION_HEADER) * (numSections - 1));
curSecn = *(PIMAGE_SECTION_HEADER) (((unsigned char*) peHdr) + sizeof(DWORD) +
sizeof(IMAGE_FILE_HEADER) +
peHdr->FileHeader.SizeOfOptionalHeader +
sizeof(IMAGE_SECTION_HEADER) * (numSections - 1));
// fprintf(stderr, "RTLIB: PE section header address = %lx\n", curSecn);
// fprintf(stderr, "curSecn.chars = %lx %s[%d]\n",curSecn.Characteristics,
@@ -41,7 +41,7 @@
# if !defined(ROCPROFSYS_CAUSAL_LABEL)
/** @cond ROCPROFSYS_HIDDEN_DEFINES */
# define ROCPROFSYS_CAUSAL_STR2(x) # x
# define ROCPROFSYS_CAUSAL_STR2(x) #x
# define ROCPROFSYS_CAUSAL_STR(x) ROCPROFSYS_CAUSAL_STR2(x)
/** @endcond */
/** Default label for a causal progress point */
@@ -165,7 +165,9 @@ inline void
post_process()
{}
inline void set_state(State) {}
inline void
set_state(State)
{}
#endif
} // namespace amd_smi
} // namespace rocprofsys
@@ -82,7 +82,7 @@ struct backtrace : comp::empty_base
backtrace(const backtrace&) = default;
backtrace(backtrace&&) noexcept = default;
backtrace& operator=(const backtrace&) = default;
backtrace& operator=(const backtrace&) = default;
backtrace& operator=(backtrace&&) noexcept = default;
void sample(int = -1);
@@ -82,13 +82,13 @@ auto speedup_dist = []() {
size_t _n = std::max<size_t>(1, 100 / speedup_divisions);
std::vector<uint16_t> _v(_n, uint16_t{ 0 });
std::generate(_v.begin(), _v.end(),
[_value = 0]() mutable { return (_value += speedup_divisions); });
[_value = 0]() mutable { return (_value += speedup_divisions); });
// approximately 25% of bins should be zero speedup
size_t _nzero = std::ceil(_v.size() / 4.0);
_v.resize(_v.size() + _nzero, 0);
std::sort(_v.begin(), _v.end());
ROCPROFSYS_CI_THROW(_v.back() > 100, "Error! last value is too large: %i\n",
(int) _v.back());
(int) _v.back());
return _v;
}();
@@ -899,7 +899,7 @@ get_line_info(uintptr_t _addr, bool _include_discarded)
// make sure the address is in the coarse grained mapped regions
// before performing an exhaustive search
bool _is_mapped = std::find_if(litr.mappings.begin(), litr.mappings.end(),
[_addr](const auto& mitr) {
[_addr](const auto& mitr) {
return address_range_t{ mitr.load_address,
mitr.last_address }
.contains(_addr);
@@ -939,7 +939,7 @@ get_line_info(uintptr_t _addr, bool _include_discarded)
if(!_ipaddr.contains(itr.ipaddr()))
ROCPROFSYS_THROW(
"Error! debug line info ipaddr (%s) is not contained in "
"symbol ipaddr (%s)",
"symbol ipaddr (%s)",
as_hex(itr.ipaddr()).c_str(), as_hex(_ipaddr).c_str());
if(itr.ipaddr().contains(_addr)) _debug_data.emplace_back(itr);
}
@@ -462,7 +462,8 @@ sampling_signals()
} // namespace
template <typename ScopeT>
void pause(ScopeT)
void
pause(ScopeT)
{
static_assert(
tim::is_one_of<ScopeT,
@@ -501,7 +502,8 @@ void pause(ScopeT)
}
template <typename ScopeT>
void resume(ScopeT)
void
resume(ScopeT)
{
static_assert(
tim::is_one_of<ScopeT,
@@ -65,7 +65,7 @@ struct backtrace : comp::empty_base
backtrace(const backtrace&) = default;
backtrace(backtrace&&) noexcept = default;
backtrace& operator=(const backtrace&) = default;
backtrace& operator=(const backtrace&) = default;
backtrace& operator=(backtrace&&) noexcept = default;
static std::vector<entry_type> filter_and_patch(const std::vector<entry_type>&);
@@ -148,7 +148,8 @@ backtrace_metrics::stop()
namespace
{
template <typename... Tp>
auto get_enabled(tim::type_list<Tp...>)
auto
get_enabled(tim::type_list<Tp...>)
{
constexpr size_t N = sizeof...(Tp);
auto _v = std::bitset<N>{};
@@ -77,7 +77,7 @@ struct backtrace_metrics : comp::empty_base
backtrace_metrics(const backtrace_metrics&) = default;
backtrace_metrics(backtrace_metrics&&) noexcept = default;
backtrace_metrics& operator=(const backtrace_metrics&) = default;
backtrace_metrics& operator=(const backtrace_metrics&) = default;
backtrace_metrics& operator=(backtrace_metrics&&) noexcept = default;
static void configure(bool, int64_t _tid = threading::get_id());
@@ -140,7 +140,8 @@ backtrace_metrics::get_valid(type_list<Tp>, valid_array_t _valid)
}
template <typename Tp>
bool backtrace_metrics::operator()(type_list<Tp>) const
bool
backtrace_metrics::operator()(type_list<Tp>) const
{
static_assert(!concepts::is_type_listing<Tp>::value,
"Error! invalid call with tuple");
@@ -157,7 +158,8 @@ backtrace_metrics::get_valid(Tp, valid_array_t _valid)
}
template <typename Tp>
bool backtrace_metrics::operator()(Tp) const
bool
backtrace_metrics::operator()(Tp) const
{
return (*this)(type_list<Tp>{});
}
@@ -50,7 +50,7 @@ struct backtrace_timestamp : comp::empty_base
backtrace_timestamp(const backtrace_timestamp&) = default;
backtrace_timestamp(backtrace_timestamp&&) noexcept = default;
backtrace_timestamp& operator=(const backtrace_timestamp&) = default;
backtrace_timestamp& operator=(const backtrace_timestamp&) = default;
backtrace_timestamp& operator=(backtrace_timestamp&&) noexcept = default;
bool operator<(const backtrace_timestamp& rhs) const;
@@ -73,7 +73,7 @@ struct callchain : comp::empty_base
callchain(const callchain&) = default;
callchain(callchain&&) noexcept = default;
callchain& operator=(const callchain&) = default;
callchain& operator=(const callchain&) = default;
callchain& operator=(callchain&&) noexcept = default;
static std::vector<ts_entry_vec_t> filter_and_patch(
@@ -60,7 +60,8 @@ using cpu_data_tuple_t = std::tuple<size_t, int64_t, int64_t, int64_t, int64_t,
std::deque<cpu_data_tuple_t> data = {};
template <typename... Types>
void init_perfetto_counter_tracks(type_list<Types...>)
void
init_perfetto_counter_tracks(type_list<Types...>)
{
(perfetto_counter_track<Types>::init(), ...);
}
@@ -74,7 +74,7 @@ struct ompt : comp::base<ompt, void>
ompt(const ompt&) = default;
ompt(ompt&&) noexcept = default;
ompt& operator=(const ompt&) = default;
ompt& operator=(const ompt&) = default;
ompt& operator=(ompt&&) noexcept = default;
template <typename... Args>
@@ -178,8 +178,8 @@ perf_event::open(struct perf_event_attr& _pe, pid_t _pid, int _cpu)
ROCPROFSYS_RETURN_ERROR_MSG(
true, "Failed to open perf event. Consider tweaking "
<< path << " to 2 or less "
<< "(current value is " << value << "), "
<< path << " to 2 or less " << "(current value is " << value
<< "), "
<< "or run rocprof-sys as a privileged user (with CAP_SYS_ADMIN).");
}
@@ -61,7 +61,7 @@ struct perf_event
/// Move assignment is supported
perf_event& operator=(perf_event&& other) noexcept;
perf_event(const perf_event&) = delete;
perf_event(const perf_event&) = delete;
perf_event& operator=(const perf_event&) = delete;
/// Open a perf_event file using the given options structure
@@ -108,15 +108,15 @@ struct perf_event
{
friend class perf_event::iterator;
record() = default;
~record() = default;
record(const record&) = default;
record(record&&) noexcept = default;
record& operator=(const record&) = default;
record() = default;
~record() = default;
record(const record&) = default;
record(record&&) noexcept = default;
record& operator=(const record&) = default;
record& operator=(record&&) noexcept = default;
bool is_valid() const { return (m_source != nullptr && m_header != nullptr); }
operator bool() const { return is_valid(); }
operator bool() const { return is_valid(); }
record_type get_type() const { return static_cast<record_type>(m_header->type); }
@@ -1085,18 +1085,18 @@ tool_init(rocprofiler_client_finalize_t fini_func, void* user_data)
for(auto itr : {
ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API,
ROCPROFILER_CALLBACK_TRACING_RCCL_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API,
ROCPROFILER_CALLBACK_TRACING_RCCL_API,
#if(ROCPROFILER_VERSION >= 600)
ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API,
ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API,
#endif
#if(ROCPROFILER_VERSION >= 700)
ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API,
ROCPROFILER_CALLBACK_TRACING_ROCJPEG_API,
#endif
})
{
@@ -93,11 +93,11 @@ struct counter_storage
counter_storage(const client_data* _tool_data, uint64_t _devid, size_t _idx,
std::string_view _name);
~counter_storage() = default;
counter_storage(const counter_storage&) = delete;
counter_storage(counter_storage&&) = default;
~counter_storage() = default;
counter_storage(const counter_storage&) = delete;
counter_storage(counter_storage&&) = default;
counter_storage& operator=(const counter_storage&) = delete;
counter_storage& operator=(counter_storage&&) = default;
counter_storage& operator=(counter_storage&&) = default;
friend bool operator<(const counter_storage& lhs, const counter_storage& rhs)
{
@@ -79,7 +79,7 @@ struct rocprofiler_tool_counter_info_t : rocprofiler_counter_info_v0_t
rocprofiler_tool_counter_info_t(rocprofiler_tool_counter_info_t&&) noexcept = default;
rocprofiler_tool_counter_info_t& operator=(const rocprofiler_tool_counter_info_t&) =
default;
rocprofiler_tool_counter_info_t& operator =(
rocprofiler_tool_counter_info_t& operator=(
rocprofiler_tool_counter_info_t&&) noexcept = default;
rocprofiler_agent_id_t agent_id = {};
@@ -261,7 +261,7 @@ struct thread_data<std::optional<Tp>, Tag, MaxThreads>
thread_data(const thread_data&) = default;
thread_data(thread_data&&) noexcept = default;
thread_data& operator=(const thread_data&) = default;
thread_data& operator=(const thread_data&) = default;
thread_data& operator=(thread_data&&) noexcept = default;
static unique_ptr_t<this_type>& instance();
@@ -432,7 +432,7 @@ struct thread_data<identity<Tp>, Tag, MaxThreads>
thread_data(const thread_data&) = default;
thread_data(thread_data&&) noexcept = default;
thread_data& operator=(const thread_data&) = default;
thread_data& operator=(const thread_data&) = default;
thread_data& operator=(thread_data&&) noexcept = default;
static unique_ptr_t<this_type>& instance();
@@ -93,7 +93,7 @@ struct thread_info
thread_info(thread_info&&) = default;
thread_info& operator=(const thread_info&) = delete;
thread_info& operator=(thread_info&&) = default;
thread_info& operator=(thread_info&&) = default;
static void set_start(uint64_t, bool _force = false);
static void set_stop(uint64_t);
@@ -387,7 +387,7 @@
# define OMPI_PREDEFINED_GLOBAL(type, global) \
(static_cast<type>(static_cast<void*>(&(global))))
# else
# define OMPI_PREDEFINED_GLOBAL(type, global) ((type)((void*) &(global)))
# define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void*) &(global)))
# endif
#else
# define OMPI_PREDEFINED_GLOBAL(type, global) ((type) & (global))
@@ -718,7 +718,7 @@ extern "C"
#if(OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING)
MPI_COMBINER_HVECTOR_INTEGER,
#else
OMPI_WAS_MPI_COMBINER_HVECTOR_INTEGER, /* preserve ABI compatibility */
OMPI_WAS_MPI_COMBINER_HVECTOR_INTEGER, /* preserve ABI compatibility */
#endif
MPI_COMBINER_HVECTOR,
MPI_COMBINER_INDEXED,
@@ -732,7 +732,7 @@ extern "C"
#if(OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING)
MPI_COMBINER_STRUCT_INTEGER,
#else
OMPI_WAS_MPI_COMBINER_STRUCT_INTEGER, /* preserve ABI compatibility */
OMPI_WAS_MPI_COMBINER_STRUCT_INTEGER, /* preserve ABI compatibility */
#endif
MPI_COMBINER_STRUCT,
MPI_COMBINER_SUBARRAY,
@@ -882,7 +882,7 @@ extern "C"
/*
* Special MPI_T handles
*/
#define MPI_T_PVAR_ALL_HANDLES ((MPI_T_pvar_handle) -1)
#define MPI_T_PVAR_ALL_HANDLES ((MPI_T_pvar_handle) - 1)
#define MPI_T_PVAR_HANDLE_NULL ((MPI_T_pvar_handle) 0)
#define MPI_T_PVAR_SESSION_NULL ((MPI_T_pvar_session) 0)
#define MPI_T_CVAR_HANDLE_NULL ((MPI_T_cvar_handle) 0)
@@ -1284,8 +1284,8 @@ extern "C"
#define MPI_TYPECLASS_COMPLEX 3
/* Aint helper macros (MPI-3.1) */
#define MPI_Aint_add(base, disp) ((MPI_Aint)((char*) (base) + (disp)))
#define MPI_Aint_diff(addr1, addr2) ((MPI_Aint)((char*) (addr1) - (char*) (addr2)))
#define MPI_Aint_add(base, disp) ((MPI_Aint) ((char*) (base) + (disp)))
#define MPI_Aint_diff(addr1, addr2) ((MPI_Aint) ((char*) (addr1) - (char*) (addr2)))
#define PMPI_Aint_add(base, disp) MPI_Aint_add(base, disp)
#define PMPI_Aint_diff(addr1, addr2) MPI_Aint_diff(addr1, addr2)
@@ -73,7 +73,7 @@
*
*/
#ifndef _STRINGIFY
# define _STRINGIFY_HELPER(x) # x
# define _STRINGIFY_HELPER(x) #x
# define _STRINGIFY(x) _STRINGIFY_HELPER(x)
#endif
@@ -94,10 +94,10 @@
# endif
/* patch number is a decimal build date: YYYYMMDD */
# define PLATFORM_COMPILER_VERSION_INT(maj, min, pat) \
(((((maj) *10) | (min)) << 20) | \
(((((maj) * 10) | (min)) << 20) | \
((pat) < _PLATFORM_COMPILER_INTEL_MIN_BUILDDATE \
? _PLATFORM_COMPILER_INTEL_MIN_BUILDDATE \
: ((pat) -_PLATFORM_COMPILER_INTEL_MIN_BUILDDATE)))
: ((pat) - _PLATFORM_COMPILER_INTEL_MIN_BUILDDATE)))
# define PLATFORM_COMPILER_VERSION \
PLATFORM_COMPILER_VERSION_INT(__INTEL_COMPILER / 10, __INTEL_COMPILER / 100, \
_PLATFORM_INTEL_COMPILER_BUILD_DATE)
@@ -207,7 +207,7 @@
# endif
# define PLATFORM_COMPILER_VERSION_INT(maj, min, pat) \
(((maj) *10000000) + ((min) *100000) + (90000) + (pat))
(((maj) * 10000000) + ((min) * 100000) + (90000) + (pat))
/* 90000 = official ver, 80000 = customer special ver, 60000 = field test ver */
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
@@ -230,8 +230,8 @@ struct annotate<perfetto_event_context_t, Tp>
private:
// If the component has a annotate(...) member function
template <typename T>
static auto sfinae(T& obj, int, perfetto_event_context_t& _ctx)
-> decltype(obj.annotate(_ctx))
static auto sfinae(T& obj, int,
perfetto_event_context_t& _ctx) -> decltype(obj.annotate(_ctx))
{
static_assert(std::is_same<T, Tp>::value, "Error T != Tp");
return obj.annotate(_ctx);
@@ -137,7 +137,7 @@ ensure_ci_timeout_backtrace(double _ci_timeout_seconds,
ROCPROFSYS_WARNING_F(
0,
"pthread_kill(%zu, %i) failed. executing generic "
"kill(%i, %i)...\n",
"kill(%i, %i)...\n",
_handle, timeout_signal_v, process::get_id(), timeout_signal_v);
}
@@ -100,11 +100,9 @@ PYBIND11_MODULE(libpyrocprofsys, omni)
return _use_mpi;
};
omni.def(
"is_initialized", []() { return _is_initialized; }, "Initialization state");
omni.def("is_initialized", []() { return _is_initialized; }, "Initialization state");
omni.def(
"is_finalized", []() { return _is_finalized; }, "Finalization state");
omni.def("is_finalized", []() { return _is_finalized; }, "Finalization state");
omni.def(
"initialize",
@@ -224,11 +222,11 @@ struct config
strset_t exclude_filenames = default_exclude_filenames;
std::vector<profiler_t> records = {};
annotations_t annotations = { note_t{ "file", ROCPROFSYS_STRING, nullptr },
note_t{ "line", ROCPROFSYS_INT32, nullptr },
note_t{ "lasti", ROCPROFSYS_INT32, nullptr },
note_t{ "argcount", ROCPROFSYS_INT32, nullptr },
note_t{ "nlocals", ROCPROFSYS_INT32, nullptr },
note_t{ "stacksize", ROCPROFSYS_INT32, nullptr } };
note_t{ "line", ROCPROFSYS_INT32, nullptr },
note_t{ "lasti", ROCPROFSYS_INT32, nullptr },
note_t{ "argcount", ROCPROFSYS_INT32, nullptr },
note_t{ "nlocals", ROCPROFSYS_INT32, nullptr },
note_t{ "stacksize", ROCPROFSYS_INT32, nullptr } };
};
//
inline config&
@@ -306,7 +304,7 @@ profiler_function(py::object pframe, const char* swhat, py::object arg)
if(_disable) return;
_disable = true;
tim::scope::destructor _dtor{ []() { _disable= false; } };
tim::scope::destructor _dtor{ []() { _disable = false; } };
(void) _dtor;
if(pframe.is_none() || pframe.ptr() == nullptr) return;