Use nested namespace for amd::smi
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
[ROCm/amdsmi commit: eacec681dd]
This commit is contained in:
committato da
Galantsev, Dmitrii
parent
47b2e80ab8
commit
0c7c849c42
@@ -34,8 +34,7 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
// Define a map of rsmi status codes to amdsmi status codes
|
||||
const std::map<rsmi_status_t, amdsmi_status_t> rsmi_status_map = {
|
||||
@@ -110,7 +109,6 @@ const std::map<esmi_status_t, amdsmi_status_t> esmi_status_map = {
|
||||
|
||||
amdsmi_status_t esmi_to_amdsmi_status(esmi_status_t status);
|
||||
#endif
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_COMMON_H_
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
#include "amd_smi/impl/xf86drm.h"
|
||||
#include "amd_smi/impl/scoped_fd.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
class AMDSmiDrm {
|
||||
public:
|
||||
@@ -64,7 +63,6 @@ class AMDSmiDrm {
|
||||
};
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_IMPL_AMD_SMI_DRM_H_
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
|
||||
// PID, amdsmi_proc_info_t
|
||||
@@ -90,7 +89,6 @@ class AMDSmiGPUDevice: public AMDSmiProcessor {
|
||||
};
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_IMPL_AMD_SMI_GPU_DEVICE_H_
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
class AMDSmiLibraryLoader {
|
||||
public:
|
||||
AMDSmiLibraryLoader();
|
||||
@@ -76,8 +75,7 @@ template<typename T> amdsmi_status_t AMDSmiLibraryLoader::load_symbol(
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_IMPL_AMD_SMI_LIB_LOADER_H_
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
#include <string>
|
||||
#include "amd_smi/amdsmi.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
class AMDSmiProcessor {
|
||||
public:
|
||||
@@ -43,7 +42,6 @@ class AMDSmiProcessor {
|
||||
uint32_t pindex_;
|
||||
std::string processor_identifier_;
|
||||
};
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_PROCESSOR_H_
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#include "amd_smi/amdsmi.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
class AMDSmiSocket {
|
||||
public:
|
||||
@@ -76,7 +75,6 @@ class AMDSmiSocket {
|
||||
std::vector<AMDSmiProcessor*> cpu_core_processors_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_SOCKET_H_
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "amd_smi/impl/amd_smi_drm.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
// Singleton: Only one system in an application
|
||||
class AMDSmiSystem {
|
||||
@@ -80,7 +79,6 @@ class AMDSmiSystem {
|
||||
std::vector<AMDSmiSocket*> sockets_;
|
||||
std::set<AMDSmiProcessor*> processors_; // Track valid processors
|
||||
};
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // AMD_SMI_INCLUDE_AMD_SMI_SYSTEM_H_
|
||||
|
||||
@@ -32,9 +32,7 @@
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace evt {
|
||||
namespace amd::smi::evt {
|
||||
|
||||
class RSMIEventGrpHashFunction {
|
||||
public:
|
||||
@@ -94,9 +92,7 @@ class Event {
|
||||
};
|
||||
|
||||
|
||||
} // namespace evt
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi::evt
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_COUNTERS_H_
|
||||
|
||||
|
||||
@@ -42,8 +42,7 @@
|
||||
#include "rocm_smi/rocm_smi_gpu_metrics.h"
|
||||
#include "shared_mutex.h" //NOLINT
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
enum DevKFDNodePropTypes {
|
||||
kDevKFDNodePropCachesCnt,
|
||||
@@ -311,7 +310,6 @@ class Device {
|
||||
};
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
throw amd::smi::rsmi_exception(RSMI_STATUS_INVALID_ARGS, __FUNCTION__); \
|
||||
}
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
/// @brief Exception type which carries an error code to return to the user.
|
||||
class rsmi_exception : public std::exception {
|
||||
@@ -50,8 +49,7 @@ class rsmi_exception : public std::exception {
|
||||
std::string desc_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_EXCEPTION_H_
|
||||
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
typedef enum _IO_LINK_TYPE {
|
||||
IOLINK_TYPE_UNDEFINED = 0,
|
||||
@@ -130,7 +129,6 @@ IOLinkDirectionType_t DiscoverIOLinkPerNodeDirection(uint32_t src_node_idx,
|
||||
uint32_t dst_node_idx);
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_IO_LINK_H_
|
||||
|
||||
@@ -33,8 +33,7 @@
|
||||
#include "rocm_smi/rocm_smi_device.h"
|
||||
#include "rocm_smi/rocm_smi_io_link.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
class KFDNode {
|
||||
public:
|
||||
@@ -117,7 +116,6 @@ int read_node_properties(uint32_t node, std::string property_name,
|
||||
uint64_t *val);
|
||||
int get_gpu_id(uint32_t node, uint64_t *gpu_id);
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_KFD_H_
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
#include "rocm_smi/rocm_smi_power_mon.h"
|
||||
#include "rocm_smi/rocm_smi_common.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
class RocmSMI {
|
||||
public:
|
||||
@@ -134,7 +133,6 @@ class RocmSMI {
|
||||
// by bootstrap_mutex_
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_MAIN_H_
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
#include "rocm_smi/rocm_smi_common.h"
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
enum MonitorTypes {
|
||||
kMonName,
|
||||
@@ -148,7 +147,6 @@ class Monitor {
|
||||
std::map<uint64_t, rsmi_voltage_type_t> index_volt_type_map_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_MONITOR_H_
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
|
||||
#include "rocm_smi/rocm_smi_common.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
enum PowerMonTypes {
|
||||
kPowerMaxGPUPower,
|
||||
@@ -52,7 +51,6 @@ class PowerMon {
|
||||
uint32_t dev_index_;
|
||||
};
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_POWER_MON_H_
|
||||
|
||||
@@ -29,8 +29,7 @@
|
||||
#include <map>
|
||||
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
//
|
||||
// Property reinforcement check list
|
||||
@@ -132,7 +131,6 @@ rsmi_status_t validate_property_reinforcement_query(uint32_t dv_ind,
|
||||
void dump_amdgpu_property_reinforcement_list();
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_DEVICE_H_
|
||||
|
||||
@@ -54,8 +54,7 @@
|
||||
} while (false)
|
||||
#endif
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
pthread_mutex_t *GetMutex(uint32_t dv_ind);
|
||||
int SameFile(const std::string fileA, const std::string fileB);
|
||||
@@ -660,7 +659,6 @@ inline ostream_joiner<std::decay_t<DelimiterType>, CharType, TraitsType>
|
||||
}
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_UTILS_H_
|
||||
|
||||
@@ -41,9 +41,7 @@
|
||||
#include "rocm_smi/rocm_smi_main.h"
|
||||
#include "rocm_smi/rocm_smi_device.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace evt {
|
||||
namespace amd::smi::evt {
|
||||
|
||||
static const char *kPathDeviceEventRoot = "/sys/bus/event_source/devices";
|
||||
|
||||
@@ -410,6 +408,4 @@ amd::smi::evt::Event::getValue(rsmi_counter_value_t *val) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace evt
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi::evt
|
||||
|
||||
@@ -47,8 +47,7 @@
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
#include "shared_mutex.h" // NOLINT
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
// Debug root file path
|
||||
static const char *kPathDebugRootFName = "/sys/kernel/debug/dri/";
|
||||
@@ -1992,5 +1991,4 @@ rsmi_status_t Device::get_smi_device_identifiers(uint32_t device_id,
|
||||
|
||||
|
||||
#undef RET_IF_NONZERO
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
#define CRAT_IOLINK_FLAGS_BI_DIRECTIONAL (1 << 31)
|
||||
#define CRAT_IOLINK_FLAGS_RESERVED_MASK 0x7fffffe0
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
static const char *kKFDNodesPathRoot = "/sys/class/kfd/kfd/topology/nodes";
|
||||
static const char *kKFDLinkPath[] = {"io_links", "p2p_links"};
|
||||
@@ -450,5 +449,4 @@ IOLinkDirectionType_t DiscoverIOLinkPerNodeDirection(uint32_t src_node_idx, uint
|
||||
}
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -43,8 +43,7 @@
|
||||
#include "rocm_smi/rocm_smi_main.h"
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
static const char *kKFDProcPathRoot = "/sys/class/kfd/kfd/proc";
|
||||
static const char *kKFDNodesPathRoot = "/sys/class/kfd/kfd/topology/nodes";
|
||||
@@ -1131,5 +1130,4 @@ int KFDNode::get_node_id(uint32_t *node_id) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -50,8 +50,7 @@ static const char *kPathPowerRoot = "/sys/kernel/debug/dri";
|
||||
|
||||
static const char *kAMDMonitorTypes[] = {"radeon", "amdgpu", ""};
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
static uint32_t GetDeviceIndex(const std::string s) {
|
||||
std::string t = s;
|
||||
@@ -1106,5 +1105,4 @@ int RocmSMI::get_io_link_weight(uint32_t node_from, uint32_t node_to,
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -34,8 +34,7 @@
|
||||
#include "rocm_smi/rocm_smi_exception.h"
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
struct MonitorNameEntry {
|
||||
MonitorTypes type;
|
||||
@@ -637,5 +636,4 @@ void Monitor::fillSupportedFuncs(SupportedFuncMap *supported_funcs) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -30,8 +30,7 @@
|
||||
#include "rocm_smi/rocm_smi_common.h"
|
||||
#include "rocm_smi/rocm_smi_exception.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
|
||||
static const char *kPowerMonPMName = "amdgpu_pm_info";
|
||||
@@ -127,5 +126,4 @@ int PowerMon::readPowerValue(PowerMonTypes type, uint64_t *power) {
|
||||
return parse_power_str(fstr, type, power);
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -53,8 +53,7 @@
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
const std::string kTmpFilePrefix = "rocmsmi_";
|
||||
|
||||
// Return 0 if same file, 1 if not, and -1 for error
|
||||
@@ -1337,5 +1336,4 @@ uint64_t get_multiplier_from_char(char units_char) {
|
||||
return multiplier;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "rocm_smi/rocm_smi_main.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
|
||||
std::string AMDSmiDrm::find_file_in_folder(const std::string& folder,
|
||||
@@ -204,6 +203,4 @@ uint32_t AMDSmiDrm::get_vendor_id() {
|
||||
return vendor_id;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
#include "rocm_smi/rocm_smi_utils.h"
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
uint32_t AMDSmiGPUDevice::get_gpu_id() const {
|
||||
return gpu_id_;
|
||||
@@ -311,5 +310,4 @@ std::vector<uint64_t> AMDSmiGPUDevice::get_bitmask_from_numa_node(int32_t node_i
|
||||
return bitmask;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
// NOTE: This is a *temporary solution* until we get a better approach, likely
|
||||
// a driver API that can give us the capabilities of a GPU in question.
|
||||
//
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
namespace amd::smi {
|
||||
|
||||
const AMDGpuOpModeList_t amdgpu_opmode_check_list {
|
||||
{AMDGpuPropertyOpModeTypes_t::kBareMetal, "Bare Metal"},
|
||||
@@ -541,5 +540,4 @@ rsmi_status_t Device::run_amdgpu_property_reinforcement_query(const AMDGpuProper
|
||||
}
|
||||
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
} // namespace amd::smi
|
||||
|
||||
Fai riferimento in un nuovo problema
Block a user