Removing ROCMTools naming from ROCProfiler project

Change-Id: Ibd6211e031157f68a1bc3dd8dd77385e695cb700
This commit is contained in:
Ammar ELWazir
2023-05-30 19:21:14 +00:00
committed by Ammar ELWazir
parent 54222bb4ae
commit 4bcef6b8de
85 changed files with 749 additions and 743 deletions
+16 -16
View File
@@ -28,16 +28,16 @@
// TODO(aelwazir): To be implemented
// type for reference counter
typedef std::atomic<uint64_t> RocmToolsRefCount;
typedef std::atomic<uint64_t> ROCProfilerRefCount;
// type for access/release control flag
typedef std::atomic<bool> RocmToolsARControl;
typedef std::atomic<bool> ROCProfilerARControl;
namespace rocmtools {
namespace rocprofiler {
// the access/release control flag can be shared or exclusive
static RocmToolsARControl kARShared = ATOMIC_VAR_INIT(0);
static RocmToolsARControl kARExclusive = ATOMIC_VAR_INIT(1);
static ROCProfilerARControl kARShared = ATOMIC_VAR_INIT(0);
static ROCProfilerARControl kARExclusive = ATOMIC_VAR_INIT(1);
/*-------------------------------------------------------------------------*/
/**
@@ -49,25 +49,25 @@ static RocmToolsARControl kARExclusive = ATOMIC_VAR_INIT(1);
class AccessControl {
public:
//!< constructor that defaults the RefCount and ARControl
AccessControl(RocmToolsRefCount rrc = ATOMIC_VAR_INIT(0),
RocmToolsARControl rac = ATOMIC_VAR_INIT(kARShared.load()));
AccessControl(ROCProfilerRefCount rrc = ATOMIC_VAR_INIT(0),
ROCProfilerARControl rac = ATOMIC_VAR_INIT(kARShared.load()));
//!< naive destructor
~AccessControl();
bool Acquire(RocmToolsARControl access_mode);
void Release(RocmToolsARControl access_mode);
bool Acquire(ROCProfilerARControl access_mode);
void Release(ROCProfilerARControl access_mode);
private:
RocmToolsRefCount rcount_; //!< refernce count, every successful access
ROCProfilerRefCount rcount_; //!< refernce count, every successful access
//! increments it
RocmToolsARControl arcontrol_; //!< shared access or exclusive?
ROCProfilerARControl arcontrol_; //!< shared access or exclusive?
std::mutex accessmutex_;
};
//<!
// AccessControl::AccessControl(RocmToolsRefCount rrc, RocmToolsARControl rac)
// AccessControl::AccessControl(ROCProfilerRefCount rrc, ROCProfilerARControl rac)
// {
// rcount_ = rrc.load();
// arcontrol_ = rac.load();
@@ -76,7 +76,7 @@ class AccessControl {
//<!
AccessControl::~AccessControl() {
// we cannot decrement reference count here, we can only hope it is 0
#ifdef ROCMTOOL_DEBUG_PRINT
#ifdef ROCPROFILER_DEBUG_PRINT
int zero = 0;
if (rcount_.compare_exchange_strong(zero&, 0, std::memory_order_acq_rel))
cout << endl
@@ -90,11 +90,11 @@ AccessControl::~AccessControl() {
#if 0
//!< three steps, 1) get scoped lock, 2) check if it is shared to shared
//!< acquire, and 3) if it is exclusive, check if refcount is 0
bool AccessControl::Acquire(RocmToolsARControl rac) {
bool AccessControl::Acquire(ROCProfilerARControl rac) {
// first, ensure we have a lock_guard
std::lock_guard<std::mutex> lg(accessmutex_);
// we should always expect the current value to be shared
RocmToolsARControl rac_expected = kARShared.load();
ROCProfilerARControl rac_expected = kARShared.load();
// if what we have is what we expect then we are done
if (rac.load(std::memory_order_relaxed) == rac_expected.load()) {
// rcount_.store(std::memory_order_acq_rel,
@@ -111,6 +111,6 @@ bool AccessControl::Acquire(RocmToolsARControl rac) {
//!< always exchange to kARShared and reduce refcount
// void AccessControl::Release(
} // namespace rocmtools
} // namespace rocprofiler
#endif // SRC_UTILS_ACCESS_CONTROL_H_
+3 -3
View File
@@ -28,8 +28,8 @@
#include "helper.h"
#include "rocprofiler.h"
// TODO(aelwazir): namespace rocmtool
namespace rocmtools {
// TODO(aelwazir): namespace rocprofiler
namespace rocprofiler {
class Exception : public std::runtime_error {
public:
@@ -46,7 +46,7 @@ class Exception : public std::runtime_error {
const rocprofiler_status_t status_;
};
}; // namespace rocmtool
}; // namespace rocprofiler
// TODO(aelwazir): throw instead of the macros
+2 -2
View File
@@ -25,7 +25,7 @@
#include <utility>
#include <cstddef>
namespace rocmtools {
namespace rocprofiler {
template <typename T, typename D>
class handle_t {
@@ -109,6 +109,6 @@ public:
}
};
} // namespace rocmtools
} // namespace rocprofiler
#endif // UTILS_HANDLE_H_
+4 -4
View File
@@ -53,7 +53,7 @@ struct BackTraceInfo {
void errorCallback(void* data, const char* message, int errnum) {
BackTraceInfo* info = static_cast<BackTraceInfo*>(data);
info->sstream << "ROCMTools: error: " << message << '(' << errnum << ')';
info->sstream << "ROCProfiler: error: " << message << '(' << errnum << ')';
info->error = 1;
}
@@ -95,7 +95,7 @@ int fullCallback(void* data, uintptr_t pc, const char* filename, int lineno, con
} // namespace
#endif // defined (ENABLE_BACKTRACE)
namespace rocmtools {
namespace rocprofiler {
std::string string_vprintf(const char* format, va_list va) {
va_list copy;
@@ -142,7 +142,7 @@ std::string string_printf(const char* format, ...) {
message += info.sstream.str();
#endif /* defined (ENABLE_BACKTRACE) */
std::string errmsg("ROCMTools: fatal error: " + message);
std::string errmsg("ROCProfiler: fatal error: " + message);
fputs(errmsg.c_str(), stderr);
std::cerr << errmsg << std::endl;
@@ -236,4 +236,4 @@ std::string left_trim(const std::string& s) {
}
} // namespace rocmtools
} // namespace rocprofiler
+2 -2
View File
@@ -30,7 +30,7 @@
#include <cxxabi.h>
#include "exception.h"
namespace rocmtools {
namespace rocprofiler {
std::string string_vprintf(const char* format, va_list va);
@@ -69,4 +69,4 @@ bool has_counter_format(std::string const& str);
// trims the begining of the line for spaces
std::string left_trim(const std::string& s);
} // namespace rocmtools
} // namespace rocprofiler
+11 -11
View File
@@ -40,7 +40,7 @@
#include <string>
#include <utility>
namespace rocmtools {
namespace rocprofiler {
class Logger {
public:
@@ -140,32 +140,32 @@ class Logger {
std::map<uint32_t, std::string> message_;
};
} // namespace rocmtools
} // namespace rocprofiler
#define FATAL_LOGGING(stream) \
do { \
rocmtools::Logger::Instance() << "fatal: " << rocmtools::Logger::begm \
<< stream << rocmtools::Logger::endl; \
rocprofiler::Logger::Instance() << "fatal: " << rocprofiler::Logger::begm \
<< stream << rocprofiler::Logger::endl; \
throw(ROCPROFILER_STATUS_ERROR, "Error: " << stream); \
} while (false)
#define ERR_LOGGING(stream) \
do { \
rocmtools::Logger::Instance() << "error: " << rocmtools::Logger::begm \
<< stream << rocmtools::Logger::endl; \
rocprofiler::Logger::Instance() << "error: " << rocprofiler::Logger::begm \
<< stream << rocprofiler::Logger::endl; \
} while (false)
#define INFO_LOGGING(stream) \
do { \
rocmtools::Logger::Instance() << "info: " << rocmtools::Logger::begm \
<< stream << rocmtools::Logger::endl; \
rocprofiler::Logger::Instance() << "info: " << rocprofiler::Logger::begm \
<< stream << rocprofiler::Logger::endl; \
} while (false)
#define WARN_LOGGING(stream) \
do { \
std::cerr << "ROCmTools: " << stream << std::endl; \
rocmtools::Logger::Instance() << "warning: " << rocmtools::Logger::begm \
<< stream << rocmtools::Logger::endl; \
std::cerr << "ROCProfiler: " << stream << std::endl; \
rocprofiler::Logger::Instance() << "warning: " << rocprofiler::Logger::begm \
<< stream << rocprofiler::Logger::endl; \
} while (false)
#endif // SRC_UTILS_LOGGER_H_