Skip to content

Commit

Permalink
[SWDEV-423481/SWDEV-423393] Align all device identifier details
Browse files Browse the repository at this point in the history
Updated:
 * [CLI] Fixed vram % - printf style formatting causes many data errors
   This fix updates to the recommended way of outputting formatted data.
   https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting
 * [API/CLI] Added gpu_id / GUID from kfd (rsmi_dev_guid_get)
       -> CLI name: "GUID"
       -> ROCm SMI calls: no arg, -i, --showhw, --showproduct
 * [API/CLI] Added node_id from kfd (rsmi_dev_node_get)
       -> CLI name: "Node"
       -> ROCm SMI calls: no arg, --showhw, --showproduct
 * [CLI] Added target gfx version from kfd
       -> CLI name: "GFX Version" or "GFX VER"
       -> ROCm SMI calls: --showhw, --showproduct
 * [CLI] Base ROCm CLI
       -> Removed - stacked id formatting:
	   This is to simplify identifiers helpful to users.
	   More identifiers can be found on -i --showhw, --showproduct
 * [CLI] Update -i, --showhw, --showproduct, w/out arg
      -> Card ID/DID/Model/SKU/VBIOS:
            All unsupported values now display "N/A" instead
            of "unknown" or "unsupported"
 * [CLI] Showhw now expands data based on content

Change-Id: Ifb8586f9f545892b8a5aa7903608273cdd77e075
Signed-off-by: Charis Poag <[email protected]>
  • Loading branch information
charis-poag-amd committed Feb 14, 2024
1 parent 677433b commit 4b5ccb5
Show file tree
Hide file tree
Showing 8 changed files with 404 additions and 172 deletions.
50 changes: 49 additions & 1 deletion include/rocm_smi/rocm_smi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,54 @@ rsmi_status_t rsmi_dev_unique_id_get(uint32_t dv_ind, uint64_t *id);
*/
rsmi_status_t rsmi_dev_xgmi_physical_id_get(uint32_t dv_ind, uint16_t *id);

/**
* @brief Get the GUID, also known as the GPU device id,
* associated with the provided device index indicated by KFD.
*
* @details Given a device index @p dv_ind and a pointer to a uint64_t
* @p guid, this function will write the KFD GPU id value to the
* uint64_t pointed to by @p guid.
*
* @param[in] dv_ind a device index
*
* @param[inout] gpu_id a pointer to uint64_t to which the KFD gpu id will be
* written. If the @p guid parameter is nullptr, this function will return
* ::RSMI_STATUS_INVALID_ARGS. If the GPU ID is not supported with
* the device index queried, gpu_id will return MAX UINT64 value an
* arguments and ::RSMI_STATUS_NOT_SUPPORTED as a response.
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function with the given arguments
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*
*/
rsmi_status_t rsmi_dev_guid_get(uint32_t dv_ind, uint64_t *guid);

/**
* @brief Get the node id associated with the provided device index
* indicated by KFD.
*
* @details Given a device index @p dv_ind and a pointer to a uint32_t
* @p node_id, this function will write the KFD node id value to the
* uint32_t pointed to by @p node_id.
*
* @param[in] dv_ind a device index
*
* @param[inout] node_id a pointer to uint64_t to which the KFD gpu id will be
* written. If the @p node_id parameter is nullptr, this function will return
* ::RSMI_STATUS_INVALID_ARGS. If @p node_id is not supported with
* the device index queried, @p node_id will return MAX UINT64 value as an
* argument and ::RSMI_STATUS_NOT_SUPPORTED as a response.
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function with the given arguments
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*
*/
rsmi_status_t rsmi_dev_node_id_get(uint32_t dv_ind, uint32_t *node_id);


/** @} */ // end of IDQuer

Expand Down Expand Up @@ -3205,7 +3253,7 @@ rsmi_dev_firmware_version_get(uint32_t dv_ind, rsmi_fw_block_t block,
uint64_t *fw_version);

/**
* @brief Get the graphics version for a GPU device
* @brief Get the target graphics version for a GPU device
*
* @details Given a device ID @p dv_ind and a uint64_t pointer
* @p gfx_version, this function will write the graphics version.
Expand Down
4 changes: 4 additions & 0 deletions include/rocm_smi/rocm_smi_kfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class KFDNode {

// Get gfx target version from kfd
int get_gfx_target_version(uint64_t* gfx_target_version);
// Get gpu_id (AKA GUID) version from kfd
int get_gpu_id(uint64_t *gpu_id);
// Get node id from kfd
int get_node_id(uint32_t *node_id);

private:
uint32_t node_indx_;
Expand Down
3 changes: 2 additions & 1 deletion include/rocm_smi/rocm_smi_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ std::string print_unsigned_hex_and_int(T i, std::string heading="") {
}
ss << "Hex (MSB): " << print_int_as_hex(i) << ", "
<< "Unsigned int: " << print_unsigned_int(i) << ", "
<< "Byte Size: " << sizeof(T);
<< "Byte Size: " << sizeof(T) << ", "
<< "Bits: " << sizeof(T) * 8; // 8 bits per 1 byte
return ss.str();
}

Expand Down
Loading

0 comments on commit 4b5ccb5

Please sign in to comment.