APIs for the cache level and size

Read the cache level and size from topoogy sysfs file.

Change-Id: Id3c558c95bcb79139a19e4adbaa7ff333d06098f
Bu işleme şunda yer alıyor:
Bill(Shuzhou) Liu
2023-10-03 11:25:33 -05:00
ebeveyn 656f12e0f3
işleme 1a233f93fb
7 değiştirilmiş dosya ile 181 ekleme ve 0 silme
+32
Dosyayı Görüntüle
@@ -845,6 +845,22 @@ typedef struct {
/// \cond Ignore in docs.
typedef rsmi_version_t rsmi_version;
/// \endcond
/**
* @brief This structure represents the cache size and level
*/
#define RSMI_MAX_CACHE_TYPES 10
typedef struct {
uint32_t num_cache_types;
struct {
uint32_t cache_size_kb; /* In KB */
uint32_t cache_level;
} cache[RSMI_MAX_CACHE_TYPES];
} rsmi_gpu_cache_info_t;
/// \cond Ignore in docs.
typedef rsmi_gpu_cache_info_t rsmi_gpu_cache_info;
/// \endcond
/**
* @brief This structure represents a range (e.g., frequencies or voltages).
*/
@@ -2035,6 +2051,22 @@ rsmi_status_t
rsmi_dev_memory_total_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
uint64_t *total);
/**
* @brief Get gpu cache info.
*
* @details Given a device index @p dv_ind, and a pointer to a cache
* info @p info, this function will write the cache size and level
* to the location pointed to by @p info.
* @param[in] dv_ind a device index
*
* @param[inout] info reference to the cache info struct.
* Must be allocated by user.
*
* @return ::rsmi_status_t | ::RSMI_STATUS_SUCCESS on success, non-zero on fail
*/
rsmi_status_t rsmi_dev_cache_info_get(
uint32_t dv_ind, rsmi_gpu_cache_info_t *info);
/**
* @brief Get the current memory usage
*
+3
Dosyayı Görüntüle
@@ -84,6 +84,9 @@ class KFDNode {
int get_total_memory(uint64_t* total);
int get_used_memory(uint64_t* used);
// Get cache info from kfd
int get_cache_info(rsmi_gpu_cache_info_t *info);
private:
uint32_t node_indx_;
uint32_t amdgpu_dev_index_;