Rename NPS -> memory partition + compute partition node fix

* Updates:
        - rocm_smi_lib + CLI:
          Rename all "NPS mode" -> "memory partition"
          related files/functions/API/CLI to align with correct
          technical naming
        - rocm_smi_main: fixed identifying primary card's unique id
          utilize rsmi_dev_unique_id_get to map which
          KFD nodes belong to it
        - rsmi_dev_*_partition*: now have better logging output
        - compute partition tests:
          Added 20 sec delay for workaround until GPU
          busy is confirmed as the issue
        - CPPLint fixes/formatting
        - [Example] Moved all endl to "\n" for efficiency
        - [Example] Added Edge & Junction temperature examples
        - [Example] Added rsmi_minmax_bandwidth_get() example - WIP

Change-Id: Ida6db6fda7e0ac9d696a34cb15b4746e69d58d51
Signed-off-by: Charis Poag <Charis.Poag@amd.com>


[ROCm/rocm_smi_lib commit: b251bb0c9f]
Šī revīzija ir iekļauta:
Charis Poag
2023-09-21 14:53:35 -05:00
vecāks fce4f5fa08
revīzija d57d65a607
12 mainīti faili ar 847 papildinājumiem un 503 dzēšanām
@@ -40,8 +40,8 @@
* DEALINGS WITH THE SOFTWARE.
*
*/
#ifndef INCLUDE_ROCM_SMI_ROCM_SMI_H_
#define INCLUDE_ROCM_SMI_ROCM_SMI_H_
#ifndef ROCM_SMI_ROCM_SMI_H_
#define ROCM_SMI_ROCM_SMI_H_
#ifdef __cplusplus
extern "C" {
@@ -379,27 +379,27 @@ typedef rsmi_compute_partition_type_t rsmi_compute_partition_type;
/// \endcond
/**
* @brief NPS Modes. This enum is used to identify various
* NPS mode types.
* @brief Memory Partitions. This enum is used to identify various
* memory partition types.
*/
typedef enum {
RSMI_MEMORY_PARTITION_UNKNOWN = 0,
RSMI_MEMORY_PARTITION_NPS1, //!< NPS1 - All CCD & XCD data is interleaved
//!< accross all 8 HBM stacks (all stacks/1).
RSMI_MEMORY_PARTITION_NPS2, //!< NPS2 - 2 sets of CCDs or 4 XCD interleaved
//!< accross the 4 HBM stacks per AID pair
//!< (8 stacks/2).
RSMI_MEMORY_PARTITION_NPS4, //!< NPS4 - Each XCD data is interleaved accross
//!< accross 2 (or single) HBM stacks
//!< (8 stacks/8 or 8 stacks/4).
RSMI_MEMORY_PARTITION_NPS8, //!< NPS8 - Each XCD uses a single HBM stack
//!< (8 stacks/8). Or each XCD uses a single
//!< HBM stack & CCDs share 2 non-interleaved
//!< HBM stacks on its AID
//!< (AID[1,2,3] = 6 stacks/6).
} rsmi_nps_mode_type_t;
RSMI_MEMORY_PARTITION_NPS1, //!< NPS1 - All CCD & XCD data is interleaved
//!< accross all 8 HBM stacks (all stacks/1).
RSMI_MEMORY_PARTITION_NPS2, //!< NPS2 - 2 sets of CCDs or 4 XCD interleaved
//!< accross the 4 HBM stacks per AID pair
//!< (8 stacks/2).
RSMI_MEMORY_PARTITION_NPS4, //!< NPS4 - Each XCD data is interleaved accross
//!< accross 2 (or single) HBM stacks
//!< (8 stacks/8 or 8 stacks/4).
RSMI_MEMORY_PARTITION_NPS8, //!< NPS8 - Each XCD uses a single HBM stack
//!< (8 stacks/8). Or each XCD uses a single
//!< HBM stack & CCDs share 2 non-interleaved
//!< HBM stacks on its AID
//!< (AID[1,2,3] = 6 stacks/6).
} rsmi_memory_partition_type_t;
/// \cond Ignore in docs.
typedef rsmi_nps_mode_type_t rsmi_nps_mode_type;
typedef rsmi_memory_partition_type_t rsmi_memory_partition_type;
/// \endcond
/**
@@ -2413,7 +2413,8 @@ rsmi_status_t rsmi_dev_perf_level_get(uint32_t dv_ind,
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*
*/
rsmi_status_t rsmi_perf_determinism_mode_set(uint32_t dv_ind, uint64_t clkvalue);
rsmi_status_t rsmi_perf_determinism_mode_set(uint32_t dv_ind,
uint64_t clkvalue);
/**
* @brief Get the overdrive percent associated with the device with provided
@@ -3767,27 +3768,28 @@ rsmi_status_t rsmi_dev_compute_partition_reset(uint32_t dv_ind);
/** @} */ // end of ComputePartition
/*****************************************************************************/
/** @defgroup NPSMode NPS Mode Functions
* These functions are used to query the device's NPS mode (memory partition).
/** @defgroup memory_partition The Memory Partition Functions
* These functions are used to query and set the device's current memory
* partition.
* @{
*/
/**
* @brief Retrieves the NPS mode (memory partition) for a desired device
* @brief Retrieves the current memory partition for a desired device
*
* @details
* Given a device index @p dv_ind and a string @p nps_mode ,
* Given a device index @p dv_ind and a string @p memory_partition ,
* and uint32 @p len , this function will attempt to obtain the device's
* nps mode string. Upon successful retreival, the obtained device's
* nps mode string shall be stored in the passed @p nps_mode char string
* variable.
* memory partition string. Upon successful retreival, the obtained device's
* memory partition string shall be stored in the passed @p memory_partition
* char string variable.
*
* @param[in] dv_ind a device index
*
* @param[inout] nps_mode a pointer to a char string variable,
* which the device's nps mode will be written to.
* @param[inout] memory_partition a pointer to a char string variable,
* which the device's memory partition will be written to.
*
* @param[in] len the length of the caller provided buffer @p nps_mode ,
* @param[in] len the length of the caller provided buffer @p memory_partition ,
* suggested length is 5 or greater.
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
@@ -3796,24 +3798,25 @@ rsmi_status_t rsmi_dev_compute_partition_reset(uint32_t dv_ind);
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function
* @retval ::RSMI_STATUS_INSUFFICIENT_SIZE is returned if @p len bytes is not
* large enough to hold the entire nps mode value. In this case,
* large enough to hold the entire memory partition value. In this case,
* only @p len bytes will be written.
*
*/
rsmi_status_t
rsmi_dev_nps_mode_get(uint32_t dv_ind, char *nps_mode, uint32_t len);
rsmi_dev_memory_partition_get(uint32_t dv_ind, char *memory_partition,
uint32_t len);
/**
* @brief Modifies a selected device's NPS mode (memory partition) setting.
* @brief Modifies a selected device's current memory partition setting.
*
* @details Given a device index @p dv_ind and a type of nps mode
* @p nps_mode, this function will attempt to update the selected
* device's nps mode setting.
* @details Given a device index @p dv_ind and a type of memory partition
* @p memory_partition, this function will attempt to update the selected
* device's memory partition setting.
*
* @param[in] dv_ind a device index
*
* @param[in] nps_mode using enum ::rsmi_nps_mode_type_t,
* define what the selected device's NPS mode setting should be updated to.
* @param[in] memory_partition using enum ::rsmi_memory_partition_type_t,
* define what the selected device's current mode setting should be updated to.
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_PERMISSION function requires root access
@@ -3825,14 +3828,15 @@ rsmi_dev_nps_mode_get(uint32_t dv_ind, char *nps_mode, uint32_t len);
*
*/
rsmi_status_t
rsmi_dev_nps_mode_set(uint32_t dv_ind, rsmi_nps_mode_type_t nps_mode);
rsmi_dev_memory_partition_set(uint32_t dv_ind,
rsmi_memory_partition_type_t memory_partition);
/**
* @brief Reverts a selected device's NPS mode setting back to its
* @brief Reverts a selected device's memory partition setting back to its
* boot state.
*
* @details Given a device index @p dv_ind , this function will attempt to
* revert its NPS mode setting back to its boot state.
* revert its current memory partition setting back to its boot state.
*
* @param[in] dv_ind a device index
*
@@ -3844,9 +3848,9 @@ rsmi_dev_nps_mode_set(uint32_t dv_ind, rsmi_nps_mode_type_t nps_mode);
* the amdgpu driver
*
*/
rsmi_status_t rsmi_dev_nps_mode_reset(uint32_t dv_ind);
rsmi_status_t rsmi_dev_memory_partition_reset(uint32_t dv_ind);
/** @} */ // end of NPSMode
/** @} */ // end of memory_partition
/*****************************************************************************/
/** @defgroup APISupport Supported Functions
@@ -4193,4 +4197,4 @@ rsmi_status_t rsmi_event_notification_stop(uint32_t dv_ind);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // INCLUDE_ROCM_SMI_ROCM_SMI_H_
#endif // ROCM_SMI_ROCM_SMI_H_