Memory Queries

Memory Queries#

AMD SMI: Memory Queries
Memory Queries

Functions

amdsmi_status_t amdsmi_dev_get_memory_total (amdsmi_device_handle device_handle, amdsmi_memory_type_t mem_type, uint64_t *total)
 Get the total amount of memory that exists. More...
 
amdsmi_status_t amdsmi_dev_get_memory_usage (amdsmi_device_handle device_handle, amdsmi_memory_type_t mem_type, uint64_t *used)
 Get the current memory usage. More...
 
amdsmi_status_t amdsmi_get_bad_page_info (amdsmi_device_handle device_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *info)
 The first call to this API returns the number of bad pages which should be used to allocate the buffer that should contain the bad page records. More...
 
amdsmi_status_t amdsmi_get_ras_block_features_enabled (amdsmi_device_handle device_handle, amdsmi_gpu_block_t block, amdsmi_ras_err_state_t *state)
 Returns if RAS features are enabled or disabled for given block. More...
 
amdsmi_status_t amdsmi_dev_get_memory_busy_percent (amdsmi_device_handle device_handle, uint32_t *busy_percent)
 Get percentage of time any device memory is being used. More...
 
amdsmi_status_t amdsmi_dev_get_memory_reserved_pages (amdsmi_device_handle device_handle, uint32_t *num_pages, amdsmi_retired_page_record_t *records)
 Get information about reserved ("retired") memory pages. More...
 

Detailed Description

These functions provide information about memory systems.

Function Documentation

◆ amdsmi_dev_get_memory_total()

amdsmi_status_t amdsmi_dev_get_memory_total ( amdsmi_device_handle  device_handle,
amdsmi_memory_type_t  mem_type,
uint64_t *  total 
)

Get the total amount of memory that exists.

Given a device handle device_handle, a type of memory mem_type, and a pointer to a uint64_t total, this function will write the total amount of mem_type memory that exists to the location pointed to by total.

Parameters
[in]device_handlea device handle
[in]mem_typeThe type of memory for which the total amount will be found
[in,out]totala pointer to uint64_t to which the total amount of memory will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_memory_usage()

amdsmi_status_t amdsmi_dev_get_memory_usage ( amdsmi_device_handle  device_handle,
amdsmi_memory_type_t  mem_type,
uint64_t *  used 
)

Get the current memory usage.

This function will write the amount of mem_type memory that that is currently being used to the location pointed to by used.

Parameters
[in]device_handlea device handle
[in]mem_typeThe type of memory for which the amount being used will be found
[in,out]useda pointer to uint64_t to which the amount of memory currently being used will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_bad_page_info()

amdsmi_status_t amdsmi_get_bad_page_info ( amdsmi_device_handle  device_handle,
uint32_t *  num_pages,
amdsmi_retired_page_record_t info 
)

The first call to this API returns the number of bad pages which should be used to allocate the buffer that should contain the bad page records.

This call will query the device device_handle for the number of bad pages (written to num_pages address). The results are written to address held by the info pointer.

Parameters
[in]device_handlea device handle
[out]num_pagesNumber of bad page records.
[out]infoThe results will be written to the amdsmi_retired_page_record_t pointer.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_get_ras_block_features_enabled()

amdsmi_status_t amdsmi_get_ras_block_features_enabled ( amdsmi_device_handle  device_handle,
amdsmi_gpu_block_t  block,
amdsmi_ras_err_state_t state 
)

Returns if RAS features are enabled or disabled for given block.

Given a device handle device_handle, this function queries the state of RAS features for a specific block block. Result will be written to address held by pointer state.

Parameters
[in]device_handleDevice handle which to query
[in]blockBlock which to query
[in,out]stateA pointer to amdsmi_ras_err_state_t to which the state of block will be written. If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_memory_busy_percent()

amdsmi_status_t amdsmi_dev_get_memory_busy_percent ( amdsmi_device_handle  device_handle,
uint32_t *  busy_percent 
)

Get percentage of time any device memory is being used.

Given a device handle device_handle, this function returns the percentage of time that any device memory is being used for the specified device.

Parameters
[in]device_handlea device handle
[in,out]busy_percenta pointer to the uint32_t to which the busy percent will be written If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail

◆ amdsmi_dev_get_memory_reserved_pages()

amdsmi_status_t amdsmi_dev_get_memory_reserved_pages ( amdsmi_device_handle  device_handle,
uint32_t *  num_pages,
amdsmi_retired_page_record_t records 
)

Get information about reserved ("retired") memory pages.

Given a device handle device_handle, this function returns retired page information records corresponding to the device with the provided device handle device_handle. The number of retired page records is returned through num_pages. records may be NULL on input. In this case, the number of records available for retrieval will be returned through num_pages.

Parameters
[in]device_handlea device handle
[in,out]num_pagesa pointer to a uint32. As input, the value passed through this parameter is the number of amdsmi_retired_page_record_t's that may be safely written to the memory pointed to by records. This is the limit on how many records will be written to records. On return, num_pages will contain the number of records written to records, or the number of records that could have been written if enough memory had been provided. If this parameter is nullptr, this function will return AMDSMI_STATUS_INVAL if the function is supported with the provided, arguments and AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
[in,out]recordsA pointer to a block of memory to which the amdsmi_retired_page_record_t values will be written. This value may be NULL. In this case, this function can be used to query how many records are available to read.
Returns
amdsmi_status_t | AMDSMI_STATUS_SUCCESS on success, non-zero on fail