rocm.bindings.cyamdsmi

rocm.bindings.cyamdsmi#

2026-09-24

157 min read time

Applies to Linux and Windows

Advanced Micro Devices, Inc.

Cython declarations for the C-level interface. Use cimport rocm.bindings.cyamdsmi from your Cython code to access these declarations directly.

See also

The high-level Python API is documented at rocm.bindings.amdsmi.

# MIT License
#
# Copyright (c) 2021-2026 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


# This file has been autogenerated, do not modify.

from libc.stdint cimport *
ctypedef bint _Bool # bool is not a reserved keyword in C, _Bool is
cdef extern from "amd_smi/amdsmi.h":

    cdef int AMDSMI_MAX_MM_IP_COUNT

    cdef int AMDSMI_MAX_STRING_LENGTH

    cdef int AMDSMI_MAX_DEVICES

    cdef int AMDSMI_MAX_CACHE_TYPES

    cdef int AMDSMI_MAX_ACCELERATOR_PROFILE

    cdef int AMDSMI_MAX_CP_PROFILE_RESOURCES

    cdef int AMDSMI_MAX_ACCELERATOR_PARTITIONS

    cdef int AMDSMI_MAX_NUM_NUMA_NODES

    cdef int AMDSMI_GPU_UUID_SIZE

    cdef int AMDSMI_MAX_NUM_XGMI_PHYSICAL_LINK

    cdef int AMDSMI_MAX_CONTAINER_TYPE

    cdef int AMDSMI_NUM_HBM_INSTANCES

    cdef int AMDSMI_MAX_NUM_VCN

    cdef int AMDSMI_MAX_NUM_CLKS

    cdef int AMDSMI_MAX_NUM_XGMI_LINKS

    cdef int AMDSMI_MAX_NUM_GFX_CLKS

    cdef int AMDSMI_MAX_AID

    cdef int AMDSMI_MAX_ENGINES

    cdef int AMDSMI_MAX_NUM_JPEG

    cdef int AMDSMI_MAX_NUM_JPEG_ENG_V1

    cdef int AMDSMI_MAX_NUM_XCC

    cdef int AMDSMI_MAX_NUM_XCP

    cdef int AMDSMI_APU_MAX_CORES

    cdef int AMDSMI_APU_V24_CORES

    cdef int AMDSMI_APU_MAX_L3

    cdef int AMDSMI_APU_MAX_IPU

    cdef int AMDSMI_MAX_NUMBER_OF_AFIDS_PER_RECORD

    cdef int AMDSMI_MAX_NUM_HBM_STACKS

    cdef int AMDSMI_MAX_NUM_AID

    cdef int AMDSMI_MAX_NUM_MID

    cdef int AMDSMI_MAX_NUM_CLKS_PER_AID

    cdef int AMDSMI_MAX_NUM_CLKS_PER_MID

    cdef char * AMDSMI_TIME_FORMAT

    cdef char * AMDSMI_DATE_FORMAT

    cdef int AMDSMI_LIB_VERSION_MAJOR

    cdef int AMDSMI_LIB_VERSION_MINOR

    cdef int AMDSMI_LIB_VERSION_RELEASE

    cdef char * AMDSMI_LIB_VERSION_STRING

    cdef int AMDSMI_MAX_DRIVER_INFO_RSVD

    cdef int AMDSMI_MAX_UUID_ELEMENTS

    cdef int AMDSMI_MAX_SPD_DIMM_ADDRESS

    cdef int AMDSMI_MAX_SPD_LID

    cdef int AMDSMI_MAX_SPD_REG_OFFSET

    cdef int AMDSMI_MAX_SPD_REG_SPACE

    cdef int AMDSMI_MAX_SPD_WRITE_DATA

    cdef int AMDSMI_MAX_SVI3_RAIL_INDEX

    cdef int AMDSMI_MAX_SVI3_RAIL_SELECTION

    cdef int AMDSMI_POWER_EFFICIENCY_MODE_4

    cdef int AMDSMI_POWER_EFFICIENCY_MODE_5

    cdef int AMDSMI_MAX_POWER_EFFICIENCY_UTIL

    cdef int AMDSMI_MAX_POWER_EFFICIENCY_PPTLIMIT

    cdef int AMDSMI_RAIL_INDEX_NONE

    cdef int AMDSMI_MAX_NUM_FREQUENCIES

    cdef int AMDSMI_MAX_FAN_SPEED

    cdef int AMDSMI_NUM_VOLTAGE_CURVE_POINTS

    cdef int AMDSMI_MAX_UTILIZATION_VALUES

    cdef int AMDSMI_MAX_NUM_PM_POLICIES

    cdef int AMDSMI_MAX_NIC_PORTS

    cdef int AMDSMI_MAX_NIC_RDMA_DEV

    cdef int AMDSMI_MAX_NIC_FW

    cdef int AMDSMI_FABRIC_LABEL_MAX_LENGTH

    cdef int AMDSMI_FABRIC_PPOD_ID_SIZE

    cdef int AMDSMI_MAX_CARVEOUT_OPTIONS

    cdef struct timespec:
        long tv_sec
        long tv_nsec

    ctypedef enum amdsmi_init_flags_t:
        AMDSMI_INIT_ALL_PROCESSORS
        AMDSMI_INIT_AMD_CPUS
        AMDSMI_INIT_AMD_GPUS
        AMDSMI_INIT_NON_AMD_CPUS
        AMDSMI_INIT_NON_AMD_GPUS
        AMDSMI_INIT_AMD_APUS
        AMDSMI_INIT_AMD_NICS

    ctypedef enum amdsmi_mm_ip_t:
        AMDSMI_MM_UVD
        AMDSMI_MM_VCE
        AMDSMI_MM_VCN
        AMDSMI_MM__MAX

    ctypedef enum amdsmi_container_types_t:
        AMDSMI_CONTAINER_LXC
        AMDSMI_CONTAINER_DOCKER

    ctypedef void * amdsmi_processor_handle

    ctypedef void * amdsmi_socket_handle

    ctypedef void * amdsmi_node_handle

    ctypedef void * amdsmi_cpusocket_handle

    ctypedef struct amdsmi_hsmp_driver_version_t:
        uint32_t major
        uint32_t minor

    ctypedef enum amdsmi_processor_type_t:
        AMDSMI_PROCESSOR_TYPE_UNKNOWN
        AMDSMI_PROCESSOR_TYPE_AMD_GPU
        AMDSMI_PROCESSOR_TYPE_AMD_CPU
        AMDSMI_PROCESSOR_TYPE_NON_AMD_GPU
        AMDSMI_PROCESSOR_TYPE_NON_AMD_CPU
        AMDSMI_PROCESSOR_TYPE_AMD_CPU_CORE
        AMDSMI_PROCESSOR_TYPE_AMD_APU
        AMDSMI_PROCESSOR_TYPE_AMD_NIC
        AMDSMI_PROCESSOR_TYPE_BRCM_NIC
        AMDSMI_PROCESSOR_TYPE_BRCM_SWITCH

    ctypedef amdsmi_processor_type_t processor_type_t

    ctypedef enum amdsmi_status_t:
        AMDSMI_STATUS_SUCCESS
        AMDSMI_STATUS_INVAL
        AMDSMI_STATUS_NOT_SUPPORTED
        AMDSMI_STATUS_NOT_YET_IMPLEMENTED
        AMDSMI_STATUS_FAIL_LOAD_MODULE
        AMDSMI_STATUS_FAIL_LOAD_SYMBOL
        AMDSMI_STATUS_DRM_ERROR
        AMDSMI_STATUS_API_FAILED
        AMDSMI_STATUS_TIMEOUT
        AMDSMI_STATUS_RETRY
        AMDSMI_STATUS_NO_PERM
        AMDSMI_STATUS_INTERRUPT
        AMDSMI_STATUS_IO
        AMDSMI_STATUS_ADDRESS_FAULT
        AMDSMI_STATUS_FILE_ERROR
        AMDSMI_STATUS_OUT_OF_RESOURCES
        AMDSMI_STATUS_INTERNAL_EXCEPTION
        AMDSMI_STATUS_INPUT_OUT_OF_BOUNDS
        AMDSMI_STATUS_INIT_ERROR
        AMDSMI_STATUS_REFCOUNT_OVERFLOW
        AMDSMI_STATUS_DIRECTORY_NOT_FOUND
        AMDSMI_STATUS_IPC_ERROR
        AMDSMI_STATUS_BUSY
        AMDSMI_STATUS_NOT_FOUND
        AMDSMI_STATUS_NOT_INIT
        AMDSMI_STATUS_NO_SLOT
        AMDSMI_STATUS_DRIVER_NOT_LOADED
        AMDSMI_STATUS_MORE_DATA
        AMDSMI_STATUS_NO_DATA
        AMDSMI_STATUS_INSUFFICIENT_SIZE
        AMDSMI_STATUS_UNEXPECTED_SIZE
        AMDSMI_STATUS_UNEXPECTED_DATA
        AMDSMI_STATUS_NON_AMD_CPU
        AMDSMI_STATUS_NO_ENERGY_DRV
        AMDSMI_STATUS_NO_MSR_DRV
        AMDSMI_STATUS_NO_HSMP_DRV
        AMDSMI_STATUS_NO_HSMP_SUP
        AMDSMI_STATUS_NO_HSMP_MSG_SUP
        AMDSMI_STATUS_HSMP_TIMEOUT
        AMDSMI_STATUS_NO_DRV
        AMDSMI_STATUS_FILE_NOT_FOUND
        AMDSMI_STATUS_ARG_PTR_NULL
        AMDSMI_STATUS_AMDGPU_RESTART_ERR
        AMDSMI_STATUS_SETTING_UNAVAILABLE
        AMDSMI_STATUS_CORRUPTED_EEPROM
        AMDSMI_STATUS_MAP_ERROR
        AMDSMI_STATUS_UNKNOWN_ERROR

    ctypedef enum amdsmi_clk_type_t:
        AMDSMI_CLK_TYPE_SYS
        AMDSMI_CLK_TYPE_FIRST
        AMDSMI_CLK_TYPE_GFX
        AMDSMI_CLK_TYPE_DF
        AMDSMI_CLK_TYPE_DCEF
        AMDSMI_CLK_TYPE_SOC
        AMDSMI_CLK_TYPE_MEM
        AMDSMI_CLK_TYPE_PCIE
        AMDSMI_CLK_TYPE_VCLK0
        AMDSMI_CLK_TYPE_VCLK1
        AMDSMI_CLK_TYPE_DCLK0
        AMDSMI_CLK_TYPE_DCLK1
        AMDSMI_CLK_TYPE__MAX

    ctypedef enum amdsmi_accelerator_partition_type_t:
        AMDSMI_ACCELERATOR_PARTITION_INVALID
        AMDSMI_ACCELERATOR_PARTITION_SPX
        AMDSMI_ACCELERATOR_PARTITION_DPX
        AMDSMI_ACCELERATOR_PARTITION_TPX
        AMDSMI_ACCELERATOR_PARTITION_QPX
        AMDSMI_ACCELERATOR_PARTITION_CPX
        AMDSMI_ACCELERATOR_PARTITION_MAX

    ctypedef enum amdsmi_accelerator_partition_resource_type_t:
        AMDSMI_ACCELERATOR_XCC
        AMDSMI_ACCELERATOR_ENCODER
        AMDSMI_ACCELERATOR_DECODER
        AMDSMI_ACCELERATOR_DMA
        AMDSMI_ACCELERATOR_JPEG
        AMDSMI_ACCELERATOR_MAX

    ctypedef enum amdsmi_compute_partition_type_t:
        AMDSMI_COMPUTE_PARTITION_INVALID
        AMDSMI_COMPUTE_PARTITION_SPX
        AMDSMI_COMPUTE_PARTITION_DPX
        AMDSMI_COMPUTE_PARTITION_TPX
        AMDSMI_COMPUTE_PARTITION_QPX
        AMDSMI_COMPUTE_PARTITION_CPX

    ctypedef enum amdsmi_compute_partition_mem_alloc_mode_t:
        AMDSMI_COMPUTE_PARTITION_MEM_ALLOC_INVALID
        AMDSMI_COMPUTE_PARTITION_MEM_ALLOC_CAPPING
        AMDSMI_COMPUTE_PARTITION_MEM_ALLOC_ALL

    ctypedef enum amdsmi_accelerator_partition_mem_alloc_mode_t:
        AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_INVALID
        AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_CAPPING
        AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_ALL

    ctypedef enum amdsmi_memory_partition_type_t:
        AMDSMI_MEMORY_PARTITION_UNKNOWN
        AMDSMI_MEMORY_PARTITION_NPS1
        AMDSMI_MEMORY_PARTITION_NPS2
        AMDSMI_MEMORY_PARTITION_NPS4
        AMDSMI_MEMORY_PARTITION_NPS8

    ctypedef enum amdsmi_temperature_type_t:
        AMDSMI_TEMPERATURE_TYPE_EDGE
        AMDSMI_TEMPERATURE_TYPE_FIRST
        AMDSMI_TEMPERATURE_TYPE_HOTSPOT
        AMDSMI_TEMPERATURE_TYPE_JUNCTION
        AMDSMI_TEMPERATURE_TYPE_VRAM
        AMDSMI_TEMPERATURE_TYPE_HBM_0
        AMDSMI_TEMPERATURE_TYPE_HBM_1
        AMDSMI_TEMPERATURE_TYPE_HBM_2
        AMDSMI_TEMPERATURE_TYPE_HBM_3
        AMDSMI_TEMPERATURE_TYPE_PLX
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_FIRST
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_RETIMER_X
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_IBC
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_IBC_2
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_VDD18_VR
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_04_HBM_B_VR
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_OAM_X_04_HBM_D_VR
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_NODE_LAST
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VR_FIRST
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_VDD0
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_VDD1
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_VDD2
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_VDD3
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_SOC_A
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_SOC_C
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_SOCIO_A
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_SOCIO_C
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDD_085_HBM
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_11_HBM_B
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_11_HBM_D
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDD_USR
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_11_E32
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_04_HBM_B
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_04_HBM_D
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_075_HBM_B
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_075_HBM_D
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_11_GTA_A
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_11_GTA_C
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDAN_075_GTA_A
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDAN_075_GTA_C
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDCR_075_UCIE
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_065_UCIEAA
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_065_UCIEAM_A
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDIO_065_UCIEAM_C
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VDDAN_075
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_VR_LAST
        AMDSMI_TEMPERATURE_TYPE_GPUBOARD_LAST
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_FIRST
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_FPGA
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_FRONT
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_BACK
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_OAM7
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_IBC
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_UFPGA
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_OAM1
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_OAM_0_1_HSC
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_OAM_2_3_HSC
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_OAM_4_5_HSC
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_OAM_6_7_HSC
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_FPGA_0V72_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_UBB_FPGA_3V3_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_RETIMER_0_1_2_3_1V2_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_RETIMER_4_5_6_7_1V2_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_RETIMER_0_1_0V9_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_RETIMER_4_5_0V9_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_RETIMER_2_3_0V9_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_RETIMER_6_7_0V9_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_OAM_0_1_2_3_3V3_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_OAM_4_5_6_7_3V3_VR
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_IBC_HSC
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_IBC
        AMDSMI_TEMPERATURE_TYPE_BASEBOARD_LAST
        AMDSMI_TEMPERATURE_TYPE__MAX

    ctypedef enum amdsmi_fw_block_t:
        AMDSMI_FW_ID_SMU
        AMDSMI_FW_ID_FIRST
        AMDSMI_FW_ID_CP_CE
        AMDSMI_FW_ID_CP_PFP
        AMDSMI_FW_ID_CP_ME
        AMDSMI_FW_ID_CP_MEC_JT1
        AMDSMI_FW_ID_CP_MEC_JT2
        AMDSMI_FW_ID_CP_MEC1
        AMDSMI_FW_ID_CP_MEC2
        AMDSMI_FW_ID_RLC
        AMDSMI_FW_ID_SDMA0
        AMDSMI_FW_ID_SDMA1
        AMDSMI_FW_ID_SDMA2
        AMDSMI_FW_ID_SDMA3
        AMDSMI_FW_ID_SDMA4
        AMDSMI_FW_ID_SDMA5
        AMDSMI_FW_ID_SDMA6
        AMDSMI_FW_ID_SDMA7
        AMDSMI_FW_ID_VCN
        AMDSMI_FW_ID_UVD
        AMDSMI_FW_ID_VCE
        AMDSMI_FW_ID_ISP
        AMDSMI_FW_ID_DMCU_ERAM
        AMDSMI_FW_ID_DMCU_ISR
        AMDSMI_FW_ID_RLC_RESTORE_LIST_GPM_MEM
        AMDSMI_FW_ID_RLC_RESTORE_LIST_SRM_MEM
        AMDSMI_FW_ID_RLC_RESTORE_LIST_CNTL
        AMDSMI_FW_ID_RLC_V
        AMDSMI_FW_ID_MMSCH
        AMDSMI_FW_ID_PSP_SYSDRV
        AMDSMI_FW_ID_PSP_SOSDRV
        AMDSMI_FW_ID_PSP_TOC
        AMDSMI_FW_ID_PSP_KEYDB
        AMDSMI_FW_ID_DFC
        AMDSMI_FW_ID_PSP_SPL
        AMDSMI_FW_ID_DRV_CAP
        AMDSMI_FW_ID_MC
        AMDSMI_FW_ID_PSP_BL
        AMDSMI_FW_ID_CP_PM4
        AMDSMI_FW_ID_RLC_P
        AMDSMI_FW_ID_SEC_POLICY_STAGE2
        AMDSMI_FW_ID_REG_ACCESS_WHITELIST
        AMDSMI_FW_ID_IMU_DRAM
        AMDSMI_FW_ID_IMU_IRAM
        AMDSMI_FW_ID_SDMA_TH0
        AMDSMI_FW_ID_SDMA_TH1
        AMDSMI_FW_ID_CP_MES
        AMDSMI_FW_ID_MES_KIQ
        AMDSMI_FW_ID_MES_STACK
        AMDSMI_FW_ID_MES_THREAD1
        AMDSMI_FW_ID_MES_THREAD1_STACK
        AMDSMI_FW_ID_RLX6
        AMDSMI_FW_ID_RLX6_DRAM_BOOT
        AMDSMI_FW_ID_RS64_ME
        AMDSMI_FW_ID_RS64_ME_P0_DATA
        AMDSMI_FW_ID_RS64_ME_P1_DATA
        AMDSMI_FW_ID_RS64_PFP
        AMDSMI_FW_ID_RS64_PFP_P0_DATA
        AMDSMI_FW_ID_RS64_PFP_P1_DATA
        AMDSMI_FW_ID_RS64_MEC
        AMDSMI_FW_ID_RS64_MEC_P0_DATA
        AMDSMI_FW_ID_RS64_MEC_P1_DATA
        AMDSMI_FW_ID_RS64_MEC_P2_DATA
        AMDSMI_FW_ID_RS64_MEC_P3_DATA
        AMDSMI_FW_ID_PPTABLE
        AMDSMI_FW_ID_PSP_SOC
        AMDSMI_FW_ID_PSP_DBG
        AMDSMI_FW_ID_PSP_INTF
        AMDSMI_FW_ID_RLX6_CORE1
        AMDSMI_FW_ID_RLX6_DRAM_BOOT_CORE1
        AMDSMI_FW_ID_RLCV_LX7
        AMDSMI_FW_ID_RLC_SAVE_RESTORE_LIST
        AMDSMI_FW_ID_ASD
        AMDSMI_FW_ID_TA_RAS
        AMDSMI_FW_ID_TA_XGMI
        AMDSMI_FW_ID_RLC_SRLG
        AMDSMI_FW_ID_RLC_SRLS
        AMDSMI_FW_ID_PM
        AMDSMI_FW_ID_DMCU
        AMDSMI_FW_ID_PLDM_BUNDLE
        AMDSMI_FW_ID__MAX

    ctypedef enum amdsmi_vram_type_t:
        AMDSMI_VRAM_TYPE_UNKNOWN
        AMDSMI_VRAM_TYPE_HBM
        AMDSMI_VRAM_TYPE_HBM2
        AMDSMI_VRAM_TYPE_HBM2E
        AMDSMI_VRAM_TYPE_HBM3
        AMDSMI_VRAM_TYPE_HBM3E
        AMDSMI_VRAM_TYPE_DDR2
        AMDSMI_VRAM_TYPE_DDR3
        AMDSMI_VRAM_TYPE_DDR4
        AMDSMI_VRAM_TYPE_DDR5
        AMDSMI_VRAM_TYPE_GDDR1
        AMDSMI_VRAM_TYPE_GDDR2
        AMDSMI_VRAM_TYPE_GDDR3
        AMDSMI_VRAM_TYPE_GDDR4
        AMDSMI_VRAM_TYPE_GDDR5
        AMDSMI_VRAM_TYPE_GDDR6
        AMDSMI_VRAM_TYPE_GDDR7
        AMDSMI_VRAM_TYPE_LPDDR4
        AMDSMI_VRAM_TYPE_LPDDR5
        AMDSMI_VRAM_TYPE__MAX

    ctypedef struct amdsmi_range_t:
        uint64_t lower_bound
        uint64_t upper_bound
        uint64_t reserved[2]

    ctypedef struct amdsmi_xgmi_info_t:
        uint8_t xgmi_lanes
        uint64_t xgmi_hive_id
        uint64_t xgmi_node_id
        uint32_t index
        uint32_t reserved[9]

    ctypedef struct amdsmi_vram_usage_t:
        uint32_t vram_total
        uint32_t vram_used
        uint32_t reserved[2]

    ctypedef struct amdsmi_violation_status_t:
        uint64_t reference_timestamp
        uint64_t violation_timestamp
        uint64_t acc_counter
        uint64_t acc_prochot_thrm
        uint64_t acc_ppt_pwr
        uint64_t acc_socket_thrm
        uint64_t acc_vr_thrm
        uint64_t acc_hbm_thrm
        uint64_t acc_gfx_clk_below_host_limit
        uint64_t per_prochot_thrm
        uint64_t per_ppt_pwr
        uint64_t per_socket_thrm
        uint64_t per_vr_thrm
        uint64_t per_hbm_thrm
        uint64_t per_gfx_clk_below_host_limit
        uint8_t active_prochot_thrm
        uint8_t active_ppt_pwr
        uint8_t active_socket_thrm
        uint8_t active_vr_thrm
        uint8_t active_hbm_thrm
        uint8_t active_gfx_clk_below_host_limit
        uint64_t acc_gfx_clk_below_host_limit_pwr[8][8]
        uint64_t acc_gfx_clk_below_host_limit_thm[8][8]
        uint64_t acc_low_utilization[8][8]
        uint64_t acc_gfx_clk_below_host_limit_total[8][8]
        uint64_t per_gfx_clk_below_host_limit_pwr[8][8]
        uint64_t per_gfx_clk_below_host_limit_thm[8][8]
        uint64_t per_low_utilization[8][8]
        uint64_t per_gfx_clk_below_host_limit_total[8][8]
        uint8_t active_gfx_clk_below_host_limit_pwr[8][8]
        uint8_t active_gfx_clk_below_host_limit_thm[8][8]
        uint8_t active_low_utilization[8][8]
        uint8_t active_gfx_clk_below_host_limit_total[8][8]
        uint64_t reserved[8][8]
        uint64_t reserved2[8][8]
        uint64_t reserved3[8][8]

    ctypedef struct amdsmi_frequency_range_t:
        amdsmi_range_t supported_freq_range
        amdsmi_range_t current_freq_range
        uint32_t reserved[8]

cdef struct amdsmi_bdf_t_bdf_:
    uint64_t function_number
    uint64_t device_number
    uint64_t bus_number
    uint64_t domain_number

cdef struct amdsmi_bdf_t_struct_0:
    uint64_t function_number
    uint64_t device_number
    uint64_t bus_number
    uint64_t domain_number

cdef extern from "amd_smi/amdsmi.h":

    ctypedef union amdsmi_bdf_t:
        amdsmi_bdf_t_bdf_ bdf
        uint64_t as_uint

    ctypedef struct amdsmi_enumeration_info_t:
        uint32_t drm_render
        uint32_t drm_card
        uint32_t hsa_id
        uint32_t hip_id
        char hip_uuid[256]
        uint32_t oam_id

    ctypedef enum amdsmi_card_form_factor_t:
        AMDSMI_CARD_FORM_FACTOR_PCIE
        AMDSMI_CARD_FORM_FACTOR_OAM
        AMDSMI_CARD_FORM_FACTOR_CEM
        AMDSMI_CARD_FORM_FACTOR_UNKNOWN

cdef struct amdsmi_pcie_info_t_pcie_static_:
    uint16_t max_pcie_width
    uint32_t max_pcie_speed
    uint32_t pcie_interface_version
    amdsmi_card_form_factor_t slot_type
    uint32_t max_pcie_interface_version
    uint64_t reserved[9]

cdef struct amdsmi_pcie_info_t_pcie_metric_:
    uint16_t pcie_width
    uint32_t pcie_speed
    uint32_t pcie_bandwidth
    uint64_t pcie_replay_count
    uint64_t pcie_l0_to_recovery_count
    uint64_t pcie_replay_roll_over_count
    uint64_t pcie_nak_sent_count
    uint64_t pcie_nak_received_count
    uint32_t pcie_lc_perf_other_end_recovery_count
    uint64_t reserved[12]

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_pcie_info_t:
        amdsmi_pcie_info_t_pcie_static_ pcie_static
        amdsmi_pcie_info_t_pcie_metric_ pcie_metric
        uint64_t reserved[32]

    ctypedef struct amdsmi_power_cap_info_t:
        uint64_t power_cap
        uint64_t default_power_cap
        uint64_t dpm_cap
        uint64_t min_power_cap
        uint64_t max_power_cap
        uint64_t reserved[3]

    ctypedef enum amdsmi_power_cap_type_t:
        AMDSMI_POWER_CAP_TYPE_PPT0
        AMDSMI_POWER_CAP_TYPE_PPT1

    ctypedef struct amdsmi_vbios_info_t:
        char name[256]
        char build_date[256]
        char part_number[256]
        char version[256]
        char boot_firmware[256]
        uint64_t reserved[36]

    ctypedef enum amdsmi_cache_property_type_t:
        AMDSMI_CACHE_PROPERTY_ENABLED
        AMDSMI_CACHE_PROPERTY_DATA_CACHE
        AMDSMI_CACHE_PROPERTY_INST_CACHE
        AMDSMI_CACHE_PROPERTY_CPU_CACHE
        AMDSMI_CACHE_PROPERTY_SIMD_CACHE

cdef struct amdsmi_gpu_cache_info_t_cache_:
    uint32_t cache_properties
    uint32_t cache_size
    uint32_t cache_level
    uint32_t max_num_cu_shared
    uint32_t num_cache_instance
    uint32_t reserved[3]

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_gpu_cache_info_t:
        uint32_t num_cache_types
        amdsmi_gpu_cache_info_t_cache_ cache[10]
        uint32_t reserved[15]

cdef struct amdsmi_fw_info_t_fw_info_list_:
    amdsmi_fw_block_t fw_id
    uint64_t fw_version
    uint64_t reserved[2]

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_fw_info_t:
        uint8_t num_fw_info
        amdsmi_fw_info_t_fw_info_list_ fw_info_list[80]
        uint32_t reserved[7]

    ctypedef struct amdsmi_asic_info_t:
        char market_name[256]
        uint32_t vendor_id
        char vendor_name[256]
        uint32_t subvendor_id
        uint64_t device_id
        uint32_t rev_id
        char asic_serial[256]
        uint32_t oam_id
        uint32_t num_of_compute_units
        uint64_t target_graphics_version
        uint32_t subsystem_id
        uint64_t flags
        uint32_t reserved[18]

    ctypedef struct amdsmi_kfd_info_t:
        uint64_t kfd_id
        uint32_t node_id
        uint32_t current_partition_id
        uint32_t reserved[12]

cdef struct amdsmi_nps_caps_t_nps_flags_:
    uint32_t nps1_cap
    uint32_t nps2_cap
    uint32_t nps4_cap
    uint32_t nps8_cap
    uint32_t reserved

cdef extern from "amd_smi/amdsmi.h":

    ctypedef union amdsmi_nps_caps_t:
        amdsmi_nps_caps_t_nps_flags_ nps_flags
        uint32_t nps_cap_mask

cdef struct amdsmi_memory_partition_config_t_numa_range_:
    amdsmi_vram_type_t memory_type
    uint64_t start
    uint64_t end

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_memory_partition_config_t:
        amdsmi_nps_caps_t partition_caps
        amdsmi_memory_partition_type_t mp_mode
        uint32_t num_numa_ranges
        amdsmi_memory_partition_config_t_numa_range_ numa_range[32]
        uint64_t reserved[11]

    ctypedef struct amdsmi_accelerator_partition_profile_t:
        amdsmi_accelerator_partition_type_t profile_type
        uint32_t num_partitions
        amdsmi_nps_caps_t memory_caps
        uint32_t profile_index
        uint32_t num_resources
        uint32_t resources[8][32]
        uint64_t reserved[13]

    ctypedef struct amdsmi_accelerator_partition_resource_profile_t:
        uint32_t profile_index
        amdsmi_accelerator_partition_resource_type_t resource_type
        uint32_t partition_resource
        uint32_t num_partitions_share_resource
        uint64_t reserved[6]

    ctypedef struct amdsmi_accelerator_partition_profile_config_t:
        uint32_t num_profiles
        uint32_t num_resource_profiles
        amdsmi_accelerator_partition_resource_profile_t resource_profiles[32]
        uint32_t default_profile_index
        amdsmi_accelerator_partition_profile_t profiles[32]
        uint64_t reserved[30]

    ctypedef enum amdsmi_link_type_t:
        AMDSMI_LINK_TYPE_INTERNAL
        AMDSMI_LINK_TYPE_PCIE
        AMDSMI_LINK_TYPE_XGMI
        AMDSMI_LINK_TYPE_NOT_APPLICABLE
        AMDSMI_LINK_TYPE_UNKNOWN
        AMDSMI_LINK_TYPE_NUMA
        AMDSMI_LINK_TYPE_XNUMA

    ctypedef struct amdsmi_cpu_util_t:
        uint32_t cpu_util_total
        uint32_t cpu_util_user
        uint32_t cpu_util_nice
        uint32_t cpu_util_sys
        uint32_t cpu_util_irq

    ctypedef enum amdsmi_link_status_t:
        AMDSMI_LINK_STATUS_ENABLED
        AMDSMI_LINK_STATUS_DISABLED
        AMDSMI_LINK_STATUS_INACTIVE
        AMDSMI_LINK_STATUS_ERROR

cdef struct amdsmi_link_metrics_t__links:
    amdsmi_bdf_t bdf
    uint32_t bit_rate
    uint32_t max_bandwidth
    amdsmi_link_type_t link_type
    uint64_t read
    uint64_t write
    amdsmi_link_status_t link_status
    uint64_t reserved[1]

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_link_metrics_t:
        uint32_t num_links
        amdsmi_link_metrics_t__links links[64]
        uint64_t reserved[7]

    ctypedef struct amdsmi_vram_info_t:
        amdsmi_vram_type_t vram_type
        char vram_vendor[256]
        uint64_t vram_size
        uint32_t vram_bit_width
        uint64_t vram_max_bandwidth
        uint64_t reserved[37]

    ctypedef struct amdsmi_driver_info_t:
        char driver_version[256]
        char driver_date[256]
        char driver_name[256]

    ctypedef struct amdsmi_board_info_t:
        char model_number[256]
        char product_serial[256]
        char fru_id[256]
        char product_name[256]
        char manufacturer_name[256]
        uint64_t reserved[64]

    ctypedef struct amdsmi_power_info_t:
        uint64_t socket_power
        uint32_t current_socket_power
        uint32_t average_socket_power
        uint64_t gfx_voltage
        uint64_t soc_voltage
        uint64_t mem_voltage
        uint32_t power_limit
        uint32_t ubb_power
        uint64_t reserved[18]

    ctypedef struct amdsmi_clk_info_t:
        uint32_t clk
        uint32_t min_clk
        uint32_t max_clk
        uint8_t clk_locked
        uint8_t clk_deep_sleep
        uint32_t reserved[4]

    ctypedef struct amdsmi_engine_usage_t:
        uint32_t gfx_activity
        uint32_t umc_activity
        uint32_t mm_activity
        uint32_t reserved[13]

    ctypedef uint32_t amdsmi_process_handle_t

cdef struct amdsmi_proc_info_t_engine_usage_:
    uint64_t gfx
    uint64_t enc
    uint32_t reserved[12]

cdef struct amdsmi_proc_info_t_memory_usage_:
    uint64_t gtt_mem
    uint64_t cpu_mem
    uint64_t vram_mem
    uint32_t reserved[10]

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_proc_info_t:
        char name[256]
        uint32_t pid
        uint64_t mem
        amdsmi_proc_info_t_engine_usage_ engine_usage
        amdsmi_proc_info_t_memory_usage_ memory_usage
        char container_name[256]
        uint32_t cu_occupancy
        uint32_t evicted_time
        uint64_t sdma_usage
        uint32_t reserved[8]

cdef struct amdsmi_proc_gpu_entry_t_struct_0:
    uint64_t gfx
    uint64_t enc
    uint32_t reserved[12]

cdef struct amdsmi_proc_gpu_entry_t_struct_1:
    uint64_t gtt_mem
    uint64_t cpu_mem
    uint64_t vram_mem
    uint32_t reserved[10]

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_proc_gpu_entry_t:
        uint32_t gpu_index
        uint64_t mem
        amdsmi_proc_gpu_entry_t_struct_0 engine_usage
        amdsmi_proc_gpu_entry_t_struct_1 memory_usage
        uint32_t cu_occupancy
        uint32_t evicted_time
        uint64_t sdma_usage
        uint32_t reserved[8]

    ctypedef struct amdsmi_proc_info_by_pid_t:
        uint32_t pid
        char name[256]
        char container_name[256]
        uint32_t num_gpus
        amdsmi_proc_gpu_entry_t gpus[32]

    ctypedef struct amdsmi_p2p_capability_t:
        uint8_t is_iolink_coherent
        uint8_t is_iolink_atomics_32bit
        uint8_t is_iolink_atomics_64bit
        uint8_t is_iolink_dma
        uint8_t is_iolink_bi_directional

    ctypedef enum amdsmi_dev_perf_level_t:
        AMDSMI_DEV_PERF_LEVEL_AUTO
        AMDSMI_DEV_PERF_LEVEL_FIRST
        AMDSMI_DEV_PERF_LEVEL_LOW
        AMDSMI_DEV_PERF_LEVEL_HIGH
        AMDSMI_DEV_PERF_LEVEL_MANUAL
        AMDSMI_DEV_PERF_LEVEL_STABLE_STD
        AMDSMI_DEV_PERF_LEVEL_STABLE_PEAK
        AMDSMI_DEV_PERF_LEVEL_STABLE_MIN_MCLK
        AMDSMI_DEV_PERF_LEVEL_STABLE_MIN_SCLK
        AMDSMI_DEV_PERF_LEVEL_DETERMINISM
        AMDSMI_DEV_PERF_LEVEL_LAST
        AMDSMI_DEV_PERF_LEVEL_UNKNOWN

    ctypedef uintptr_t amdsmi_event_handle_t

    ctypedef enum amdsmi_event_group_t:
        AMDSMI_EVNT_GRP_XGMI
        AMDSMI_EVNT_GRP_XGMI_DATA_OUT
        AMDSMI_EVNT_GRP_INVALID

    ctypedef enum amdsmi_event_type_t:
        AMDSMI_EVNT_FIRST
        AMDSMI_EVNT_XGMI_FIRST
        AMDSMI_EVNT_XGMI_0_NOP_TX
        AMDSMI_EVNT_XGMI_0_REQUEST_TX
        AMDSMI_EVNT_XGMI_0_RESPONSE_TX
        AMDSMI_EVNT_XGMI_0_BEATS_TX
        AMDSMI_EVNT_XGMI_1_NOP_TX
        AMDSMI_EVNT_XGMI_1_REQUEST_TX
        AMDSMI_EVNT_XGMI_1_RESPONSE_TX
        AMDSMI_EVNT_XGMI_1_BEATS_TX
        AMDSMI_EVNT_XGMI_LAST
        AMDSMI_EVNT_XGMI_DATA_OUT_FIRST
        AMDSMI_EVNT_XGMI_DATA_OUT_0
        AMDSMI_EVNT_XGMI_DATA_OUT_1
        AMDSMI_EVNT_XGMI_DATA_OUT_2
        AMDSMI_EVNT_XGMI_DATA_OUT_3
        AMDSMI_EVNT_XGMI_DATA_OUT_4
        AMDSMI_EVNT_XGMI_DATA_OUT_5
        AMDSMI_EVNT_XGMI_DATA_OUT_LAST
        AMDSMI_EVNT_LAST

    ctypedef enum amdsmi_counter_command_t:
        AMDSMI_CNTR_CMD_START
        AMDSMI_CNTR_CMD_STOP

    ctypedef struct amdsmi_counter_value_t:
        uint64_t value
        uint64_t time_enabled
        uint64_t time_running

    ctypedef enum amdsmi_evt_notification_type_t:
        AMDSMI_EVT_NOTIF_NONE
        AMDSMI_EVT_NOTIF_VMFAULT
        AMDSMI_EVT_NOTIF_FIRST
        AMDSMI_EVT_NOTIF_THERMAL_THROTTLE
        AMDSMI_EVT_NOTIF_GPU_PRE_RESET
        AMDSMI_EVT_NOTIF_GPU_POST_RESET
        AMDSMI_EVT_NOTIF_MIGRATE_START
        AMDSMI_EVT_NOTIF_MIGRATE_END
        AMDSMI_EVT_NOTIF_PAGE_FAULT_START
        AMDSMI_EVT_NOTIF_PAGE_FAULT_END
        AMDSMI_EVT_NOTIF_QUEUE_EVICTION
        AMDSMI_EVT_NOTIF_QUEUE_RESTORE
        AMDSMI_EVT_NOTIF_UNMAP_FROM_GPU
        AMDSMI_EVT_NOTIF_PROCESS_START
        AMDSMI_EVT_NOTIF_PROCESS_END
        AMDSMI_EVT_NOTIF_LAST

    ctypedef struct amdsmi_evt_notification_data_t:
        void * processor_handle
        amdsmi_evt_notification_type_t event
        char message[256]

    ctypedef enum amdsmi_temperature_metric_t:
        AMDSMI_TEMP_CURRENT
        AMDSMI_TEMP_FIRST
        AMDSMI_TEMP_MAX
        AMDSMI_TEMP_MIN
        AMDSMI_TEMP_MAX_HYST
        AMDSMI_TEMP_MIN_HYST
        AMDSMI_TEMP_CRITICAL
        AMDSMI_TEMP_CRITICAL_HYST
        AMDSMI_TEMP_EMERGENCY
        AMDSMI_TEMP_EMERGENCY_HYST
        AMDSMI_TEMP_CRIT_MIN
        AMDSMI_TEMP_CRIT_MIN_HYST
        AMDSMI_TEMP_OFFSET
        AMDSMI_TEMP_LOWEST
        AMDSMI_TEMP_HIGHEST
        AMDSMI_TEMP_SHUTDOWN
        AMDSMI_TEMP_LAST

    ctypedef enum amdsmi_voltage_metric_t:
        AMDSMI_VOLT_CURRENT
        AMDSMI_VOLT_FIRST
        AMDSMI_VOLT_MAX
        AMDSMI_VOLT_MIN_CRIT
        AMDSMI_VOLT_MIN
        AMDSMI_VOLT_MAX_CRIT
        AMDSMI_VOLT_AVERAGE
        AMDSMI_VOLT_LOWEST
        AMDSMI_VOLT_HIGHEST
        AMDSMI_VOLT_LAST

    ctypedef enum amdsmi_voltage_type_t:
        AMDSMI_VOLT_TYPE_FIRST
        AMDSMI_VOLT_TYPE_VDDGFX
        AMDSMI_VOLT_TYPE_VDDBOARD
        AMDSMI_VOLT_TYPE_LAST
        AMDSMI_VOLT_TYPE_INVALID

    ctypedef enum amdsmi_power_profile_preset_masks_t:
        AMDSMI_PWR_PROF_PRST_CUSTOM_MASK
        AMDSMI_PWR_PROF_PRST_VIDEO_MASK
        AMDSMI_PWR_PROF_PRST_POWER_SAVING_MASK
        AMDSMI_PWR_PROF_PRST_COMPUTE_MASK
        AMDSMI_PWR_PROF_PRST_VR_MASK
        AMDSMI_PWR_PROF_PRST_3D_FULL_SCR_MASK
        AMDSMI_PWR_PROF_PRST_BOOTUP_DEFAULT
        AMDSMI_PWR_PROF_PRST_LAST
        AMDSMI_PWR_PROF_PRST_INVALID

    ctypedef enum amdsmi_gpu_block_t:
        AMDSMI_GPU_BLOCK_INVALID
        AMDSMI_GPU_BLOCK_FIRST
        AMDSMI_GPU_BLOCK_UMC
        AMDSMI_GPU_BLOCK_SDMA
        AMDSMI_GPU_BLOCK_GFX
        AMDSMI_GPU_BLOCK_MMHUB
        AMDSMI_GPU_BLOCK_ATHUB
        AMDSMI_GPU_BLOCK_PCIE_BIF
        AMDSMI_GPU_BLOCK_HDP
        AMDSMI_GPU_BLOCK_XGMI_WAFL
        AMDSMI_GPU_BLOCK_DF
        AMDSMI_GPU_BLOCK_SMN
        AMDSMI_GPU_BLOCK_SEM
        AMDSMI_GPU_BLOCK_MP0
        AMDSMI_GPU_BLOCK_MP1
        AMDSMI_GPU_BLOCK_FUSE
        AMDSMI_GPU_BLOCK_MCA
        AMDSMI_GPU_BLOCK_VCN
        AMDSMI_GPU_BLOCK_JPEG
        AMDSMI_GPU_BLOCK_IH
        AMDSMI_GPU_BLOCK_MPIO
        AMDSMI_GPU_BLOCK_LAST
        AMDSMI_GPU_BLOCK_RESERVED

    ctypedef enum amdsmi_clk_limit_type_t:
        AMDSMI_CLK_LIMIT_MIN
        AMDSMI_CLK_LIMIT_MAX
        CLK_LIMIT_MIN
        CLK_LIMIT_MAX

    ctypedef enum amdsmi_cper_sev_t:
        AMDSMI_CPER_SEV_NON_FATAL_UNCORRECTED
        AMDSMI_CPER_SEV_FATAL
        AMDSMI_CPER_SEV_NON_FATAL_CORRECTED
        AMDSMI_CPER_SEV_NUM
        AMDSMI_CPER_SEV_UNUSED

    ctypedef enum amdsmi_cper_notify_type_t:
        AMDSMI_CPER_NOTIFY_TYPE_CMC
        AMDSMI_CPER_NOTIFY_TYPE_CPE
        AMDSMI_CPER_NOTIFY_TYPE_MCE
        AMDSMI_CPER_NOTIFY_TYPE_PCIE
        AMDSMI_CPER_NOTIFY_TYPE_INIT
        AMDSMI_CPER_NOTIFY_TYPE_NMI
        AMDSMI_CPER_NOTIFY_TYPE_BOOT
        AMDSMI_CPER_NOTIFY_TYPE_DMAR
        AMDSMI_CPER_NOTIFY_TYPE_SEA
        AMDSMI_CPER_NOTIFY_TYPE_SEI
        AMDSMI_CPER_NOTIFY_TYPE_PEI
        AMDSMI_CPER_NOTIFY_TYPE_CXL_COMPONENT

    ctypedef struct amdsmi_gpu_ras_policy_v4_0_t:
        uint16_t dram_non_critical_region_threshold
        uint16_t dram_critical_region_threshold

cdef union amdsmi_gpu_ras_policy_info_t_policy_data_:
    amdsmi_gpu_ras_policy_v4_0_t v4_0
    uint64_t info[5]

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_gpu_ras_policy_info_t:
        uint8_t major_version
        uint8_t minor_version
        amdsmi_gpu_ras_policy_info_t_policy_data_ policy_data

    ctypedef enum amdsmi_ras_err_state_t:
        AMDSMI_RAS_ERR_STATE_NONE
        AMDSMI_RAS_ERR_STATE_DISABLED
        AMDSMI_RAS_ERR_STATE_PARITY
        AMDSMI_RAS_ERR_STATE_SING_C
        AMDSMI_RAS_ERR_STATE_MULT_UC
        AMDSMI_RAS_ERR_STATE_POISON
        AMDSMI_RAS_ERR_STATE_ENABLED
        AMDSMI_RAS_ERR_STATE_LAST
        AMDSMI_RAS_ERR_STATE_INVALID

    ctypedef enum amdsmi_memory_type_t:
        AMDSMI_MEM_TYPE_FIRST
        AMDSMI_MEM_TYPE_VRAM
        AMDSMI_MEM_TYPE_VIS_VRAM
        AMDSMI_MEM_TYPE_GTT
        AMDSMI_MEM_TYPE_LAST

    ctypedef enum amdsmi_freq_ind_t:
        AMDSMI_FREQ_IND_MIN
        AMDSMI_FREQ_IND_MAX
        AMDSMI_FREQ_IND_INVALID

    ctypedef enum amdsmi_xgmi_status_t:
        AMDSMI_XGMI_STATUS_NO_ERRORS
        AMDSMI_XGMI_STATUS_ERROR
        AMDSMI_XGMI_STATUS_MULTIPLE_ERRORS

    ctypedef uint64_t amdsmi_bit_field_t

    ctypedef enum amdsmi_memory_page_status_t:
        AMDSMI_MEM_PAGE_STATUS_RESERVED
        AMDSMI_MEM_PAGE_STATUS_PENDING
        AMDSMI_MEM_PAGE_STATUS_UNRESERVABLE

    ctypedef enum amdsmi_utilization_counter_type_t:
        AMDSMI_UTILIZATION_COUNTER_FIRST
        AMDSMI_COARSE_GRAIN_GFX_ACTIVITY
        AMDSMI_COARSE_GRAIN_MEM_ACTIVITY
        AMDSMI_COARSE_DECODER_ACTIVITY
        AMDSMI_FINE_GRAIN_GFX_ACTIVITY
        AMDSMI_FINE_GRAIN_MEM_ACTIVITY
        AMDSMI_FINE_DECODER_ACTIVITY
        AMDSMI_UTILIZATION_COUNTER_LAST

    ctypedef struct amdsmi_utilization_counter_t:
        amdsmi_utilization_counter_type_t type
        uint64_t value
        uint64_t fine_value[4]
        uint16_t fine_value_count

    ctypedef struct amdsmi_retired_page_record_t:
        uint64_t page_address
        uint64_t page_size
        amdsmi_memory_page_status_t status

    ctypedef struct amdsmi_power_profile_status_t:
        uint64_t available_profiles
        amdsmi_power_profile_preset_masks_t current
        uint32_t num_profiles

    ctypedef struct amdsmi_frequencies_t:
        _Bool has_deep_sleep
        uint32_t num_supported
        uint32_t current
        uint64_t frequency[33]

    ctypedef struct amdsmi_dpm_policy_entry_t:
        uint32_t policy_id
        char policy_description[256]

    ctypedef struct amdsmi_dpm_policy_t:
        uint32_t num_supported
        uint32_t current
        amdsmi_dpm_policy_entry_t policies[32]

    ctypedef struct amdsmi_pcie_bandwidth_t:
        amdsmi_frequencies_t transfer_rate
        uint32_t lanes[33]

    ctypedef struct amdsmi_version_t:
        uint32_t major
        uint32_t minor
        uint32_t release
        const char * build

    ctypedef struct amdsmi_od_vddc_point_t:
        uint64_t frequency
        uint64_t voltage

    ctypedef struct amdsmi_freq_volt_region_t:
        amdsmi_range_t freq_range
        amdsmi_range_t volt_range

    ctypedef struct amdsmi_od_volt_curve_t:
        amdsmi_od_vddc_point_t vc_points[3]

    ctypedef struct amdsmi_od_volt_freq_data_t:
        amdsmi_range_t curr_sclk_range
        amdsmi_range_t curr_mclk_range
        amdsmi_range_t curr_fclk_range
        amdsmi_range_t sclk_freq_limits
        amdsmi_range_t mclk_freq_limits
        amdsmi_range_t fclk_freq_limits
        amdsmi_od_volt_curve_t curve
        uint32_t num_regions

    ctypedef struct amd_metrics_table_header_t:
        uint16_t structure_size
        uint8_t format_revision
        uint8_t content_revision

    ctypedef struct amdsmi_gpu_xcp_metrics_t:
        uint32_t gfx_busy_inst[8]
        uint16_t jpeg_busy[40]
        uint16_t vcn_busy[4]
        uint64_t gfx_busy_acc[8]
        uint64_t gfx_below_host_limit_acc[8]
        uint64_t gfx_below_host_limit_ppt_acc[8]
        uint64_t gfx_below_host_limit_thm_acc[8]
        uint64_t gfx_low_utilization_acc[8]
        uint64_t gfx_below_host_limit_total_acc[8]
        uint16_t temperature_xcd[8]

    ctypedef struct amdsmi_apu_metrics_t:
        uint16_t temperature_gfx
        uint16_t temperature_soc
        uint16_t temperature_core[16]
        uint16_t temperature_l3[2]
        uint16_t temperature_skin
        uint16_t average_gfx_activity
        uint16_t average_mm_activity
        uint16_t average_vcn_activity
        uint16_t average_ipu_activity[8]
        uint16_t average_core_c0_activity[16]
        uint16_t average_dram_reads
        uint16_t average_dram_writes
        uint16_t average_ipu_reads
        uint16_t average_ipu_writes
        uint32_t average_socket_power
        uint16_t average_cpu_power
        uint16_t average_soc_power
        uint32_t average_gfx_power
        uint16_t average_core_power[16]
        uint16_t average_ipu_power
        uint32_t average_apu_power
        uint32_t average_dgpu_power
        uint32_t average_all_core_power
        uint16_t average_sys_power
        uint16_t stapm_power_limit
        uint16_t current_stapm_power_limit
        uint16_t average_gfxclk_frequency
        uint16_t average_socclk_frequency
        uint16_t average_uclk_frequency
        uint16_t average_fclk_frequency
        uint16_t average_vclk_frequency
        uint16_t average_dclk_frequency
        uint16_t average_vpeclk_frequency
        uint16_t average_ipuclk_frequency
        uint16_t average_mpipu_frequency
        uint16_t current_gfxclk
        uint16_t current_socclk
        uint16_t current_uclk
        uint16_t current_fclk
        uint16_t current_vclk
        uint16_t current_dclk
        uint16_t current_coreclk[16]
        uint16_t current_l3clk[2]
        uint16_t current_core_maxfreq
        uint16_t current_gfx_maxfreq
        uint32_t throttle_status
        uint64_t indep_throttle_status
        uint32_t throttle_residency_prochot
        uint32_t throttle_residency_spl
        uint32_t throttle_residency_fppt
        uint32_t throttle_residency_sppt
        uint32_t throttle_residency_thm_core
        uint32_t throttle_residency_thm_gfx
        uint32_t throttle_residency_thm_soc
        uint16_t fan_pwm
        uint16_t average_temperature_gfx
        uint16_t average_temperature_soc
        uint16_t average_temperature_core[16]
        uint16_t average_temperature_l3[2]
        uint16_t average_cpu_voltage
        uint16_t average_soc_voltage
        uint16_t average_gfx_voltage
        uint16_t average_cpu_current
        uint16_t average_soc_current
        uint16_t average_gfx_current
        uint32_t time_filter_alphavalue

    ctypedef struct amdsmi_gpu_metrics_t:
        amd_metrics_table_header_t common_header
        uint16_t temperature_edge
        uint16_t temperature_hotspot
        uint16_t temperature_mem
        uint16_t temperature_vrgfx
        uint16_t temperature_vrsoc
        uint16_t temperature_vrmem
        uint16_t average_gfx_activity
        uint16_t average_umc_activity
        uint16_t average_mm_activity
        uint16_t average_socket_power
        uint64_t energy_accumulator
        uint64_t system_clock_counter
        uint16_t average_gfxclk_frequency
        uint16_t average_socclk_frequency
        uint16_t average_uclk_frequency
        uint16_t average_vclk0_frequency
        uint16_t average_dclk0_frequency
        uint16_t average_vclk1_frequency
        uint16_t average_dclk1_frequency
        uint16_t current_gfxclk
        uint16_t current_socclk
        uint16_t current_uclk
        uint16_t current_vclk0
        uint16_t current_dclk0
        uint16_t current_vclk1
        uint16_t current_dclk1
        uint32_t throttle_status
        uint16_t current_fan_speed
        uint16_t pcie_link_width
        uint16_t pcie_link_speed
        uint64_t gfx_activity_acc
        uint64_t mem_activity_acc
        uint16_t temperature_hbm[4]
        uint64_t firmware_timestamp
        uint16_t voltage_soc
        uint16_t voltage_gfx
        uint16_t voltage_mem
        uint64_t indep_throttle_status
        uint16_t current_socket_power
        uint16_t vcn_activity[4]
        uint32_t gfxclk_lock_status
        uint16_t xgmi_link_width
        uint16_t xgmi_link_speed
        uint64_t pcie_bandwidth_acc
        uint64_t pcie_bandwidth_inst
        uint64_t pcie_l0_to_recov_count_acc
        uint64_t pcie_replay_count_acc
        uint64_t pcie_replay_rover_count_acc
        uint64_t xgmi_read_data_acc[8]
        uint64_t xgmi_write_data_acc[8]
        uint16_t current_gfxclks[8]
        uint16_t current_socclks[4]
        uint16_t current_vclk0s[4]
        uint16_t current_dclk0s[4]
        uint16_t jpeg_activity[32]
        uint64_t pcie_nak_sent_count_acc
        uint64_t pcie_nak_rcvd_count_acc
        uint64_t accumulation_counter
        uint64_t prochot_residency_acc
        uint64_t ppt_residency_acc
        uint64_t socket_thm_residency_acc
        uint64_t vr_thm_residency_acc
        uint64_t hbm_thm_residency_acc
        uint16_t num_partition
        amdsmi_gpu_xcp_metrics_t xcp_stats[8]
        uint64_t pcie_lc_perf_other_end_recovery
        uint64_t vram_max_bandwidth
        uint16_t xgmi_link_status[8]
        uint16_t temperature_hbm_stacks[12]
        uint16_t temperature_mid[2]
        uint16_t temperature_aid[2]
        uint16_t current_uclk_aid[2]
        uint16_t current_socclks_mid[2]
        amdsmi_apu_metrics_t * apu_metrics

    ctypedef enum amdsmi_xgmi_link_status_type_t:
        AMDSMI_XGMI_LINK_DOWN
        AMDSMI_XGMI_LINK_UP
        AMDSMI_XGMI_LINK_DISABLE

    ctypedef struct amdsmi_xgmi_link_status_t:
        uint32_t total_links
        amdsmi_xgmi_link_status_type_t status[8]
        uint64_t reserved[7]

    ctypedef struct amdsmi_name_value_t:
        char name[256]
        uint64_t value

    ctypedef enum amdsmi_reg_type_t:
        AMDSMI_REG_XGMI
        AMDSMI_REG_WAFL
        AMDSMI_REG_PCIE
        AMDSMI_REG_USR
        AMDSMI_REG_USR1

cdef struct amdsmi_ras_feature_t_ras_info_:
    uint32_t dram_ecc
    uint32_t sram_ecc
    uint32_t poisoning
    uint32_t rsvd

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_ras_feature_t:
        uint32_t ras_eeprom_version
        uint32_t ecc_correction_schema_flag
        amdsmi_ras_feature_t_ras_info_ ras_info
        _Bool needs_reboot

    ctypedef struct amdsmi_error_count_t:
        uint64_t correctable_count
        uint64_t uncorrectable_count
        uint64_t deferred_count
        uint64_t reserved[5]

    ctypedef struct amdsmi_process_info_t:
        uint32_t process_id
        uint64_t vram_usage
        uint64_t sdma_usage
        uint32_t cu_occupancy
        uint32_t evicted_time

    ctypedef struct amdsmi_topology_nearest_t:
        uint32_t count
        void * processor_list[256]
        uint64_t reserved[15]

    ctypedef enum amdsmi_virtualization_mode_t:
        AMDSMI_VIRTUALIZATION_MODE_UNKNOWN
        AMDSMI_VIRTUALIZATION_MODE_BAREMETAL
        AMDSMI_VIRTUALIZATION_MODE_HOST
        AMDSMI_VIRTUALIZATION_MODE_GUEST
        AMDSMI_VIRTUALIZATION_MODE_PASSTHROUGH

    ctypedef enum amdsmi_affinity_scope_t:
        AMDSMI_AFFINITY_SCOPE_NODE
        AMDSMI_AFFINITY_SCOPE_SOCKET

    ctypedef enum amdsmi_npm_status_t:
        AMDSMI_NPM_STATUS_DISABLED
        AMDSMI_NPM_STATUS_ENABLED

    ctypedef struct amdsmi_npm_info_t:
        amdsmi_npm_status_t status
        uint64_t limit
        uint32_t ubb_power_threshold
        uint64_t reserved[5]

    ctypedef enum amdsmi_ptl_data_format_t:
        AMDSMI_PTL_DATA_FORMAT_I8
        AMDSMI_PTL_DATA_FORMAT_F16
        AMDSMI_PTL_DATA_FORMAT_BF16
        AMDSMI_PTL_DATA_FORMAT_F32
        AMDSMI_PTL_DATA_FORMAT_F64
        AMDSMI_PTL_DATA_FORMAT_F8
        AMDSMI_PTL_DATA_FORMAT_VECTOR
        AMDSMI_PTL_DATA_FORMAT_INVALID

    ctypedef struct amdsmi_smu_fw_version_t:
        uint8_t debug
        uint8_t minor
        uint8_t major
        uint8_t unused

    ctypedef struct amdsmi_ddr_bw_metrics_t:
        uint32_t max_bw
        uint32_t utilized_bw
        uint32_t utilized_pct

    ctypedef struct amdsmi_temp_range_refresh_rate_t:
        uint8_t range
        uint8_t ref_rate

    ctypedef struct amdsmi_dimm_power_t:
        uint16_t power
        uint16_t update_rate
        uint8_t dimm_addr

    ctypedef struct amdsmi_dimm_thermal_t:
        uint16_t sensor
        uint16_t update_rate
        uint8_t dimm_addr
        float temp

    ctypedef enum amdsmi_io_bw_encoding_t:
        AMDSMI_AGG_BW0
        AMDSMI_RD_BW0
        AMDSMI_WR_BW0
        AGG_BW0
        RD_BW0
        WR_BW0

    ctypedef struct amdsmi_link_id_bw_type_t:
        amdsmi_io_bw_encoding_t bw_type
        char * link_name

    ctypedef struct amdsmi_dpm_level_t:
        uint8_t max_dpm_level
        uint8_t min_dpm_level

    ctypedef struct amdsmi_hsmp_metrics_table_t:
        uint32_t accumulation_counter
        uint32_t max_socket_temperature
        uint32_t max_vr_temperature
        uint32_t max_hbm_temperature
        uint64_t max_socket_temperature_acc
        uint64_t max_vr_temperature_acc
        uint64_t max_hbm_temperature_acc
        uint32_t socket_power_limit
        uint32_t max_socket_power_limit
        uint32_t socket_power
        uint64_t timestamp
        uint64_t socket_energy_acc
        uint64_t ccd_energy_acc
        uint64_t xcd_energy_acc
        uint64_t aid_energy_acc
        uint64_t hbm_energy_acc
        uint32_t cclk_frequency_limit
        uint32_t gfxclk_frequency_limit
        uint32_t fclk_frequency
        uint32_t uclk_frequency
        uint32_t socclk_frequency[4]
        uint32_t vclk_frequency[4]
        uint32_t dclk_frequency[4]
        uint32_t lclk_frequency[4]
        uint64_t gfxclk_frequency_acc[8]
        uint64_t cclk_frequency_acc[96]
        uint32_t max_cclk_frequency
        uint32_t min_cclk_frequency
        uint32_t max_gfxclk_frequency
        uint32_t min_gfxclk_frequency
        uint32_t fclk_frequency_table[4]
        uint32_t uclk_frequency_table[4]
        uint32_t socclk_frequency_table[4]
        uint32_t vclk_frequency_table[4]
        uint32_t dclk_frequency_table[4]
        uint32_t lclk_frequency_table[4]
        uint32_t max_lclk_dpm_range
        uint32_t min_lclk_dpm_range
        uint32_t xgmi_width
        uint32_t xgmi_bitrate
        uint64_t xgmi_read_bandwidth_acc[8]
        uint64_t xgmi_write_bandwidth_acc[8]
        uint32_t socket_c0_residency
        uint32_t socket_gfx_busy
        uint32_t dram_bandwidth_utilization
        uint64_t socket_c0_residency_acc
        uint64_t socket_gfx_busy_acc
        uint64_t dram_bandwidth_acc
        uint32_t max_dram_bandwidth
        uint64_t dram_bandwidth_utilization_acc
        uint64_t pcie_bandwidth_acc[4]
        uint32_t prochot_residency_acc
        uint32_t ppt_residency_acc
        uint32_t socket_thm_residency_acc
        uint32_t vr_thm_residency_acc
        uint32_t hbm_thm_residency_acc
        uint32_t spare
        uint32_t gfxclk_frequency[8]

    ctypedef struct amdsmi_cpu_info_t:
        char model_name[256]
        uint32_t cpu_family_id
        uint32_t model_id
        uint32_t threads_per_core
        uint32_t cores_per_socket
        _Bool frequency_boost
        uint32_t vendor_id
        char vendor_name[256]
        uint32_t subvendor_id
        uint64_t device_id
        uint32_t rev_id
        char asic_serial[256]
        uint32_t socket_id
        uint32_t core_id
        uint32_t num_of_cpu_cores
        uint32_t socket_count
        uint32_t core_count
        uint32_t reserved[17]

    ctypedef struct amdsmi_sock_info_t:
        uint32_t socket_id
        uint32_t cores_per_socket

    ctypedef struct amdsmi_nic_stat_t:
        char name[256]
        uint64_t value

    ctypedef struct amdsmi_nic_asic_info_t:
        uint16_t vendor_id
        uint16_t subvendor_id
        uint16_t device_id
        uint16_t subsystem_id
        uint8_t revision
        char permanent_address[256]
        char product_name[256]
        char part_number[256]
        char serial_number[256]
        char vendor_name[256]

    ctypedef struct amdsmi_nic_bus_info_t:
        amdsmi_bdf_t bdf
        uint8_t max_pcie_width
        uint32_t max_pcie_speed
        char pcie_interface_version[256]
        char slot_type[256]

    ctypedef struct amdsmi_nic_numa_info_t:
        uint8_t node
        char affinity[256]

    ctypedef struct amdsmi_nic_fw_entry_t:
        char name[256]
        char version[256]

    ctypedef struct amdsmi_nic_fw_info_t:
        uint32_t num_fw
        amdsmi_nic_fw_entry_t fw[16]

    ctypedef struct amdsmi_nic_port_t:
        amdsmi_bdf_t bdf
        uint32_t port_num
        char type[256]
        char flavour[256]
        char netdev[256]
        uint8_t ifindex
        char mac_address[256]
        uint8_t carrier
        uint16_t mtu
        char link_state[256]
        uint32_t link_speed
        uint32_t active_fec
        char autoneg[256]
        char pause_autoneg[256]
        char pause_rx[256]
        char pause_tx[256]

    ctypedef struct amdsmi_nic_port_info_t:
        uint32_t num_ports
        amdsmi_nic_port_t ports[32]

    ctypedef struct amdsmi_nic_driver_info_t:
        char name[256]
        char version[256]

    ctypedef struct amdsmi_nic_rdma_port_info_t:
        char netdev[256]
        char state[256]
        uint8_t rdma_port
        uint16_t max_mtu
        uint16_t active_mtu

    ctypedef struct amdsmi_nic_rdma_dev_info_t:
        char rdma_dev[256]
        char node_guid[256]
        char node_type[256]
        char sys_image_guid[256]
        char fw_ver[256]
        uint8_t num_rdma_ports
        amdsmi_nic_rdma_port_info_t rdma_port_info[32]

    ctypedef struct amdsmi_nic_rdma_devices_info_t:
        uint8_t num_rdma_dev
        amdsmi_nic_rdma_dev_info_t rdma_dev_info[32]

# 
# @brief Initialize the AMD SMI library
# 
# @ingroup tagInitShutdown
# 
# @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
# @platform{guest_mvf} @platform{guest_windows}
# 
# @details This function initializes the library and the internal data structures,
# including those corresponding to sources of information that SMI provides.
# Singleton Design, requires the same number of inits as shutdowns.
# 
# The @p init_flags decides which type of processor
# can be discovered by ::amdsmi_get_socket_handles(). AMDSMI_INIT_AMD_GPUS returns
# sockets with AMD GPUS, and AMDSMI_INIT_AMD_GPUS | AMDSMI_INIT_AMD_CPUS returns
# sockets with either AMD GPUS or CPUS.
# Both AMDSMI_INIT_AMD_GPUS and AMDSMI_INIT_AMD_CPUS flags are supported.
# 
# @param[in] init_flags Bit flags that tell SMI how to initialize. Values of
# ::amdsmi_init_flags_t may be OR'd together and passed through @p init_flags
# to modify how AMDSMI initializes.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_init(uint64_t init_flags) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Shutdown the AMD SMI library
# 
# @ingroup tagInitShutdown
# 
# @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
# @platform{guest_mvf} @platform{guest_windows}
# 
# @details This function shuts down the library and internal data structures and
# performs any necessary clean ups. Singleton Design, requires the same number
# of inits as shutdowns.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_shut_down() except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the list of socket handles in the system.
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
# @platform{guest_mvf} @platform{guest_windows}
# 
# @details Depends on what flag is passed to ::amdsmi_init.  AMDSMI_INIT_AMD_GPUS
# returns sockets with AMD GPUS, and AMDSMI_INIT_AMD_GPUS | AMDSMI_INIT_AMD_CPUS returns
# sockets with either AMD GPUS or CPUS.
# The socket handles can be used to query the processor handles in that socket, which
# will be used in other APIs to get processor detail information or telemtries.
# 
# @param[in,out] socket_count As input, the value passed
# through this parameter is the number of ::amdsmi_socket_handle that
# may be safely written to the memory pointed to by @p socket_handles. This is the
# limit on how many socket handles will be written to @p socket_handles. On return, @p
# socket_count will contain the number of socket handles written to @p socket_handles,
# or the number of socket handles that could have been written if enough memory had been
# provided.
# If @p socket_handles is NULL, as output, @p socket_count will contain
# how many sockets are available to read in the system.
# 
# @param[in,out] socket_handles A pointer to a block of memory to which the
# ::amdsmi_socket_handle values will be written. This value may be NULL.
# In this case, this function can be used to query how many sockets are
# available to read in the system.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_socket_handles(uint32_t * socket_count,void ** socket_handles) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get information about the given socket
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
# @platform{guest_mvf} @platform{guest_windows}
# 
# @details This function retrieves socket information. The @p socket_handle must
# be provided to retrieve the Socket ID.
# 
# @param[in] socket_handle a socket handle
# 
# @param[in] len the length of the caller provided buffer @p name.
# 
# @param[out] name The id of the socket.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_socket_info(void * socket_handle,size_t len,char * name) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get the list of the processor handles associated to a socket.
# 
#  @ingroup tagProcDiscovery
# 
#  @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
#  @platform{guest_mvf} @platform{guest_windows}
# 
#  @details This function retrieves the processor handles of a socket. The
#  @p socket_handle must be provided for the processor. A socket may have multiple different
#  type processors: An APU on a socket have both CPUs and GPUs.
#  Currently, only AMD GPUs are supported.
# 
#  @note Sockets are not supported on the @platform{host}.
# 
#  @note On the @platform{host} this function currently supports only AMD GPUs. To enumerate other
# devices, such as AMD NICs, use amdsmi_get_processor_handles_by_type().
# 
#  The number of processor count is returned through @p processor_count
#  if @p processor_handles is NULL. Then the number of @p processor_count can be pass
#  as input to retrieval all processors on the socket to @p processor_handles.
# 
#  @param[in] socket_handle The socket to query
# 
#  @param[in,out] processor_count As input, the value passed
#  through this parameter is the number of ::amdsmi_processor_handle's that
#  may be safely written to the memory pointed to by @p processor_handles. This is the
#  limit on how many processor handles will be written to @p processor_handles. On return, @p
#  processor_count will contain the number of processor handles written to @p processor_handles,
#  or the number of processor handles that could have been written if enough memory had been
#  provided.
#  If @p processor_handles is NULL, as output, @p processor_count will contain
#  how many processors are available to read for the socket.
# 
#  @param[in,out] processor_handles A pointer to a block of memory to which the
#  ::amdsmi_processor_handle values will be written. This value may be NULL.
#  In this case, this function can be used to query how many processors are
#  available to read.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_processor_handles(void * socket_handle,uint32_t * processor_count,void ** processor_handles) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the node handle associated with processor handle.
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function retrieves the node handle of a processor handler. The
# @p processor_handle must be provided for the processor.
# Currently, only AMD GPUs are supported.
# 
# @param[in] processor_handle A pointer to a ::amdsmi_processor_handle, this
# is required to be OAM ID 0 otherwise the API will fail. OAM ID is sourced
# from amdsmi_get_gpu_asic_info API.
# 
# @param[out] node_handle A pointer to a block of memory where amdsmi_node_handle
# will be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_node_handle(void * processor_handle,void ** node_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the processor type of the processor_handle
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm} @platform{guest_1vf}
# @platform{guest_mvf} @platform{guest_windows}
# 
# @details This function retrieves the processor type. A processor_handle must be provided
# for that processor.
# 
# @param[in] processor_handle a processor handle
# 
# @param[out] processor_type a pointer to ::amdsmi_processor_type_t to which the processor type
# will be written. If this parameter is nullptr, this function will return
# ::AMDSMI_STATUS_INVAL.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_processor_type(void * processor_handle,amdsmi_processor_type_t * processor_type) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get a string identifier for the given processor.
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{cpu_bm}
# 
# @details This function writes the processor's index into @p name as a decimal
# string (for example "0", "1", "2"). The index is the processor's zero-based
# position in the library's processor list, the same order used by
# ::amdsmi_get_processor_handles. A valid @p processor_handle must be provided.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] len The length of the caller-provided buffer @p name.
# 
# @param[out] name Buffer that receives the processor index as a decimal string.
# Must not be NULL.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_processor_info(void * processor_handle,size_t len,char * name) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get respective processor counts from the processor handles
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{cpu_bm}
# 
# @details This function classifies a list of processor handles and returns the per-type
# totals. Counts are derived purely from ::amdsmi_get_processor_type and do not require
# ENABLE_ESMI_LIB; on builds without ESMI, @p nr_cpusockets and @p nr_cpucores will be 0.
# 
# @param[in] processor_handles A pointer to a block of memory to which the
# ::amdsmi_processor_handle values will be written. This value may be NULL.
# 
# @param[in] processor_count total processor count per socket
# 
# @param[out] nr_cpusockets Total number of cpu sockets
# 
# @param[out] nr_cpucores Total number of cpu cores
# 
# @param[out] nr_gpus Total number of gpu devices
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_processor_count_from_handles(void ** processor_handles,uint32_t * processor_count,uint32_t * nr_cpusockets,uint32_t * nr_cpucores,uint32_t * nr_gpus) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns a list of processor handles of the specified type in the system.
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm}
# 
# @details This function retrieves processor list as per the processor type
# from the total processor handles list.
# The @p list of processor_handles and processor type must be provided.
# 
# @note This function fills the user-provided buffer with processor handles of the given type
# (e.g., GPU, NIC). The processor handles returned are used to instantiate the rest of processor
# queries in the library. If the buffer is not large enough, the call will fail.
# 
# @param[in] socket_handle The socket to query.
# 
# @param[in] processor_type The type of processor to query (see ::amdsmi_processor_type_t).
# 
# @param[out] processor_handles Reference to list of processor handles returned by
# the library. Buffer must be allocated by user.
# 
# @param[in,out] processor_count As input, the size of the provided buffer.
# As output, number of processor handles in the buffer.
# Parameter must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_processor_handles_by_type(void * socket_handle,amdsmi_processor_type_t processor_type,void ** processor_handles,uint32_t * processor_count) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get processor handle with the matching bdf.
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
# @platform{guest_mvf} @platform{guest_windows}
# 
# @details Given bdf info @p bdf, this function will get
# the processor handle with the matching bdf.
# 
# @param[in] bdf The bdf to match with corresponding processor handle.
# 
# @param[out] processor_handle processor handle with the matching bdf.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf,void ** processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns BDF of the given GPU device
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# @platform{guest_windows}
# 
# @param[in]      processor_handle Device which to query
# 
# @param[out]     bdf Reference to BDF. Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_device_bdf(void * processor_handle,amdsmi_bdf_t * bdf) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the UUID of the device
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[in,out] uuid_length Length of the uuid string. As input, must be
#                equal or greater than AMDSMI_GPU_UUID_SIZE and be allocated by
#                user. As output it is the length of the uuid string.
# 
# @param[out] uuid Pointer to string to store the UUID. Must be
#             allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_device_uuid(void * processor_handle,unsigned int * uuid_length,char * uuid) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief          Returns the Enumeration information for the device
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf}
# 
# @details        This function returns Enumeration information of the corresponding
#                 processor_handle. It will return the render number, card number,
#                 HSA ID, HIP ID, and the HIP UUID.
# 
# @param[in]      processor_handle Device which to query
# 
# @param[out]     info Reference to Enumeration information structure.
#                 Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_enumeration_info(void * processor_handle,amdsmi_enumeration_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Retrieves an array of uint64_t (sized to cpu_set_size) of bitmasks with the
#  affinity within numa node or socket for the device.
# 
#  @ingroup tagProcDiscovery
# 
#  @platform{gpu_bm_linux} @platform{host}
# 
#  @details Given a processor handle @p processor_handle, the size of the cpu_set array @p
# cpu_set_size, and a pointer to an array of int64_t @p cpu_set, and @p scope, this function will
# write the CPU affinity bitmask to the array pointed to by @p cpu_set.
# 
# User must allocate the enough memory for the cpu_set array. The size of the array is determined
# by the number of CPU cores in the system. As an example, if there are 2 CPUs and each has 112
# cores, the size should be ceiling(2*112/64) = 4, where 64 is the bits of uint64_t. The function
# will write the CPU affinity bitmask to the array. For example, to describe the CPU cores
# 0-55,112-167, it will set the 0-55 and 112-167 bits to 1 and the reset of bits to 0 in the
# cpu_set array.
# 
#  @param[in] processor_handle a processor handle
#  @param[in] cpu_set_size The size of the cpu_set array that is safe to access
#  @param[in,out] cpu_set Array reference in which to return a bitmask of CPU cores that this
# processor affinities with.
#  @param[in] scope Scope for socket or numa affinity.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_affinity_with_scope(void * processor_handle,uint32_t cpu_set_size,uint64_t * cpu_set,amdsmi_affinity_scope_t scope) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the virtualization mode for the target device.
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
# @details The virtualization mode is detected and returned as an enum.
# 
# @param[in] processor_handle The identifier of the given device.
# 
# @param[in,out] mode Reference to the enum representing virtualization mode.
#                 - When zero, the virtualization mode is unknown
#                 - When non-zero, the virtualization mode is detected
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail.
cdef amdsmi_status_t amdsmi_get_gpu_virtualization_mode(void * processor_handle,amdsmi_virtualization_mode_t * mode) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the list of the NIC processor handles associated to a socket.
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function retrieves the processor handles of a socket. The
# @p socket_handle must be provided for the processor.
# 
# @note Sockets are not supported on the @platform{host}.
# 
# The number of processor count is returned through @p processor_count
# if @p processor_handles is NULL. Then the number of @p processor_count can be pass
# as input to retrieval all processors on the socket to @p processor_handles.
# 
# @param[in] socket_handle The socket to query
# 
# @param[in,out] processor_count As input, the value passed
# through this parameter is the number of ::amdsmi_processor_handle's that
# may be safely written to the memory pointed to by @p processor_handles. This is the
# limit on how many processor handles will be written to @p processor_handles. On return, @p
# processor_count will contain the number of processor handles written to @p processor_handles,
# or the number of processor handles that could have been written if enough memory had been
# provided.
# If @p processor_handles is NULL, as output, @p processor_count will contain
# how many processors are available to read for the socket.
# 
# @param[in,out] processor_handles A pointer to a block of memory to which the
# ::amdsmi_processor_handle values will be written. This value may be NULL.
# In this case, this function can be used to query how many processors are
# available to read.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_processor_handles(void * socket_handle,uint32_t * processor_count,void ** processor_handles) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns BDF of the given NIC device
# 
# @ingroup tagProcDiscovery
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] bdf Reference to BDF. Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_device_bdf(void * processor_handle,amdsmi_bdf_t * bdf) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the device id associated with the device with provided device
# handler.
# 
# @ingroup tagIdentQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p id,
# this function will write the device id value to the uint64_t pointed to by
# @p id. This ID is an identification of the type of device, so calling this
# function for different devices will give the same value if they are kind
# of device. Consequently, this function should not be used to distinguish
# one device from another. amdsmi_get_gpu_bdf_id() should be used to get a
# unique identifier.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] id a pointer to uint64_t to which the device id 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_id(void * processor_handle,uint16_t * id) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the device revision associated with the device
# 
# @ingroup tagIdentQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a
# uint16_t @p revision to which the revision id will be written
# 
# @param[in] processor_handle a processor handle
# 
# @param[out] revision a pointer to uint16_t to which the device revision
# will be written
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_revision(void * processor_handle,uint16_t * revision) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the name string for a give vendor ID
# 
# @ingroup tagIdentQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a pointer to a caller provided
# char buffer @p name, and a length of this buffer @p len, this function will
# write the name of the vendor (up to @p len characters) buffer @p name. The
# @p id may be a device vendor or subsystem vendor ID.
# 
# If the integer ID associated with the vendor is not found in one of the
# system files containing device name information (e.g.
# /usr/share/misc/pci.ids), then this function will return the hex vendor ID
# as a string. Updating the system name files can be accompplished with
# "sudo update-pciids".
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] name a pointer to a caller provided char buffer to which the
# name 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.
# 
# @param[in] len the length of the caller provided buffer @p name.
# 
# @note ::AMDSMI_STATUS_INSUFFICIENT_SIZE is returned if @p len bytes is not
# large enough to hold the entire name. In this case, only @p len bytes will
# be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_vendor_name(void * processor_handle,char * name,size_t len) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the vram vendor string of a device.
# 
# @deprecated This API is slated for removal in a future ROCm release;
# ::amdsmi_get_gpu_vram_info() should be used instead
# 
# @ingroup tagIdentQuery
# 
# @platform{gpu_bm_linux}
# 
# @details This function retrieves the vram vendor name given a processor handle
# @p processor_handle, a pointer to a caller provided
# char buffer @p brand, and a length of this buffer @p len, this function
# will write the vram vendor of the device (up to @p len characters) to the
# buffer @p brand.
# 
# If the vram vendor for the device is not found as one of the values
# contained within amdsmi_get_gpu_vram_vendor, then this function will return
# the string 'unknown' instead of the vram vendor.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] brand a pointer to a caller provided char buffer to which the
# vram vendor will be written
# 
# @param[in] len the length of the caller provided buffer @p brand.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_vram_vendor(void * processor_handle,char * brand,uint32_t len) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the subsystem device id associated with the device with
# provided processor handle.
# 
# @ingroup tagIdentQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p id,
# this function will write the subsystem device id value to the uint64_t
# pointed to by @p id.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] id a pointer to uint64_t to which the subsystem device id
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_subsystem_id(void * processor_handle,uint16_t * id) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the name string for the device subsystem
# 
# @ingroup tagIdentQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a pointer to a caller provided
# char buffer @p name, and a length of this buffer @p len, this function
# will write the name of the device subsystem (up to @p len characters)
# to the buffer @p name.
# 
# If the integer ID associated with the sub-system is not found in one of the
# system files containing device name information (e.g.
# /usr/share/misc/pci.ids), then this function will return the hex sub-system
# ID as a string. Updating the system name files can be accompplished with
# "sudo update-pciids".
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] name a pointer to a caller provided char buffer to which the
# name 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.
# 
# @param[in] len the length of the caller provided buffer @p name.
# 
# @note ::AMDSMI_STATUS_INSUFFICIENT_SIZE is returned if @p len bytes is not
# large enough to hold the entire name. In this case, only @p len bytes will
# be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_subsystem_name(void * processor_handle,char * name,size_t len) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the list of possible PCIe bandwidths that are available. It is not
# supported on virtual machine guest
# 
# @ingroup tagPCIeQuery
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details Given a processor handle @p processor_handle and a pointer to a to an
# ::amdsmi_pcie_bandwidth_t structure @p bandwidth, this function will fill in
# @p bandwidth with the possible T/s values and associated number of lanes,
# and indication of the current selection.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] bandwidth a pointer to a caller provided
# ::amdsmi_pcie_bandwidth_t structure to which the frequency information will be
# written
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_pci_bandwidth(void * processor_handle,amdsmi_pcie_bandwidth_t * bandwidth) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the unique PCI device identifier associated for a device
# 
# @ingroup tagPCIeQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint64_t @p
# bdfid, this function will write the Bus/Device/Function PCI identifier
# (BDFID) associated with device @p processor_handle to the value pointed to by
# @p bdfid.
# 
# The format of @p bdfid will be as follows:
# 
#     BDFID = ((DOMAIN & 0xFFFFFFFF) << 32) | ((Partition & 0xF) << 28)
#             | ((BUS & 0xFF) << 8) | ((DEVICE & 0x1F) <<3 )
#             | (FUNCTION & 0x7)
# 
# | Name         | Field   | KFD property     | KFD -> PCIe ID (uint64_t)    |
# -------------- | ------- | ---------------- | ---------------------------- |
# | Domain       | [63:32] | "domain"         | (DOMAIN & 0xFFFFFFFF) << 32  |
# | Partition id | [31:28] | "location id"    | (LOCATION & 0xF0000000)      |
# | Reserved     | [27:16] | "location id"    | N/A                          |
# | Bus          | [15: 8] | "location id"    | (LOCATION & 0xFF00)          |
# | Device       | [ 7: 3] | "location id"    | (LOCATION & 0xF8)            |
# | Function     | [ 2: 0] | "location id"    | (LOCATION & 0x7)             |
# 
# Note: In some devices, the partition ID may be stored in the function bits
# BDFID[2:0] instead of BDFID[31:28].
# 
# Note: For MI series devices, the function bits are only used to store the
# partition ID, but this modified BDF is internal to the ROCm stack.
# To the OS, partitions share the same BDF as the unpartitioned device and
# have function bits = 0, which can be verified through lspci.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] bdfid a pointer to uint64_t to which the device bdfid value
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_bdf_id(void * processor_handle,uint64_t * bdfid) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the NUMA node associated with a device
# 
# @ingroup tagPCIeQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a int32_t @p
# numa_node, this function will retrieve the NUMA node value associated
# with device @p processor_handle and store the value at location pointed to by
# @p numa_node.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] numa_node pointer to location where NUMA node value 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_topo_numa_affinity(void * processor_handle,int32_t * numa_node) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get PCIe traffic information. It is not supported on virtual machine guest
# 
# @ingroup tagPCIeQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Give a processor handle @p processor_handle and pointers to a uint64_t's, @p
# sent, @p received and @p max_pkt_sz, this function will write the number
# of bytes sent and received in 1 second to @p sent and @p received,
# respectively. The maximum possible packet size will be written to
# @p max_pkt_sz.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] sent a pointer to uint64_t to which the number of bytes sent
# will be written in 1 second. If pointer is NULL, it will be ignored.
# 
# @param[in,out] received a pointer to uint64_t to which the number of bytes
# received will be written. If pointer is NULL, it will be ignored.
# 
# @param[in,out] max_pkt_sz a pointer to uint64_t to which the maximum packet
# size will be written. If pointer is NULL, it will be ignored.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_pci_throughput(void * processor_handle,uint64_t * sent,uint64_t * received,uint64_t * max_pkt_sz) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get PCIe replay counter
# 
# @ingroup tagPCIeQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint64_t @p
# counter, this function will write the sum of the number of NAK's received
# by the GPU and the NAK's generated by the GPU to memory pointed to by @p
# counter.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] counter a pointer to uint64_t to which the sum of the NAK's
# received and generated by the GPU is 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_pci_replay_counter(void * processor_handle,uint64_t * counter) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Control the set of allowed PCIe bandwidths that can be used. It is not
# supported on virtual machine guest
# 
# @ingroup tagPCIeControl
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a 64 bit bitmask @p bw_bitmask,
# this function will limit the set of allowable bandwidths. If a bit in @p
# bw_bitmask has a value of 1, then the frequency (as ordered in an
# ::amdsmi_frequencies_t returned by :: amdsmi_get_clk_freq()) corresponding
# to that bit index will be allowed.
# 
# This function will change the performance level to
# ::AMDSMI_DEV_PERF_LEVEL_MANUAL in order to modify the set of allowable
# band_widths. Caller will need to set to ::AMDSMI_DEV_PERF_LEVEL_AUTO in order
# to get back to default state.
# 
# All bits with indices greater than or equal to the value of the
# ::amdsmi_frequencies_t::num_supported field of ::amdsmi_pcie_bandwidth_t will be
# ignored.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] bw_bitmask A bitmask indicating the indices of the
# bandwidths that are to be enabled (1) and disabled (0). Only the lowest
# ::amdsmi_frequencies_t::num_supported (of ::amdsmi_pcie_bandwidth_t) bits of
# this mask are relevant.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_pci_bandwidth(void * processor_handle,uint64_t bw_bitmask) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the energy accumulator counter of the processor with provided
# processor handle. It is not supported on virtual machine guest
# 
# @ingroup tagPowerQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a pointer to a uint64_t
# @p energy_accumulator, and a pointer to a uint64_t @p timestamp, this function
# will write amount of energy consumed to the uint64_t pointed to by
# @p energy_accumulator, and the timestamp to the uint64_t pointed to by @p timestamp.
# This function accumulates all energy consumed.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] energy_accumulator a pointer to uint64_t to which the energy
# counter will be written
# If this parameter is nullptr, this function will return
# ::AMDSMI_STATUS_INVAL if the function is supported with the provided,
# and ::AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the
# provided arguments.
# 
# @param[in,out] counter_resolution resolution of the counter @p energy_accumulator in
# micro Joules
# 
# @param[in,out] timestamp a pointer to uint64_t to which the timestamp
# will be written. Resolution: 1 ns.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_energy_count(void * processor_handle,uint64_t * energy_accumulator,float * counter_resolution,uint64_t * timestamp) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the maximum gpu power cap value. It is not supported on virtual
# machine guest
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{host} @platform{gpu_bm_linux} @platform{guest_1vf}
# 
# @details Set the power cap to the provided value @p cap.
# @p cap must be between the minimum and maximum power cap values set by the
# system, which can be obtained from ::amdsmi_dev_power_cap_range_get.
# 
# @param[in] processor_handle A processor handle
# 
# @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
# If a processor has more than one sensor, it could be greater than 0.
# 
# @param[in] cap a uint64_t that indicates the desired power cap.
# The @p cap value must be greater than 0.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_power_cap(void * processor_handle,uint32_t sensor_ind,uint64_t cap) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the power performance profile. It is not supported on virtual machine guest
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{gpu_bm_linux}
# 
# @details This function will attempt to set the current profile to the provided
# profile, given a processor handle @p processor_handle and a @p profile. The provided
# profile must be one of the currently supported profiles, as indicated by a
# call to :: amdsmi_get_gpu_power_profile_presets()
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] reserved Not currently used. Set to 0.
# 
# @param[in] profile a ::amdsmi_power_profile_preset_masks_t that hold the mask
# of the desired new power profile
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_power_profile(void * processor_handle,uint32_t reserved,amdsmi_power_profile_preset_masks_t profile) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Query the supported power cap sensors and their types for a device.
# 
#  @ingroup tagEsmiPowerControl
# 
#  @platform{gpu_bm_linux} @platform{host}
# 
#  @details This function returns the list of supported power cap sensors for the given device,
#  including their sensor indices and types (e.g., PPT0, PPT1).
# 
#  @param[in]  processor_handle A processor handle.
#  @param[out] sensor_count Pointer to a uint32_t that will be set to the number of supported
# sensors.
#  @param[out] sensor_inds  Pointer to an array of uint32_t to be filled with sensor indices.
#                           The array must be allocated by the caller with enough space.
#  @param[out] sensor_types Pointer to an array of amdsmi_power_cap_type_t to be filled with sensor
# types. The array must be allocated by the caller with enough space.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail.
cdef amdsmi_status_t amdsmi_get_supported_power_cap(void * processor_handle,uint32_t * sensor_count,uint32_t * sensor_inds,amdsmi_power_cap_type_t * sensor_types) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the socket power.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]   processor_handle Cpu socket which to query
# 
# @param[out]  ppower - Input buffer to return socket power in milliwatts (mW)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_power(void * processor_handle,uint32_t * ppower) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the socket power cap.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]   processor_handle Cpu socket which to query
# 
# @param[out]  pcap - Input buffer to return power cap in milliwatts (mW)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_power_cap(void * processor_handle,uint32_t * pcap) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the maximum power cap value for a given socket.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]   processor_handle Cpu socket which to query
# 
# @param[out]  pmax - Input buffer to return maximum power limit value in milliwatts (mW)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_power_cap_max(void * processor_handle,uint32_t * pmax) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the SVI based power telemetry for all rails.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]    power - Input buffer to return svi based power value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_pwr_svi_telemetry_all_rails(void * processor_handle,uint32_t * power) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the power cap value for a given socket.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to query
# 
# @param[in]  pcap - Input power limit value in milliwatts (mW)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_socket_power_cap(void * processor_handle,uint32_t pcap) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the power efficiency profile policy.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to configure
# 
# @param[in]  power_efficiency_mode - power efficiency mode to be set
# 
# @param[in,out]  utilization - pointer to store utilization for balanced core modes (%)
# 
# @param[in,out]  ppt_limit - pointer to PPT (Package Power Tracking) limit value
#                             in milliwatts (mW)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_pwr_efficiency_mode(void * processor_handle,uint8_t power_efficiency_mode,uint32_t * utilization,uint32_t * ppt_limit) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the power efficiency profile policy
# 
# @details This function retrieves the current power efficiency mode, utility value,
#          and PPT (Package Power Tracking) limit for a given processor socket.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to query
# 
# @param[out]  power_efficiency_mode - pointer to store current power efficiency mode
# 
# @param[out]  utilization - pointer to store utilization for balanced core modes (%)
# 
# @param[out]  ppt_limit - pointer to store PPT (Package Power Tracking) limit value
#                          in milliwatts (mW)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_pwr_efficiency_mode(void * processor_handle,uint32_t * power_efficiency_mode,uint32_t * utilization,uint32_t * ppt_limit) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Read CCD (Core Complex Die) power consumption
# 
# @details This function reads the power consumption of a specific CCD within a CPU socket.
# 
# @ingroup tagEsmiPowerControl
# 
# @platform{cpu_bm}
# 
# @param[in]   processor_handle Cpu core which to query
# @param[out]  power - Input buffer to store power consumption in milliwatts (mW)
# 
#  @return ::amdsmi_status_t
#          ::AMDSMI_STATUS_SUCCESS on successful register read, non-zero on failure
cdef amdsmi_status_t amdsmi_get_cpu_core_ccd_power(void * processor_handle,uint32_t * power) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the total amount of memory that exists
# 
# @ingroup tagMemoryQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a type of memory @p mem_type, and
# a pointer to a uint64_t @p total, this function will write the total amount
# of @p mem_type memory that exists to the location pointed to by @p total.
# 
# @note Sum of the process memory is not expected to be the total memory usage.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] mem_type The type of memory for which the total amount will be
# found
# 
# @param[in,out] total a 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_memory_total(void * processor_handle,amdsmi_memory_type_t mem_type,uint64_t * total) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the current memory usage
# 
# @ingroup tagMemoryQuery
# 
# @platform{gpu_bm_linux}
# 
# @details This function will write the amount of @p mem_type memory that
# that is currently being used to the location pointed to by @p used.
# 
# @note Sum of the process memory is not expected to be the total memory usage.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] mem_type The type of memory for which the amount being used will
# be found
# 
# @param[in,out] used a 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_memory_usage(void * processor_handle,amdsmi_memory_type_t mem_type,uint64_t * used) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the bad pages of a processor. It is not supported on virtual
# machine guest
# 
# @ingroup tagMemoryQuery
# 
# @platform{gpu_bm_linux}
# 
# @details This call will query the device @p processor_handle for the
# number of bad pages (written to @p num_pages address). The results are
# written to address held by the @p info pointer.
# 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.
# 
# @param[in] processor_handle a processor handle
# 
# @param[out] num_pages Number of bad page records.
# 
# @param[out] info The results will be written to the
# amdsmi_retired_page_record_t pointer.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_bad_page_info(void * processor_handle,uint32_t * num_pages,amdsmi_retired_page_record_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the bad pages threshold of a processor. It is not supported on virtual
# machine guest
# 
# @ingroup tagMemoryQuery
# 
# @platform{gpu_bm_linux}
# 
# @details This call will query the device @p processor_handle for the
# threshold of bad pages (written to @p threshold address).
# 
# @param[in] processor_handle a processor handle
# @param[out] threshold of bad page count.
# 
# @note This function requires admin/sudo privileges
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_bad_page_threshold(void * processor_handle,uint32_t * threshold) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Verify the checksum of RAS EEPROM. It is not supported on virtual
# machine guest
# 
# @ingroup tagMemoryQuery
# 
# @platform{gpu_bm_linux}
# 
# @details This call will verify the device @p processor_handle for the
# checksum of RAS EEPROM.
# 
# @param[in] processor_handle a processor handle
# 
# @note This function requires admin/sudo privileges
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success
#         AMDSMI_STATUS_CORRUPTED_EEPROM on the device's EEPROM corruption
#         others on fail
cdef amdsmi_status_t amdsmi_gpu_validate_ras_eeprom(void * processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns if RAS features are enabled or disabled for given block. It is not
# supported on virtual machine guest
# 
# @ingroup tagMemoryQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, this function queries the
# state of RAS features for a specific block @p block. Result will be written
# to address held by pointer @p state.
# 
# @param[in] processor_handle Device handle which to query
# 
# @param[in] block Block which to query
# 
# @param[in,out] state A 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_ras_block_features_enabled(void * processor_handle,amdsmi_gpu_block_t block,amdsmi_ras_err_state_t * state) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get information about reserved ("retired") memory pages. It is not supported on
# virtual machine guest
# 
# @ingroup tagMemoryQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, this function returns retired page
# information @p records corresponding to the device with the provided processor
# handle @p processor_handle. The number of retired page records is returned through @p
# num_pages. @p records may be NULL on input. In this case, the number of
# records available for retrieval will be returned through @p num_pages.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] num_pages a 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 @p records. This is the
# limit on how many records will be written to @p records. On return, @p
# num_pages will contain the number of records written to @p 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.
# 
# @param[in,out] records A 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_memory_reserved_pages(void * processor_handle,uint32_t * num_pages,amdsmi_retired_page_record_t * records) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the fan speed in RPMs of the device with the specified processor
# handle and 0-based sensor index. It is not supported on virtual machine guest
# 
# @ingroup tagPhysicalStateQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint32_t
# @p speed, this function will write the current fan speed in RPMs to the
# uint32_t pointed to by @p speed
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
# If a device has more than one sensor, it could be greater than 0.
# 
# @param[in,out] speed a pointer to uint32_t to which the speed 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_fan_rpms(void * processor_handle,uint32_t sensor_ind,int64_t * speed) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the fan speed for the specified device as a value relative to
# the maximum fan speed. It is not supported on virtual machine guest
# 
# @ingroup tagPhysicalStateQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint32_t
# @p speed, this function will write the current fan speed (a value
# between 0 and the maximum fan speed) to the uint32_t pointed to by @p speed.
# For legacy hwmon GPUs the maximum is ::AMDSMI_MAX_FAN_SPEED (255).
# For GPUs with the gpu_od sysfs interface, use amdsmi_get_gpu_fan_speed_max()
# to query the actual maximum
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
# If a device has more than one sensor, it could be greater than 0.
# 
# @param[in,out] speed a pointer to uint32_t to which the speed 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_fan_speed(void * processor_handle,uint32_t sensor_ind,int64_t * speed) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the max. fan speed of the device with provided processor handle. It is
# not supported on virtual machine guest
# 
# @ingroup tagPhysicalStateQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint32_t
# @p max_speed, this function will write the maximum fan speed possible to
# the uint32_t pointed to by @p max_speed.
# For legacy hwmon GPUs this is ::AMDSMI_MAX_FAN_SPEED (255).
# For GPUs with the gpu_od sysfs interface, the maximum is read from the
# OD_RANGE section of the fan_minimum_pwm sysfs file (e.g. 100)
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
# If a device has more than one sensor, it could be greater than 0.
# 
# @param[in,out] max_speed a pointer to uint32_t to which the maximum speed
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_fan_speed_max(void * processor_handle,uint32_t sensor_ind,uint64_t * max_speed) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns gpu cache info.
# 
# @ingroup tagPhysicalStateQuery
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @param[in] processor_handle PF of a processor for which to query
# 
# @param[out] info reference to the cache info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_cache_info(void * processor_handle,amdsmi_gpu_cache_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the voltage metric value for the specified metric, from the
# specified voltage sensor on the specified device. It is not supported on
# virtual machine guest
# 
# @ingroup tagPhysicalStateQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a sensor type @p sensor_type, a
# ::amdsmi_voltage_metric_t @p metric and a pointer to an int64_t @p
# voltage, this function will write the value of the metric indicated by
# @p metric and @p sensor_type to the memory location @p voltage.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_type part of device from which voltage should be
# obtained. This should come from the enum ::amdsmi_voltage_type_t
# 
# @param[in] metric enum indicated which voltage value should be
# retrieved
# 
# @param[in,out] voltage a pointer to int64_t to which the voltage
# will be written, in millivolts.
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_volt_metric(void * processor_handle,amdsmi_voltage_type_t sensor_type,amdsmi_voltage_metric_t metric,int64_t * voltage) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Reset the fan to automatic driver control. It is not supported on virtual
# machine guest
# 
# @ingroup tagPhysicalStateControl
# 
# @platform{gpu_bm_linux}
# 
# @details This function returns control of the fan to the system.
# For GPUs with the gpu_od sysfs interface, this writes the OD_RANGE minimum
# value to fan_minimum_pwm and commits the change
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
# If a device has more than one sensor, it could be greater than 0.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_reset_gpu_fan(void * processor_handle,uint32_t sensor_ind) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the fan speed for the specified device with the provided speed,
# in RPMs. It is not supported on virtual machine guest
# 
# @ingroup tagPhysicalStateControl
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a integer value indicating
# speed @p speed, this function will attempt to set the fan speed to @p speed.
# An error will be returned if the specified speed is outside the allowable
# range for the device. For legacy hwmon GPUs the range is 0-255.
# For GPUs with the gpu_od sysfs interface, the valid range is determined
# dynamically from the OD_RANGE (e.g. 20-100).
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
# If a device has more than one sensor, it could be greater than 0.
# 
# @param[in] speed the speed to which the function will attempt to set the fan
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_fan_speed(void * processor_handle,uint32_t sensor_ind,uint64_t speed) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get GPU busy percent from gpu_busy_percent sysfs file
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, this function returns GPU busy
# percentage.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] gpu_busy_percent Direct output from the gpu_busy_percent sysfs file
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_busy_percent(void * processor_handle,uint32_t * gpu_busy_percent) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get VCN busy percent from vcn_busy_percent sysfs file
# 
#  @ingroup tagClkPowerPerfQuery
# 
#  @platform{gpu_bm_linux}
# 
#  @details Given a processor handle @p processor_handle, this function returns VCN busy
#  percentage.
# 
#  @param[in] processor_handle a processor handle
# 
#  @param[out] vcn_busy_percent vcn busy percentage (0-100)
# 
#  @retval ::AMDSMI_STATUS_SUCCESS on success
#  @retval ::AMDSMI_STATUS_NOT_SUPPORTED if the device does not support this query
#  @retval ::AMDSMI_STATUS_INVAL if the input parameters are invalid
#  @retval ::AMDSMI_STATUS_UNEXPECTED_DATA if data read from the sysfs file is not in the expected
# format or empty
#  @return ::amdsmi_status_t
cdef amdsmi_status_t amdsmi_get_vcn_busy_percent(void * processor_handle,uint32_t * vcn_busy_percent) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get coarse grain utilization counter of the specified device
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, the array of the utilization counters,
# the size of the array, this function returns the coarse grain utilization counters
# and timestamp.
# The counter is the accumulated percentages. Every milliseconds the firmware calculates
# % busy count and then accumulates that value in the counter. This provides minimally
# invasive coarse grain GPU usage information.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] utilization_counters Multiple utilization counters can be retrieved with a single
# call. The caller must allocate enough space to the utilization_counters array. The caller also
# needs to set valid AMDSMI_UTILIZATION_COUNTER_TYPE type for each element of the array.
# ::AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the provided arguments.
# 
# If the function returns AMDSMI_STATUS_SUCCESS, the counter will be set in the value field of
# the amdsmi_utilization_counter_t.
# 
# @param[in] count The size of @p utilization_counters array.
# 
# @param[in,out] timestamp The timestamp when the counter is retrieved. Resolution: 1 ns.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_utilization_count(void * processor_handle,amdsmi_utilization_counter_t * utilization_counters,uint32_t count,uint64_t * timestamp) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the performance level of the device. It is not supported on virtual
# machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details This function will write the ::amdsmi_dev_perf_level_t to the uint32_t
# pointed to by @p perf, for a given processor handle @p processor_handle and a pointer
# to a uint32_t @p perf.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] perf a pointer to ::amdsmi_dev_perf_level_t to which the
# performance level 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_perf_level(void * processor_handle,amdsmi_dev_perf_level_t * perf) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Enter performance determinism mode with provided processor handle. It is
# not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and @p clkvalue this function
# will enable performance determinism mode, which enforces a GFXCLK frequency
# SoftMax limit per GPU set by the user. This prevents the GFXCLK PLL from
# stretching when running the same workload on different GPUS, making
# performance variation minimal. This call will result in the performance
# level ::amdsmi_dev_perf_level_t of the device being
# ::AMDSMI_DEV_PERF_LEVEL_DETERMINISM.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] clkvalue Softmax value for GFXCLK in MHz.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_perf_determinism_mode(void * processor_handle,uint64_t clkvalue) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the overdrive percent associated with the device with provided
# processor handle. It is not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p od,
# this function will write the overdrive percentage to the uint32_t pointed
# to by @p od
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] od a pointer to uint32_t to which the overdrive percentage
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_overdrive_level(void * processor_handle,uint32_t * od) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the GPU memory clock overdrive percent associated with the device with provided
# processor handle. It is not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p od,
# this function will write the overdrive percentage to the uint32_t pointed
# to by @p od
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] od a pointer to uint32_t to which the GPU memory clock overdrive percentage
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_mem_overdrive_level(void * processor_handle,uint32_t * od) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the list of possible system clock speeds of device for a
# specified clock type. It is not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a clock type @p clk_type, and a
# pointer to a to an ::amdsmi_frequencies_t structure @p f, this function will
# fill in @p f with the possible clock speeds, and indication of the current
# clock speed selection.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] clk_type the type of clock for which the frequency is desired
# 
# @param[in,out] f a pointer to a caller provided ::amdsmi_frequencies_t structure
# to which the frequency information will be written. Frequency values are in
# Hz.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_clk_freq(void * processor_handle,amdsmi_clk_type_t clk_type,amdsmi_frequencies_t * f) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Triggers a chain that resets all GPUs.
# It is not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @note After this function returns, the caller must wait a few seconds before calling
# any other AMD SMI API functions to allow the GPU reset to complete. Calling other APIs
# too soon may result in AMDSMI_STATUS_BUSY or undefined behavior.
# 
# @details Given a processor handle @p processor_handle, this function will reset the GPU
# 
# @param[in] processor_handle a processor handle
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_reset_gpu(void * processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief This function retrieves the overdrive GFX & MCLK information. If valid
# for the GPU it will also populate the voltage curve data. It is not supported
# on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a
# ::amdsmi_od_volt_freq_data_t structure @p odv, this function will populate @p
# odv. See ::amdsmi_od_volt_freq_data_t for more details.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] odv a pointer to an ::amdsmi_od_volt_freq_data_t structure
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_od_volt_info(void * processor_handle,amdsmi_od_volt_freq_data_t * odv) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get the 'metrics_header_info' from the GPU metrics associated with the device
# 
#  @ingroup tagClkPowerPerfQuery
# 
#  @platform{gpu_bm_linux}
# 
#  @details Given a processor handle @p processor_handle and a pointer to a
# amd_metrics_table_header_t in which the 'metrics_header_info' will stored
# 
#  @param[in] processor_handle Device which to query
# 
#  @param[inout] header_value a pointer to amd_metrics_table_header_t to which the device gpu
#  metric unit will be stored
# 
#  @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call.
#          ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit
#            does not exist for the given device
#  @return ::amdsmi_status_t
cdef amdsmi_status_t amdsmi_get_gpu_metrics_header_info(void * processor_handle,amd_metrics_table_header_t * header_value) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief This function retrieves the gpu metrics information. It is not supported
# on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a
# ::amdsmi_gpu_metrics_t structure @p pgpu_metrics, this function will populate
# @p pgpu_metrics. See ::amdsmi_gpu_metrics_t for more details.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] pgpu_metrics a pointer to an ::amdsmi_gpu_metrics_t structure
# 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.
# 
# **APU Metrics:**
# When APU-specific metrics are available (APU metrics table v2.4 or v3.0),
# @p pgpu_metrics->apu_metrics will point to thread-local library-owned storage.
# This pointer is invalidated by ANY subsequent call to
# ::amdsmi_get_gpu_metrics_info or ::amdsmi_get_gpu_partition_metrics_info on
# the same thread, even for different devices. Callers must copy the entire
# ::amdsmi_apu_metrics_t structure immediately after the call to preserve the data.
# For non-APU devices, @p pgpu_metrics->apu_metrics will be nullptr.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_metrics_info(void * processor_handle,amdsmi_gpu_metrics_t * pgpu_metrics) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief This function retrieves the partition metrics information.
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux} @platform{guest_1vf}
# 
# @details Given a processor handle @p processor_handle and a pointer to a
# ::amdsmi_gpu_metrics_t structure @p pgpu_metrics, this function will populate
# @p pgpu_metrics. See ::amdsmi_gpu_metrics_t for more details.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] pgpu_metrics a pointer to an ::amdsmi_gpu_metrics_t structure
# 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.
# 
# **APU Metrics:**
# When APU-specific metrics are available (APU metrics table v2.4 or v3.0),
# @p pgpu_metrics->apu_metrics will point to thread-local library-owned storage.
# This pointer is invalidated by ANY subsequent call to
# ::amdsmi_get_gpu_metrics_info or ::amdsmi_get_gpu_partition_metrics_info on
# the same thread, even for different devices. Callers must copy the entire
# ::amdsmi_apu_metrics_t structure immediately after the call to preserve the data.
# For non-APU devices, @p pgpu_metrics->apu_metrics will be nullptr.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_partition_metrics_info(void * processor_handle,amdsmi_gpu_metrics_t * pgpu_metrics) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the pm metrics table with provided device index.
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a device handle @p processor_handle, @p pm_metrics pointer,
# and @p num_of_metrics pointer,
# this function will write the pm metrics name value pair
# to the array at @p pm_metrics and the number of metrics retrieved to @p num_of_metrics
# Note: the library allocated memory for pm_metrics, and user must call
# free(pm_metrics) to free it after use.
# 
# @param[in] processor_handle a processor handle
# 
# @param[inout] pm_metrics A pointerto an array to hold multiple PM metrics. On success,
# the library will allocate memory of pm_metrics and write metrics to this array.
# The caller must free this memory after usage to avoid memory leak.
# 
# @param[inout] num_of_metrics a pointer to uint32_t to which the number of
# metrics is allocated for pm_metrics array as input, and the number of metrics retrieved
# as output. If this parameter is NULL, 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.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function with the given arguments
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @return ::amdsmi_status_t
#
cdef amdsmi_status_t amdsmi_get_gpu_pm_metrics_info(void * processor_handle,amdsmi_name_value_t ** pm_metrics,uint32_t * num_of_metrics) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the register metrics table with provided device index and register type.
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a device handle @p processor_handle, @p reg_type, @p reg_metrics pointer,
# and @p num_of_metrics pointer,
# this function will write the register metrics name value pair
# to the array at @p reg_metrics and the number of metrics retrieved to @p num_of_metrics
# Note: the library allocated memory for reg_metrics, and user must call
# free(reg_metrics) to free it after use.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] reg_type The register type
# 
# @param[inout] reg_metrics A pointerto an array to hold multiple register metrics. On success,
# the library will allocate memory of reg_metrics and write metrics to this array.
# The caller must free this memory after usage to avoid memory leak.
# 
# @param[inout] num_of_metrics a pointer to uint32_t to which the number of
# metrics is allocated for reg_metrics array as input, and the number of metrics retrieved
# as output. If this parameter is NULL, 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.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function with the given arguments
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @return ::amdsmi_status_t
#
cdef amdsmi_status_t amdsmi_get_gpu_reg_table_info(void * processor_handle,amdsmi_reg_type_t reg_type,amdsmi_name_value_t ** reg_metrics,uint32_t * num_of_metrics) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief This function sets the clock sets the clock min/max level
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a clock type @p clk_type,
# a value @p clk_value needs to be set, and the @p level indicates min or max
# clock you want to set, this function the clock limit.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] clk_type AMDSMI_CLK_TYPE_SYS, AMDSMI_CLK_TYPE_MEM and so on
# 
# @param[in] limit_type AMDSMI_FREQ_IND_MIN|AMDSMI_FREQ_IND_MAX to set the
# minimum (0) or maximum (1) speed.
# 
# @param[in] clk_value value to apply to. Frequency values are in MHz.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_clk_limit(void * processor_handle,amdsmi_clk_type_t clk_type,amdsmi_clk_limit_type_t limit_type,uint64_t clk_value) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief This function sets the clock frequency information. It is not supported on
# virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a frequency level @p level,
# a clock value @p clkvalue and a clock type @p clkType this function
# will set the sclk|mclk range
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] level AMDSMI_FREQ_IND_MIN|AMDSMI_FREQ_IND_MAX to set the
# minimum (0) or maximum (1) speed.
# 
# @param[in] clkvalue value to apply to the clock range. Frequency values
# are in MHz.
# 
# @param[in] clkType AMDSMI_CLK_TYPE_SYS | AMDSMI_CLK_TYPE_MEM range type
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_od_clk_info(void * processor_handle,amdsmi_freq_ind_t level,uint64_t clkvalue,amdsmi_clk_type_t clkType) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief This function sets  1 of the 3 voltage curve points. It is not supported
# on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a voltage point @p vpoint
# and a voltage value @p voltvalue this function will set voltage curve point
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] vpoint voltage point [0|1|2] on the voltage curve
# 
# @param[in] clkvalue clock value component of voltage curve point.
# Frequency values are in MHz.
# 
# @param[in] voltvalue voltage value component of voltage curve point.
# Voltage is in mV.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_od_volt_info(void * processor_handle,uint32_t vpoint,uint64_t clkvalue,uint64_t voltvalue) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief This function will retrieve the current valid regions in the
# frequency/voltage space. It is not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a pointer to an unsigned integer
# @p num_regions and a buffer of ::amdsmi_freq_volt_region_t structures, @p
# buffer, this function will populate @p buffer with the current
# frequency-volt space regions. The caller should assign @p buffer to memory
# that can be written to by this function. The caller should also
# indicate the number of ::amdsmi_freq_volt_region_t structures that can safely
# be written to @p buffer in @p num_regions.
# 
# The number of regions to expect this function provide (@p num_regions) can
# be obtained by calling :: amdsmi_get_gpu_od_volt_info().
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] num_regions As input, this is the number of
# ::amdsmi_freq_volt_region_t structures that can be written to @p buffer. As
# output, this is the number of ::amdsmi_freq_volt_region_t structures that were
# actually 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.
# 
# @param[in,out] buffer a caller provided buffer to which
# ::amdsmi_freq_volt_region_t structures 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_od_volt_curve_regions(void * processor_handle,uint32_t * num_regions,amdsmi_freq_volt_region_t * buffer) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the list of available preset power profiles and an indication of
# which profile is currently active. It is not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer to a
# ::amdsmi_power_profile_status_t @p status, this function will set the bits of
# the ::amdsmi_power_profile_status_t.available_profiles bit field of @p status to
# 1 if the profile corresponding to the respective
# ::amdsmi_power_profile_preset_masks_t profiles are enabled. For example, if both
# the VIDEO and VR power profiles are available selections, then
# ::AMDSMI_PWR_PROF_PRST_VIDEO_MASK AND'ed with
# ::amdsmi_power_profile_status_t.available_profiles will be non-zero as will
# ::AMDSMI_PWR_PROF_PRST_VR_MASK AND'ed with
# ::amdsmi_power_profile_status_t.available_profiles. Additionally,
# ::amdsmi_power_profile_status_t.current will be set to the
# ::amdsmi_power_profile_preset_masks_t of the profile that is currently active.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_ind a 0-based sensor index. Normally, this will be 0.
# If a device has more than one sensor, it could be greater than 0.
# 
# @param[in,out] status a pointer to ::amdsmi_power_profile_status_t that will be
# populated by a call to this function
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_power_profile_presets(void * processor_handle,uint32_t sensor_ind,amdsmi_power_profile_status_t * status) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the PowerPlay performance level associated with the device with
# provided processor handle with the provided value. It is not supported
# on virtual machine guest
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and an ::amdsmi_dev_perf_level_t @p
# perf_level, this function will set the PowerPlay performance level for the
# device to the value @p perf_lvl.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] perf_lvl the value to which the performance level should be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_perf_level(void * processor_handle,amdsmi_dev_perf_level_t perf_lvl) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the overdrive percent associated with the device with provided
# processor handle with the provided value. See details for WARNING. It is
# not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and an overdrive level @p od,
# this function will set the overdrive level for the device to the value
# @p od. The overdrive level is an integer value between 0 and 20, inclusive,
# which represents the overdrive percentage; e.g., a value of 5 specifies
# an overclocking of 5%.
# 
# The overdrive level is specific to the gpu system clock.
# 
# The overdrive level is the percentage above the maximum Performance Level
# to which overclocking will be limited. The overclocking percentage does
# not apply to clock speeds other than the maximum. This percentage is
# limited to 20%.
# 
#  ******WARNING******
# Operating your AMD GPU outside of official AMD specifications or outside of
# factory settings, including but not limited to the conducting of
# overclocking (including use of this overclocking software, even if such
# software has been directly or indirectly provided by AMD or otherwise
# affiliated in any way with AMD), may cause damage to your AMD GPU, system
# components and/or result in system failure, as well as cause other problems.
# DAMAGES CAUSED BY USE OF YOUR AMD GPU OUTSIDE OF OFFICIAL AMD SPECIFICATIONS
# OR OUTSIDE OF FACTORY SETTINGS ARE NOT COVERED UNDER ANY AMD PRODUCT
# WARRANTY AND MAY NOT BE COVERED BY YOUR BOARD OR SYSTEM MANUFACTURER'S
# WARRANTY. Please use this utility with caution.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] od the value to which the overdrive level should be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_overdrive_level(void * processor_handle,uint32_t od) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Control the set of allowed frequencies that can be used for the
# specified clock. It is not supported on virtual machine guest
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a clock type @p clk_type, and a
# 64 bit bitmask @p freq_bitmask, this function will limit the set of
# allowable frequencies. If a bit in @p freq_bitmask has a value of 1, then
# the frequency (as ordered in an ::amdsmi_frequencies_t returned by
# amdsmi_get_clk_freq()) corresponding to that bit index will be
# allowed.
# 
# This function will change the performance level to
# ::AMDSMI_DEV_PERF_LEVEL_MANUAL in order to modify the set of allowable
# frequencies. Caller will need to set to ::AMDSMI_DEV_PERF_LEVEL_AUTO in order
# to get back to default state.
# 
# All bits with indices greater than or equal to
# ::amdsmi_frequencies_t::num_supported will be ignored.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] clk_type the type of clock for which the set of frequencies
# will be modified
# 
# @param[in] freq_bitmask A bitmask indicating the indices of the
# frequencies that are to be enabled (1) and disabled (0). Only the lowest
# ::amdsmi_frequencies_t.num_supported bits of this mask are relevant.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_clk_freq(void * processor_handle,amdsmi_clk_type_t clk_type,uint64_t freq_bitmask) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the soc pstate policy for the processor
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
# 
# @details Given a processor handle @p processor_handle, this function will write
# current soc pstate  policy settings to @p policy. All the processors at the same socket
# will have the same policy.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] policy the soc pstate policy for this processor.
# If this parameter is nullptr, this function will return
# ::AMDSMI_STATUS_INVAL
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_soc_pstate(void * processor_handle,amdsmi_dpm_policy_t * policy) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the soc pstate policy for the processor
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
# 
# @details Given a processor handle @p processor_handle and a soc pstate  policy @p policy_id,
# this function will set the soc pstate  policy for this processor. All the processors at
# the same socket will be set to the same policy.
# 
# @note This function requires admin/sudo privileges on @platform{gpu_bm_linux}
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] policy_id the soc pstate  policy id to set. The id is the id in
# amdsmi_dpm_policy_entry_t, which can be obtained by calling
# amdsmi_get_soc_pstate()
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_soc_pstate(void * processor_handle,uint32_t policy_id) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the xgmi per-link power down policy parameter for the processor
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
# 
# @details Given a processor handle @p processor_handle, this function will write
# current xgmi plpd settings to @p policy. All the processors at the same socket
# will have the same policy.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] xgmi_plpd the xgmi plpd for this processor.
# If this parameter is nullptr, this function will return
# ::AMDSMI_STATUS_INVAL
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_xgmi_plpd(void * processor_handle,amdsmi_dpm_policy_t * xgmi_plpd) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the xgmi per-link power down policy parameter for the processor
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{host}
# 
# @details Given a processor handle @p processor_handle and a dpm policy @p policy_id,
# this function will set the xgmi plpd for this processor. All the processors at
# the same socket will be set to the same policy.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] policy_id the xgmi plpd id to set. The id is the id in
# amdsmi_dpm_policy_entry_t, which can be obtained by calling
# amdsmi_get_xgmi_plpd()
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_xgmi_plpd(void * processor_handle,uint32_t policy_id) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the status of the Process Isolation
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_windows}
# 
# @details Given a processor handle @p processor_handle, this function will write
# current process isolation status to @p pisolate. The 0 is the process isolation
# disabled, and the 1 is the process isolation enabled.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] pisolate the process isolation status.
# If this parameter is nullptr, this function will return
# ::AMDSMI_STATUS_INVAL
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_process_isolation(void * processor_handle,uint32_t * pisolate) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Enable/disable the system Process Isolation
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_windows}
# 
# @details Given a processor handle @p processor_handle and a process isolation @p pisolate,
# flag, this function will set the Process Isolation for this processor. The 0 is the process
# isolation disabled, and the 1 is the process isolation enabled.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] pisolate the process isolation status to set.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_process_isolation(void * processor_handle,uint32_t pisolate) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Run the cleaner shader to clean up data in LDS/GPRs
# 
# @ingroup tagClkPowerPerfControl
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_windows}
# 
# @details Given a processor handle @p processor_handle,
# this function will clean the local data of this processor. This can be called between
# user logins to prevent information leak.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_clean_gpu_local_data(void * processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


cdef extern from "amd_smi/amdsmi.h":

    ctypedef enum amdsmi_fabric_telemetry_category_t:
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_UALOE
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_SWITCH
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_CRYPTO
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_PFC
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_NETPORT
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_DERIVED_UALOE
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_DERIVED_NETPORT
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MAX
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_INVALID
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_UNKNOWN

    ctypedef enum amdsmi_fabric_telemetry_category_mask_t:
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_UALOE
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_SWITCH
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_CRYPTO
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_PFC
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_NETPORT
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_DERIVED_UALOE
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_DERIVED_NETPORT
        AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK_ALL_KNOWN

    ctypedef struct amdsmi_fabric_telemetry_item_t:
        uint64_t id
        uint64_t value

    ctypedef struct amdsmi_fabric_label_t:
        char text[32]

    ctypedef struct amdsmi_fabric_telemetry_instance_t:
        amdsmi_fabric_label_t name
        unsigned int logical_idx
        unsigned int item_count
        amdsmi_fabric_telemetry_item_t * items

    ctypedef struct amdsmi_fabric_telemetry_dataset_t:
        amdsmi_fabric_telemetry_category_t category
        uint64_t generation_count
        timespec timestamp
        unsigned int instance_count
        amdsmi_fabric_telemetry_instance_t * instances

    ctypedef struct amdsmi_fabric_telemetry_t:
        amdsmi_fabric_telemetry_dataset_t * datasets[7]

# 
# @brief Allocate storage for Fabric telemetry data
# 
# @ingroup tagFabric
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function allocates storage for Fabric telemetry data for the
# specified categories. The allocated storage can be reused for multiple
# telemetry retrievals.
# 
# @param[in] processor_handle - Handle for the target processor
# 
# @param[in] category_mask - Bitmask of telemetry categories to allocate,
# constructed using AMDSMI_FABRIC_TELEMETRY_CATEGORY_MASK(cat)
# 
# @param[out] telemetry - Pointer to allocated telemetry structure
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_alloc_fabric_telemetry(void * processor_handle,uint32_t category_mask,amdsmi_fabric_telemetry_t ** telemetry) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get Fabric telemetry data
# 
# @ingroup tagFabric
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function retrieves the latest Fabric telemetry data snapshot
# into pre-allocated storage.
# 
# @param[in] processor_handle - Handle for the target processor
# 
# @param[in,out] telemetry - Pre-allocated telemetry structure to populate
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_fabric_telemetry_data(void * processor_handle,amdsmi_fabric_telemetry_t * telemetry) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get string name for a telemetry item ID
# 
# @ingroup tagFabric
# 
# @platform{gpu_bm_linux}
# 
# @details Given a telemetry item ID @p telem_id,
# this function returns a pointer to a string containing the human-readable name
# for the specified telemetry item. The returned string is statically allocated
# and should not be freed by the caller.
# 
# 
# @param[in] telem_id The telemetry item ID for which the name is requested
# 
# @param[out] telem_name The telemetry item name
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_fabric_telem_id_to_string(uint64_t telem_id,const char ** telem_name) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Free Fabric telemetry storage
# 
# @ingroup tagFabric
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function frees the storage allocated for Fabric telemetry data.
# 
# @param[in] processor_handle - Handle for the target processor
# 
# @param[in] telemetry - Telemetry structure to free
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_free_fabric_telemetry(void * processor_handle,amdsmi_fabric_telemetry_t * telemetry) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


cdef extern from "amd_smi/amdsmi.h":

    ctypedef enum amdsmi_fabric_size_constants_t:
        AMDSMI_FABRIC_ACTIVE_ACCELERATORS_BITMAP_SIZE
        AMDSMI_FABRIC_MAX_LOCAL_GPUS

    ctypedef enum amdsmi_fabric_type_t:
        AMDSMI_FABRIC_TYPE_UALOE
        AMDSMI_FABRIC_TYPE_UALINK
        AMDSMI_FABRIC_TYPE_UNKNOWN
        AMDSMI_FABRIC_TYPE_UALLINK

    ctypedef enum amdsmi_fabric_npa_address_mode_t:
        AMDSMI_FABRIC_NPA_ADDRESS_MODE_SOURCE_ALIASING
        AMDSMI_FABRIC_NPA_ADDRESS_MODE_SOURCE_IDENTIFICATION
        AMDSMI_FABRIC_NPA_ADDRESS_MODE_UNKNOWN

    ctypedef enum amdsmi_fabric_accelerator_vpod_state_t:
        AMDSMI_FABRIC_ACCELERATOR_VPOD_STATE_UNCONFIGURED
        AMDSMI_FABRIC_ACCELERATOR_VPOD_STATE_CONFIGURED
        AMDSMI_FABRIC_ACCELERATOR_VPOD_STATE_READY
        AMDSMI_FABRIC_ACCELERATOR_VPOD_STATE_ACTIVE
        AMDSMI_FABRIC_ACCELERATOR_VPOD_STATE_ERROR
        AMDSMI_FABRIC_ACCELERATOR_VPOD_STATE_UNKNOWN

    ctypedef struct amdsmi_fabric_info_v1_t:
        uint32_t accelerator_id
        amdsmi_fabric_type_t fabric_type
        uint32_t bandwidth
        uint32_t latency
        uint8_t ppod_id[16]
        uint32_t ppod_size
        uint32_t vpod_id
        uint32_t vpod_size
        uint32_t vpod_active_accelerators[32]
        uint32_t local_accelerators[16]
        amdsmi_fabric_npa_address_mode_t addr_mode
        amdsmi_fabric_accelerator_vpod_state_t accel_state

cdef union amdsmi_fabric_info_t_fabric_info_:
    amdsmi_fabric_info_v1_t v1

cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_fabric_info_t:
        amdsmi_bdf_t bdf
        uint32_t fabric_version
        amdsmi_fabric_info_t_fabric_info_ fabric_info
        uint32_t reserved[15]

# 
# @brief Get Fabric device information
# 
# @ingroup tagFabric
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details Reads optional UALoE fabric attributes from sysfs (one file per field).
# Missing or unreadable files are skipped so the call can return partial data:
#   - any field that was not updated from sysfs keeps its sentinel value (ie:
#     numeric fields at their maximum representable value, and unknown enumeration
#     values where documented for ::amdsmi_fabric_info_v1_t).
#   - The device BDF in @p info is always filled when the call completes successfully
#     or returns ::AMDSMI_STATUS_NO_DATA.
# 
# @param[in] processor_handle - Handle for the target processor
# 
# @param[out] info - Pointer to Fabric information structure to be populated.
# Must be allocated by the caller. Written on every return except errors such
# as ::AMDSMI_STATUS_INVAL.
# 
# @return ::amdsmi_status_t
# - ::AMDSMI_STATUS_SUCCESS if at least one sysfs file yielded usable content.
# - ::AMDSMI_STATUS_NO_DATA if no sysfs file yielded usable lines (output still
#   contains BDF and default/sentinel fabric fields).
# - Other codes (e.g. invalid processor handle) on failure.
# 
# @note This path reads sysfs only. It does not require UALoE netlink
# (::ualoe_open) to succeed; that handle is still needed for fabric telemetry APIs.
cdef amdsmi_status_t amdsmi_get_gpu_fabric_info(void * processor_handle,amdsmi_fabric_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the build version information for the currently running build of AMDSMI
# 
# @ingroup tagVersionQuery
# 
# @platform{gpu_bm_linux} @platform{cpu_bm} @platform{guest_1vf} @platform{guest_mvf}
# @platform{guest_windows}
# 
# @details  Get the major, minor, patch and build string for AMDSMI build
# currently in use through @p version
# 
# @param[in,out] version A pointer to an ::amdsmi_version_t structure that will
# be updated with the version information upon return.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_lib_version(amdsmi_version_t * version) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the error counts for a GPU block. It is not supported on virtual
# machine guest
# 
# See [RAS Error Count sysfs Interface (AMDGPU RAS Support - Linux Kernel
# documentation)](https://docs.kernel.org/gpu/amdgpu/ras.html#ras-error-count-sysfs-interface)
# to learn how these error counts are accessed.
# 
# @ingroup tagECCInfo
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details Given a processor handle @p processor_handle, an ::amdsmi_gpu_block_t @p block and a
# pointer to an ::amdsmi_error_count_t @p ec, this function will write the error
# count values for the GPU block indicated by @p block to memory pointed to by
# @p ec.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] block The block for which error counts should be retrieved
# 
# @param[in,out] ec A pointer to an ::amdsmi_error_count_t to which the error
# counts should 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_ecc_count(void * processor_handle,amdsmi_gpu_block_t block,amdsmi_error_count_t * ec) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the enabled ECC bit-mask. It is not supported on virtual machine guest
# 
# See [RAS Error Count sysfs Interface (AMDGPU RAS Support - Linux Kernel
# documentation)](https://docs.kernel.org/gpu/amdgpu/ras.html#ras-error-count-sysfs-interface)
# to learn how these error counts are accessed.
# 
# @ingroup tagECCInfo
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details Given a processor handle @p processor_handle, and a pointer to a uint64_t @p
# enabled_mask, this function will write bits to memory pointed to by
# @p enabled_blocks. Upon a successful call, @p enabled_blocks can then be
# AND'd with elements of the ::amdsmi_gpu_block_t ennumeration to determine if
# the corresponding block has ECC enabled.
# 
# @note Whether a block has ECC enabled or not in the device is independent
# of whether there is kernel support for error counting for that block.
# Although a block may be enabled, but there may not be kernel support for
# reading error counters for that block.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] enabled_blocks A pointer to a uint64_t to which the enabled
# blocks bits 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_ecc_enabled(void * processor_handle,uint64_t * enabled_blocks) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the total number of ECC errors (correctable,
#        uncorrectable and deferred) in the given GPU. It is not supported on
#        virtual machine guest
# 
# See [RAS Error Count sysfs Interface (AMDGPU RAS Support - Linux Kernel
# documentation)](https://docs.kernel.org/gpu/amdgpu/ras.html#ras-error-count-sysfs-interface)
# to learn how these error counts are accessed.
# 
# @ingroup tagECCInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] ec Reference to ecc error count structure.
#             Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_total_ecc_count(void * processor_handle,amdsmi_error_count_t * ec) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_cper_guid_t:
        unsigned char b[16]

    ctypedef struct amdsmi_cper_timestamp_t:
        uint8_t seconds
        uint8_t minutes
        uint8_t hours
        uint8_t flag
        uint8_t day
        uint8_t month
        uint8_t year
        uint8_t century

cdef struct amdsmi_cper_valid_bits_t_valid_bits_:
    uint32_t platform_id
    uint32_t timestamp
    uint32_t partition_id
    uint32_t reserved

cdef extern from "amd_smi/amdsmi.h":

    ctypedef union amdsmi_cper_valid_bits_t:
        amdsmi_cper_valid_bits_t_valid_bits_ valid_bits
        uint32_t valid_mask

    ctypedef struct amdsmi_cper_hdr_t:
        char signature[4]
        uint16_t revision
        uint32_t signature_end
        uint16_t sec_cnt
        amdsmi_cper_sev_t error_severity
        amdsmi_cper_valid_bits_t cper_valid_bits
        uint32_t record_length
        amdsmi_cper_timestamp_t timestamp
        char platform_id[16]
        amdsmi_cper_guid_t partition_id
        char creator_id[16]
        amdsmi_cper_guid_t notify_type
        char record_id[8]
        uint32_t flags
        uint64_t persistence_info
        uint8_t reserved[12]

# 
#  @brief Get the AFIDs from CPER buffer
# 
#  @ingroup tagRasInfo
# 
#  @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
#  @platform{guest_mvf}
# 
#  @details A utility function which retrieves the AFIDs from the CPER record.
# 
#  @param[in] cper_buffer a pointer to the buffer with one CPER record.
#  The caller must make sure the whole CPER record is loaded into the buffer.
# 
#  @param[in] buf_size is the size of the cper_buffer.
# 
#  @param[out] afids a pointer to an array of uint64_t to which the AF IDs will be written
# 
#  @param[in,out] num_afids As input, the value passed through this parameter is the number of
#  uint64_t that may be safely written to the memory pointed to by @p afids. This is the limit
#  on how many AF IDs will be written to @p afids. On return, @p num_afids will contain the
#  number of AF IDs written to @p afids, or the number of AF IDs that could have been written
#  if enough memory had been provided. It is suggest to pass AMDSMI_MAX_NUMBER_OF_AFIDS_PER_RECORD
# for all AF Ids.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_afids_from_cper(char * cper_buffer,uint32_t buf_size,uint64_t * afids,uint32_t * num_afids) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns RAS features info.
# 
# @ingroup tagRasInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
# @param[in] processor_handle Device handle which to query
# 
# @param[out] ras_feature RAS features that are currently enabled and supported on
# the processor. Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_ras_feature_info(void * processor_handle,amdsmi_ras_feature_t * ras_feature) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve CPER entries cached in the driver.
# 
# The user will pass buffers to hold the CPER data and CPER headers. The library will
# fill the buffer based on the severity_mask user passed. It will also parse the CPER header
# and stored in the cper_hdrs array. The user can use the cper_hdrs to get the timestamp and other
# header information. A cursor is also returned to the user, which can be used to get the next set
# of CPER entries.
# 
# If there are more data than any of the buffers user pass, the library will return
# AMDSMI_STATUS_MORE_DATA. User can call the API again with the cursor returned at previous call to
# get more data. If the buffer size is too small to even hold one entry, the library will return
# AMDSMI_STATUS_OUT_OF_RESOURCES.
# 
# Even if the API returns AMDSMI_STATUS_MORE_DATA, the 2nd call may still get the entry_count == 0
# as the driver cache may not contain the severity user is interested in. The API returns
# AMDSMI_STATUS_SUCCESS with entry_count == 0 and buf_size == 0 in this case so that user can
# ignore that call.
# 
# An empty CPER ring (no records) also returns AMDSMI_STATUS_SUCCESS with
# entry_count == 0 and buf_size == 0.
# 
# @ingroup tagRasInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf}
# 
# @param[in] processor_handle Handle to the processor for which CPER entries are to be retrieved.
# @param[in] severity_mask The severity mask of the entries to be retrieved.
# @param[in,out] cper_data Pointer to a buffer where the CPER data will be stored. User must
# allocate the buffer and set the buf_size correctly.
# @param[in,out] buf_size Pointer to a variable that specifies the size of the cper_data.
#                On return, it will contain the actual size of the data written to the cper_data.
# @param[in,out] cper_hdrs Array of the parsed headers of the cper_data. The user must allocate
#                the array of pointers to cper_hdr. The library will fill the array with the
# pointers to the parsed headers. The underlying data is in the cper_data buffer and only pointer
# is stored in this array.
# @param[in,out] entry_count Pointer to a variable that specifies the array length of the cper_hdrs
# user allocated. On return, it will contain the actual entries written to the cper_hdrs.
# @param[in,out] cursor Pointer to a variable that will contain the  cursor  for the next call.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_cper_entries(void * processor_handle,uint32_t severity_mask,char * cper_data,uint64_t * buf_size,amdsmi_cper_hdr_t ** cper_hdrs,uint64_t * entry_count,uint64_t * cursor) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the ECC status for a GPU block. It is not supported on virtual machine
# guest
# 
# See [RAS Error Count sysfs Interface (AMDGPU RAS Support - Linux Kernel
# documentation)](https://docs.kernel.org/gpu/amdgpu/ras.html#ras-error-count-sysfs-interface)
# to learn how these error counts are accessed.
# 
# @ingroup tagErrorQuery
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, an ::amdsmi_gpu_block_t @p block and
# a pointer to an ::amdsmi_ras_err_state_t @p state, this function will write
# the current state for the GPU block indicated by @p block to memory pointed
# to by @p state.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] block The block for which error counts should be retrieved
# 
# @param[in,out] state A pointer to an ::amdsmi_ras_err_state_t to which the
# ECC state should 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_ecc_status(void * processor_handle,amdsmi_gpu_block_t block,amdsmi_ras_err_state_t * state) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get a description of a provided AMDSMI error status
# 
# @ingroup tagErrorQuery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{cpu_bm}
# @platform{guest_1vf} @platform{guest_mvf} @platform{guest_windows}
# 
# @details Set the provided pointer to a const char *, @p status_string, to
# a string containing a description of the provided error code @p status.
# 
# @param[in] status The error status for which a description is desired
# 
# @param[in,out] status_string A pointer to a const char * which will be made
# to point to a description of the provided error code
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_status_code_to_string(amdsmi_status_t status,const char ** status_string) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Tell if an event group is supported by a given device. It is not supported
# on virtual machine guest
# 
# @ingroup tagPerfCounter
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and an event group specifier @p
# group, tell if @p group type events are supported by the device associated
# with @p processor_handle
# 
# @param[in] processor_handle processor handle of device being queried
# 
# @param[in] group ::amdsmi_event_group_t identifier of group for which support
# is being queried
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_gpu_counter_group_supported(void * processor_handle,amdsmi_event_group_t group) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Create a performance counter object
# 
# @ingroup tagPerfCounter
# 
# @platform{gpu_bm_linux}
# 
# @details Create a performance counter object of type @p type for the device
# with a processor handle of @p processor_handle, and write a handle to the object to the
# memory location pointed to by @p evnt_handle. @p evnt_handle can be used
# with other performance event operations. The handle should be deallocated
# with ::amdsmi_gpu_destroy_counter() when no longer needed.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] type the ::amdsmi_event_type_t of performance event to create
# 
# @param[in,out] evnt_handle A pointer to a ::amdsmi_event_handle_t which will be
# associated with a newly allocated counter
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_gpu_create_counter(void * processor_handle,amdsmi_event_type_t type,uintptr_t * evnt_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Deallocate a performance counter object
# 
# @ingroup tagPerfCounter
# 
# @platform{gpu_bm_linux}
# 
# @details Deallocate the performance counter object with the provided
# ::amdsmi_event_handle_t @p evnt_handle
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] evnt_handle handle to event object to be deallocated
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_gpu_destroy_counter(uintptr_t evnt_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Issue performance counter control commands. It is not supported on
# virtual machine guest
# 
# @ingroup tagPerfCounter
# 
# @platform{gpu_bm_linux}
# 
# @details Issue a command @p cmd on the event counter associated with the
# provided handle @p evt_handle.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] evt_handle an event handle
# 
# @param[in] cmd The event counter command to be issued
# 
# @param[in,out] cmd_args Currently not used. Should be set to NULL.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_gpu_control_counter(uintptr_t evt_handle,amdsmi_counter_command_t cmd,void * cmd_args) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Read the current value of a performance counter
# 
# @ingroup tagPerfCounter
# 
# @platform{gpu_bm_linux}
# 
# @details Read the current counter value of the counter associated with the
# provided handle @p evt_handle and write the value to the location pointed
# to by @p value.
# 
# @note This function requires admin/sudo privileges
# 
# @param[in] evt_handle an event handle
# 
# @param[in,out] value pointer to memory of size of ::amdsmi_counter_value_t to
# which the counter value will be written
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_gpu_read_counter(uintptr_t evt_handle,amdsmi_counter_value_t * value) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the number of currently available counters. It is not supported on
# virtual machine guest
# 
# @ingroup tagPerfCounter
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a performance event group @p grp,
# and a pointer to a uint32_t @p available, this function will write the
# number of @p grp type counters that are available on the device with handle
# @p processor_handle to the memory that @p available points to.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] grp an event device group
# 
# @param[in,out] available A pointer to a uint32_t to which the number of
# available counters will be written
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_available_counters(void * processor_handle,amdsmi_event_group_t grp,uint32_t * available) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get process information about processes currently using GPU
# 
# @ingroup tagSystemInfo
# 
# @platform{gpu_bm_linux}
# 
# @details Given a non-NULL pointer to an array @p procs of
# ::amdsmi_process_info_t's, of length *@p num_items, this function will write
# up to *@p num_items instances of ::amdsmi_process_info_t to the memory pointed
# to by @p procs. These instances contain information about each process
# utilizing a GPU. If @p procs is not NULL, @p num_items will be updated with
# the number of processes actually written. If @p procs is NULL, @p num_items
# will be updated with the number of processes for which there is current
# process information. Calling this function with @p procs being NULL is a way
# to determine how much memory should be allocated for when @p procs is not
# NULL.
# 
# @param[in,out] procs a pointer to memory provided by the caller to which
# process information will be written. This may be NULL in which case only @p
# num_items will be updated with the number of processes found.
# 
# @param[in,out] num_items A pointer to a uint32_t, which on input, should
# contain the amount of memory in ::amdsmi_process_info_t's which have been
# provided by the @p procs argument. On output, if @p procs is non-NULL, this
# will be updated with the number ::amdsmi_process_info_t structs actually
# written. If @p procs is NULL, this argument will be updated with the number
# processes for which there is information.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_compute_process_info(amdsmi_process_info_t * procs,uint32_t * num_items) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get process information about a specific process
# 
# @ingroup tagSystemInfo
# 
# @platform{gpu_bm_linux}
# 
# @details Given a pointer to an ::amdsmi_process_info_t @p proc and a process
# id
# @p pid, this function will write the process information for @p pid, if
# available, to the memory pointed to by @p proc.
# 
# @param[in] pid The process ID for which process information is being
# requested
# 
# @param[in,out] proc a pointer to a ::amdsmi_process_info_t to which
# process information for @p pid will be written if it is found.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_compute_process_info_by_pid(uint32_t pid,amdsmi_process_info_t * proc) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the device indices currently being used by a process
# 
# @ingroup tagSystemInfo
# 
# @platform{gpu_bm_linux}
# 
# @details Given a process id @p pid, a non-NULL pointer to an array of
# uint32_t's @p processor_handleices of length *@p num_devices, this function will
# write up to @p num_devices device indices to the memory pointed to by
# @p processor_handleices. If @p processor_handleices is not NULL, @p num_devices will be
# updated with the number of gpu's currently being used by process @p pid.
# If @p processor_handleices is NULL, @p processor_handleices will be updated with the number of
# gpus currently being used by @p pid. Calling this function with @p
# dv_indices being NULL is a way to determine how much memory is required
# for when @p processor_handleices is not NULL.
# 
# @param[in] pid The process id of the process for which the number of gpus
# currently being used is requested
# 
# @param[in,out] dv_indices a pointer to memory provided by the caller to
# which indices of devices currently being used by the process will be
# written. This may be NULL in which case only @p num_devices will be
# updated with the number of devices being used.
# 
# @param[in,out] num_devices A pointer to a uint32_t, which on input, should
# contain the amount of memory in uint32_t's which have been provided by the
# @p processor_handleices argument. On output, if @p processor_handleices is non-NULL, this will
# be updated with the number uint32_t's actually written. If @p processor_handleices is
# NULL, this argument will be updated with the number devices being used.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_compute_process_gpus(uint32_t pid,uint32_t * dv_indices,uint32_t * num_devices) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the XGMI error status for a device. It is not supported on
# virtual machine guest
# 
# @ingroup tagXGMI
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, and a pointer to an
# ::amdsmi_xgmi_status_t @p status, this function will write the current XGMI
# error state ::amdsmi_xgmi_status_t for the device @p processor_handle to the memory
# pointed to by @p status.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] status A pointer to an ::amdsmi_xgmi_status_t to which the
# XGMI error state should 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_gpu_xgmi_error_status(void * processor_handle,amdsmi_xgmi_status_t * status) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Reset the XGMI error status for a device. It is not supported on virtual
# machine guest
# 
# @ingroup tagXGMI
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, this function will reset the
# current XGMI error state ::amdsmi_xgmi_status_t for the device @p processor_handle to
# amdsmi_xgmi_status_t::AMDSMI_XGMI_STATUS_NO_ERRORS
# 
# @param[in] processor_handle a processor handle
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_reset_gpu_xgmi_error(void * processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief          Returns XGMI information for the GPU.
# 
# @ingroup tagXGMI
# 
# @platform{gpu_bm_linux}
# 
# @param[in]      processor_handle Device which to query
# 
# @param[out]     info Reference to xgmi information structure. Must be
#                 allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_xgmi_info(void * processor_handle,amdsmi_xgmi_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the XGMI link status
# 
# @ingroup tagXGMI
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle,  this function
# will return the link status for each XGMI link connect to this processor.
# If the processor link type is not XGMI, it should return AMDSMI_STATUS_NOT_SUPPORTED.
# 
# @param[in] processor_handle a processor handle
# 
# @param[out] link_status The link status of the XGMI connect to this processor.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_xgmi_link_status(void * processor_handle,amdsmi_xgmi_link_status_t * link_status) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Return link metric information
# 
# @ingroup tagHWTopology
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @param[in] processor_handle PF of a processor for which to query
# 
# @param[out] link_metrics reference to the link metrics struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_link_metrics(void * processor_handle,amdsmi_link_metrics_t * link_metrics) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the NUMA CPU node number for a device
# 
# @ingroup tagHWTopology
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details Given a processor handle @p processor_handle, and a pointer to an
# uint32_t @p numa_node, this function will write the
# node number of NUMA CPU for the device @p processor_handle to the memory
# pointed to by @p numa_node.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in,out] numa_node A pointer to an uint32_t to which the
# numa node number should be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_topo_get_numa_node_number(void * processor_handle,uint32_t * numa_node) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the weight for a connection between 2 GPUs
# 
# @ingroup tagHWTopology
# 
# @platform{gpu_bm_linux}
# 
# @details Given a source processor handle @p processor_handle_src and
# a destination processor handle @p processor_handle_dst, and a pointer to an
# uint64_t @p weight, this function will write the
# weight for the connection between the device @p processor_handle_src
# and @p processor_handle_dst to the memory pointed to by @p weight.
# 
# The weight is a qualitative cost metric derived from the KFD io_link
# @c weight property (lower values indicate closer or faster connections),
# similar in spirit to the NUMA distances reported by @c numactl. The value
# is computed as follows:
# 
# - Each physical xGMI hop contributes 15, so an xGMI route traversing
#   @em N physical links has a weight of @em 15*N. A single-hop xGMI
#   connection has a weight of 15.
# - PCIe segments are summed over all segments (GPU→CPU + CPU→CPU + CPU→GPU).
#   Each GPU-to-CPU segment typically contributes 20. The CPU-to-CPU segment
#   uses the actual io_link weight when available; if that weight cannot be
#   read, a fallback value of 10 is used for that segment.
# 
# @param[in] processor_handle_src the source processor handle
# 
# @param[in] processor_handle_dst the destination processor handle
# 
# @param[in,out] weight A pointer to an uint64_t to which the
# weight for the connection should be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_topo_get_link_weight(void * processor_handle_src,void * processor_handle_dst,uint64_t * weight) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve minimal and maximal io link bandwidth between 2 GPUs
# 
# @ingroup tagHWTopology
# 
# @platform{gpu_bm_linux}
# 
# @details Given a source processor handle @p processor_handle_src and
# a destination processor handle @p processor_handle_dst,  pointer to an
# uint64_t @p min_bandwidth, and a pointer to uint64_t @p max_bandiwidth,
# this function will write theoretical minimal and maximal bandwidth limits.
# API works if src and dst are connected via xgmi and have 1 hop distance.
# 
# @param[in] processor_handle_src the source processor handle
# 
# @param[in] processor_handle_dst the destination processor handle
# 
# @param[in,out] min_bandwidth A pointer to an uint64_t to which the
# minimal bandwidth for the connection should be written.
# 
# @param[in,out] max_bandwidth A pointer to an uint64_t to which the
# maximal bandwidth for the connection should be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_minmax_bandwidth_between_processors(void * processor_handle_src,void * processor_handle_dst,uint64_t * min_bandwidth,uint64_t * max_bandwidth) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the hops and the connection type between 2 GPUs
# 
# @ingroup tagHWTopology
# 
# @platform{gpu_bm_linux}
# 
# @details Given a source processor handle @p processor_handle_src and
# a destination processor handle @p processor_handle_dst, and a pointer to an
# uint64_t @p hops and a pointer to an ::amdsmi_link_type_t @p type,
# this function will write the number of hops and the connection type
# between the device @p processor_handle_src and @p processor_handle_dst to the memory
# pointed to by @p hops and @p type.
# 
# @note The value written to @p hops is an <b>abstracted topology step count</b>,
# not the number of physical xGMI links traversed. The possible values are:
# 
# | Value | Meaning |
# |-------|---------|
# | 1 | The two GPUs are reachable over xGMI, regardless of how many physical xGMI links the route traverses. |
# | 2 | The two GPUs communicate over PCIe within the same CPU NUMA node. |
# | 3 | The two GPUs communicate over PCIe across different CPU NUMA nodes. |
# | 4 | Fallback value used when the inter-CPU io_link weight cannot be read. |
# 
# Two GPUs on the same xGMI fabric always report a hop count of 1, even when
# the data physically crosses several xGMI links. To obtain the literal number
# of physical xGMI links between two devices, read the value exposed by the
# @c amdgpu driver at @c `/sys/class/drm/card{0,1,…}/device/xgmi_num_hops` instead.
# 
# @param[in] processor_handle_src the source processor handle
# 
# @param[in] processor_handle_dst the destination processor handle
# 
# @param[in,out] hops A pointer to an uint64_t to which the
# abstracted hop count for the connection should be written.
# 
# @param[in,out] type A pointer to an ::amdsmi_link_type_t to which the
# type for the connection should be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_topo_get_link_type(void * processor_handle_src,void * processor_handle_dst,uint64_t * hops,amdsmi_link_type_t * type) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Retrieve the set of GPUs that are nearest to a given device
#         at a specific interconnectivity level.
# 
#  @ingroup tagHWTopology
# 
#  @platform{gpu_bm_linux} @platform{host}
# 
#  @details Once called topology_nearest_info will get populated with a list of
#           all nearest devices for a given link_type. The list has a count of
#           the number of devices found and their respective handles/identifiers.
# 
#  @param[in] processor_handle The identifier of the given device.
# 
#  @param[in] link_type The amdsmi_link_type_t level to search for nearest GPUs.
# 
#  @param[in,out] topology_nearest_info
#                 .count;
#                   - When zero, set to the number of matching GPUs such that .device_list can be
# malloc'd.
#                   - When non-zero, .device_list will be filled with count number of
# processor_handle. .device_list An array of processor_handle for GPUs found at level.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail.
cdef amdsmi_status_t amdsmi_get_link_topology_nearest(void * processor_handle,amdsmi_link_type_t link_type,amdsmi_topology_nearest_t * topology_nearest_info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Return P2P availability status between 2 GPUs
# 
# @ingroup tagHWTopology
# 
# @platform{gpu_bm_linux}
# 
# @details Given a source processor handle @p processor_handle_src and
# a destination processor handle @p processor_handle_dst, and a pointer to a
# bool @p accessible, this function will write the P2P connection status
# between the device @p processor_handle_src and @p processor_handle_dst to the memory
# pointed to by @p accessible.
# 
# @param[in] processor_handle_src the source processor handle
# 
# @param[in] processor_handle_dst the destination processor handle
# 
# @param[in,out] accessible A pointer to a bool to which the status for
# the P2P connection availability should be written.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_is_P2P_accessible(void * processor_handle_src,void * processor_handle_dst,_Bool * accessible) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Retrieve connection type and P2P capabilities between 2 GPUs
# 
#  @ingroup tagHWTopology
# 
#  @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# 
#  @details Given a source processor handle @p processor_handle_src and
#  a destination processor handle @p processor_handle_dst, a pointer to an amdsmi_link_type_t @p
# type, and a pointer to amdsmi_p2p_capability_t @p cap. This function will write the connection
# type, and io link capabilities between the device
#  @p processor_handle_src and @p processor_handle_dst to the memory
#  pointed to by @p cap and @p type.
# 
#  @param[in] processor_handle_src the source processor handle
# 
#  @param[in] processor_handle_dst the destination processor handle
# 
#  @param[in,out] type A pointer to an ::amdsmi_link_type_t to which the
#  type for the connection should be written.
# 
#  @param[in,out] cap A pointer to an ::amdsmi_p2p_capability_t to which the
#  io link capabilities should be written.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_topo_get_p2p_status(void * processor_handle_src,void * processor_handle_dst,amdsmi_link_type_t * type,amdsmi_p2p_capability_t * cap) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves the current compute partitioning for a desired device
# 
# @deprecated This API is slated for removal in a future ROCm release;
# ::amdsmi_get_gpu_accelerator_partition_profile() should be used instead
# 
# @ingroup tagComputePartition
# 
# @platform{gpu_bm_linux}
# 
# @details
# Given a processor handle @p processor_handle and a string @p compute_partition,
# and uint32 @p len, this function will attempt to obtain the device's
# current compute partition setting string. Upon successful retrieval,
# the obtained device's compute partition settings string shall be stored in
# the passed @p compute_partition char string variable.
# 
# @param[in] processor_handle Device which to query
# 
# @param[inout] compute_partition a pointer to a char string variable,
# which the device's current compute partition will be written to.
# 
# @param[in] len the length of the caller provided buffer @p compute_partition,
# suggested length is 4 or greater.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_UNEXPECTED_DATA data provided to function is not valid
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
# @retval ::AMDSMI_STATUS_INSUFFICIENT_SIZE is returned if @p len bytes is not
# large enough to hold the entire compute partition value. In this case,
# only @p len bytes will be written.
# @return ::amdsmi_status_t
cdef amdsmi_status_t amdsmi_get_gpu_compute_partition(void * processor_handle,char * compute_partition,uint32_t len) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Modifies a selected device's compute partition setting.
# 
# @deprecated This API is slated for removal in a future ROCm release;
# ::amdsmi_set_gpu_accelerator_partition_profile() should be used instead
# 
# @ingroup tagComputePartition
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle, a type of compute partition
# @p compute_partition, this function will attempt to update the selected
# device's compute partition setting. This function does not allow any concurrent operations.
# Device must be idle and have no workloads when performing set partition operations.
# 
# @param[in] processor_handle Device which to query
# 
# @param[in] compute_partition using enum ::amdsmi_compute_partition_type_t,
# define what the selected device's compute partition setting should be
# updated to.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_NO_PERM function requires admin/sudo privileges
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_SETTING_UNAVAILABLE the provided setting is
# unavailable for current device
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
# @return ::amdsmi_status_t
cdef amdsmi_status_t amdsmi_set_gpu_compute_partition(void * processor_handle,amdsmi_compute_partition_type_t compute_partition) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves the current compute partition memory allocation mode
# for a desired device.
# 
# @deprecated This API is slated for removal in a future ROCm release;
# ::amdsmi_get_gpu_accelerator_partition_mem_alloc_mode() should be used instead
# 
# @ingroup tagComputePartition
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer
# @p mode, this function will attempt to obtain the device's current
# compute partition memory allocation mode. The mode controls how HBM
# capacity is distributed across XCPs within each memory partition:
# - ::AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_CAPPING — each XCP is capped
#   to an even share.
# - ::AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_ALL — each XCP may use the
#   full memory partition size (useful when only one XCP is active).
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] mode a pointer to an ::amdsmi_compute_partition_mem_alloc_mode_t
# variable, into which the device's current memory allocation mode will
# be written.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_UNEXPECTED_DATA data provided to function is not valid
# @retval ::AMDSMI_STATUS_FILE_ERROR problem accessing the sysfs file
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
cdef amdsmi_status_t amdsmi_get_gpu_compute_partition_mem_alloc_mode(void * processor_handle,amdsmi_compute_partition_mem_alloc_mode_t * mode) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves the current accelerator partition memory allocation mode
# for a desired device.
# 
# @ingroup tagComputePartition
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a pointer
# @p mode, this function will attempt to obtain the device's current
# accelerator partition memory allocation mode. The mode controls how HBM
# capacity is distributed across XCPs within each memory partition:
# - ::AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_CAPPING — each XCP is capped
#   to an even share.
# - ::AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_ALL — each XCP may use the
#   full memory partition size (useful when only one XCP is active).
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] mode a pointer to an ::amdsmi_accelerator_partition_mem_alloc_mode_t
# variable, into which the device's current memory allocation mode will
# be written.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_UNEXPECTED_DATA data provided to function is not valid
# @retval ::AMDSMI_STATUS_FILE_ERROR problem accessing the sysfs file
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
cdef amdsmi_status_t amdsmi_get_gpu_accelerator_partition_mem_alloc_mode(void * processor_handle,amdsmi_accelerator_partition_mem_alloc_mode_t * mode) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Modifies a selected device's compute partition memory allocation mode.
# 
# @deprecated This API is slated for removal in a future ROCm release;
# ::amdsmi_set_gpu_accelerator_partition_mem_alloc_mode() should be used instead
# 
# @ingroup tagComputePartition
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a mode
# @p mode, this function will attempt to update the selected device's
# compute partition memory allocation mode. The mode controls how HBM
# capacity is distributed across XCPs within each memory partition:
# - ::AMDSMI_COMPUTE_PARTITION_MEM_ALLOC_CAPPING — each XCP is capped
#   to an even share. This is the default.
# - ::AMDSMI_COMPUTE_PARTITION_MEM_ALLOC_ALL — each XCP may use the
#   full memory partition size.
# 
# @param[in] processor_handle Device which to modify
# 
# @param[in] mode using enum ::amdsmi_compute_partition_mem_alloc_mode_t,
# define what the selected device's memory allocation mode should be
# updated to.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_NO_PERM function requires admin/sudo privileges
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_FILE_ERROR problem accessing the sysfs file
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
cdef amdsmi_status_t amdsmi_set_gpu_compute_partition_mem_alloc_mode(void * processor_handle,amdsmi_compute_partition_mem_alloc_mode_t mode) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Modifies a selected device's compute partition memory allocation mode.
# 
# @ingroup tagComputePartition
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a mode
# @p mode, this function will attempt to update the selected device's
# compute partition memory allocation mode. The mode controls how HBM
# capacity is distributed across XCPs within each memory partition:
# - ::AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_CAPPING — each XCP is capped
#   to an even share. This is the default.
# - ::AMDSMI_ACCELERATOR_PARTITION_MEM_ALLOC_ALL — each XCP may use the
#   full memory partition size.
# 
# @param[in] processor_handle Device which to modify
# 
# @param[in] mode using enum ::amdsmi_accelerator_partition_mem_alloc_mode_t,
# define what the selected device's memory allocation mode should be
# updated to.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_NO_PERM function requires admin/sudo privileges
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_FILE_ERROR problem accessing the sysfs file
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
cdef amdsmi_status_t amdsmi_set_gpu_accelerator_partition_mem_alloc_mode(void * processor_handle,amdsmi_accelerator_partition_mem_alloc_mode_t mode) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves the current memory partition for a desired device
# 
# @ingroup tagMemoryPartition
# 
# @platform{gpu_bm_linux}
# 
# @details
# Given a processor handle @p processor_handle and a string @p memory_partition,
# and uint32 @p len, this function will attempt to obtain the device's
# memory partition string. Upon successful retrieval, the obtained device's
# memory partition string shall be stored in the passed @p memory_partition
# char string variable.
# 
# @param[in] processor_handle Device which to query
# 
# @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 memory_partition,
# suggested length is 5 or greater.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_UNEXPECTED_DATA data provided to function is not valid
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
# @retval ::AMDSMI_STATUS_INSUFFICIENT_SIZE is returned if @p len bytes is not
# large enough to hold the entire memory partition value. In this case,
# only @p len bytes will be written.
# @return ::amdsmi_status_t
cdef amdsmi_status_t amdsmi_get_gpu_memory_partition(void * processor_handle,char * memory_partition,uint32_t len) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Modifies a selected device's current memory partition setting.
# 
# @deprecated This API is slated for removal in a future ROCm release;
# ::amdsmi_set_gpu_memory_partition_mode() should be used instead
# 
# @ingroup tagMemoryPartition
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a type of memory partition
# @p memory_partition, this function will attempt to update the selected
# device's memory partition setting. This function does not allow any concurrent operations.
# Device must be idle and have no workloads when performing set partition operations.
# 
# On @platform{gpu_bm_linux} AMDGPU driver restart is REQUIRED to complete updating to
# the new memory partition setting.
# 
# @param[in] processor_handle Device which to query
# 
# @param[in] memory_partition using enum ::amdsmi_memory_partition_type_t,
# define what the selected device's current mode setting should be updated to.
# 
# @retval ::AMDSMI_STATUS_SUCCESS call was successful
# @retval ::AMDSMI_STATUS_NO_PERM function requires admin/sudo privileges
# @retval ::AMDSMI_STATUS_INVAL the provided arguments are not valid
# @retval ::AMDSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
# support this function
# @retval ::AMDSMI_STATUS_BUSY device is busy, a resource or mutex could not be acquired
# @return ::amdsmi_status_t
#
cdef amdsmi_status_t amdsmi_set_gpu_memory_partition(void * processor_handle,amdsmi_memory_partition_type_t memory_partition) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns current gpu memory partition capabilities
# 
# @ingroup tagMemoryPartition
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# 
# @param[in] processor_handle a processor handle
# 
# @param[out] config reference to the memory partition config.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_memory_partition_config(void * processor_handle,amdsmi_memory_partition_config_t * config) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Sets memory partition mode
# Set memory partition setting based on memory_partition mode
# from amdsmi_get_gpu_memory_partition_config
# 
# @ingroup tagMemoryPartition
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details Given a processor handle @p processor_handle and a type of memory partition
# @p mode, this function will attempt to update the selected
# device's memory partition setting. This function does not allow any concurrent operations.
# Device must be idle and have no workloads when performing set partition operations.
# 
# @details On @platform{gpu_bm_linux} AMDGPU driver restart is REQUIRED to complete updating
# to the new memory partition setting.
# 
# On @platform{gpu_bm_linux} AMDGPU driver restart is REQUIRED to complete updating to
# the new memory partition setting.
# 
# @param[in] processor_handle A processor handle
# 
# @param[in] mode Enum representing memory partitioning mode to set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_memory_partition_mode(void * processor_handle,amdsmi_memory_partition_type_t mode) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns gpu accelerator partition caps as currently configured in the system
# 
# @ingroup tagAcceleratorPartition
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# 
# @note API requires admin/sudo privileges or API will not be able to read all resources
# for @platform{gpu_bm_linux} or any resources for @platform{host}.
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] profile_config reference to the accelerator partition config.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_accelerator_partition_profile_config(void * processor_handle,amdsmi_accelerator_partition_profile_config_t * profile_config) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns current gpu accelerator partition cap
# 
# @ingroup tagAcceleratorPartition
# 
# @note API requires admin/sudo privileges or API will not be able to read all resources
# for @platform{gpu_bm_linux} or any resources for @platform{host}.
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] profile reference to the accelerator partition profile.
# Must be allocated by user.
# 
# @param[in,out] partition_id array of ids for current accelerator profile.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_accelerator_partition_profile(void * processor_handle,amdsmi_accelerator_partition_profile_t * profile,uint32_t * partition_id) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set accelerator partition setting based on profile_index
# from amdsmi_get_gpu_accelerator_partition_profile_config
# 
# @ingroup tagAcceleratorPartition
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @note API requires admin/sudo privileges or API will not be able to read all resources
# for @platform{gpu_bm_linux} or any resources for @platform{host}.
# 
# @param[in] processor_handle Device which to query
# 
# @param[in] profile_index Represents index of a partition user wants to set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_accelerator_partition_profile(void * processor_handle,uint32_t profile_index) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Prepare to collect event notifications for a GPU
# 
# @ingroup tagEventNotification
# 
# @platform{gpu_bm_linux}
# 
# @details This function prepares to collect events for the GPU with device
# ID @p processor_handle, by initializing any required system parameters. This call
# may open files which will remain open until ::amdsmi_stop_gpu_event_notification()
# is called.
# 
# @param[in] processor_handle a processor handle corresponding to the device on which to
# listen for events
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_init_gpu_event_notification(void * processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Specify which events to collect for a device
# 
# @ingroup tagEventNotification
# 
# @platform{gpu_bm_linux}
# 
# @details Given a processor handle @p processor_handle and a @p mask consisting of
# elements of ::amdsmi_evt_notification_type_t OR'd together, this function
# will listen for the events specified in @p mask on the device
# corresponding to @p processor_handle.
# 
# @param[in] processor_handle a processor handle corresponding to the device on which to
# listen for events
# 
# @param[in] mask Bitmask generated by OR'ing 1 or more elements of
# ::amdsmi_evt_notification_type_t indicating which event types to listen for,
# where the amdsmi_evt_notification_type_t value indicates the bit field, with
# bit position starting from 1.
# For example, if the mask field is 0x0000000000000003, which means first bit,
# bit 1 (bit position start from 1) and bit 2 are set, which indicate interest
# in receiving AMDSMI_EVT_NOTIF_VMFAULT (which has a value of 1) and
# AMDSMI_EVT_NOTIF_THERMAL_THROTTLE event (which has a value of 2).
# 
# @note ::AMDSMI_STATUS_INIT_ERROR is returned if
# ::amdsmi_init_gpu_event_notification() has not been called before a call to this
# function
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_event_notification_mask(void * processor_handle,uint64_t mask) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Collect event notifications, waiting a specified amount of time
# 
# @ingroup tagEventNotification
# 
# @platform{gpu_bm_linux}
# 
# @details Given a time period @p timeout_ms in milliseconds and a caller-
# provided buffer of ::amdsmi_evt_notification_data_t's @p data with a length
# (in ::amdsmi_evt_notification_data_t's, also specified by the caller) in the
# memory location pointed to by @p num_elem, this function will collect
# ::amdsmi_evt_notification_type_t events for up to @p timeout_ms milliseconds,
# and write up to *@p num_elem event items to @p data. Upon return @p num_elem
# is updated with the number of events that were actually written. If events
# are already present when this function is called, it will write the events
# to the buffer then poll for new events if there is still caller-provided
# buffer available to write any new events that would be found.
# 
# This function requires prior calls to ::amdsmi_init_gpu_event_notification() and
# :: amdsmi_set_gpu_event_notification_mask(). This function polls for the
# occurrence of the events on the respective devices that were previously
# specified by :: amdsmi_set_gpu_event_notification_mask().
# 
# @param[in] timeout_ms number of milliseconds to wait for an event
# to occur
# 
# @param[in,out] num_elem pointer to uint32_t, provided by the caller. On
# input, this value tells how many ::amdsmi_evt_notification_data_t elements
# are being provided by the caller with @p data. On output, the location
# pointed to by @p num_elem will contain the number of items written to
# the provided buffer.
# 
# @param[out] data pointer to a caller-provided memory buffer of size
# @p num_elem ::amdsmi_evt_notification_data_t to which this function may safely
# write. If there are events found, up to @p num_elem event items will be
# written to @p data.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_event_notification(int timeout_ms,uint32_t * num_elem,amdsmi_evt_notification_data_t * data) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Close any file handles and free any resources used by event
# notification for a GPU
# 
# @ingroup tagEventNotification
# 
# @platform{gpu_bm_linux}
# 
# @details Any resources used by event notification for the GPU with
# processor handle @p processor_handle will be free with this
# function. This includes freeing any memory and closing file handles. This
# should be called for every call to ::amdsmi_init_gpu_event_notification()
# 
# @param[in] processor_handle The processor handle of the GPU for which event
# notification resources will be free
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_stop_gpu_event_notification(void * processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the driver version information
# 
# @ingroup tagSoftwareVersion
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] info Reference to driver information structure. Must be
#             allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_driver_info(void * processor_handle,amdsmi_driver_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the ASIC information for the device
# 
# @ingroup tagAsicBoardInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# @platform{guest_windows}
# 
# @details This function returns ASIC information such as the product name,
#          the vendor ID, the subvendor ID, the device ID,
#          the revision ID and the serial number.
# 
# @note The processor_handle that contains amdsmi_asic_info_t member oam_id = 0
#       corresponds to the socket that contains baseboard information.
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] info Reference to static asic information structure.
#             Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_asic_info(void * processor_handle,amdsmi_asic_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief          Returns the KFD (Kernel Fusion Driver) information for the device
# 
# @ingroup tagAsicBoardInfo
# 
# @platform{gpu_bm_linux}
# 
# @details        This function returns KFD information populated into the amdsmi_kfd_info_t.
#                 This contains the kfd_id and node_id which allow for the ID and
#                 index of this device in the KFD.
# 
# @param[in]      processor_handle Device which to query
# 
# @param[out]     info Reference to kfd information structure.
#                 Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_kfd_info(void * processor_handle,amdsmi_kfd_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns vram info
# 
# @ingroup tagAsicBoardInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# 
# @param[in] processor_handle PF of a processor for which to query
# 
# @param[out] info Reference to vram info structure
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_vram_info(void * processor_handle,amdsmi_vram_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the board part number and board information for the requested device
# 
# @ingroup tagAsicBoardInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] info Reference to board info structure.
#             Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_board_info(void * processor_handle,amdsmi_board_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the power caps as currently configured in the system.
# 
# @ingroup tagAsicBoardInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[in] sensor_ind A 0-based sensor index. Normally, this will be 0.
# If a device has more than one sensor, it could be greater than 0.
# Parameter @p sensor_ind is unused on @platform{host}.
# 
# @param[out] info Reference to power caps information structure. Must be
# allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_power_cap_info(void * processor_handle,uint32_t sensor_ind,amdsmi_power_cap_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the PCIe info for the GPU.
# 
# @ingroup tagAsicBoardInfo
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] info Reference to the PCIe information
# returned by the library. Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_pcie_info(void * processor_handle,amdsmi_pcie_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the 'xcd_counter' from the GPU metrics associated with the device
# 
# @ingroup tagAsicBoardInfo
# 
# @platform{gpu_bm_linux} @platform{guest_1vf} @platform{guest_mvf}
# 
# @param[in] processor_handle Device which to query
# 
# @param[inout] xcd_count a pointer to uint16_t to which the device gpu
# metric unit will be stored. Must be allocated by user.
# 
# @retval ::AMDSMI_STATUS_SUCCESS is returned upon successful call.
#         ::AMDSMI_STATUS_NOT_SUPPORTED is returned in case the metric unit
#           does not exist for the given device.
cdef amdsmi_status_t amdsmi_get_gpu_xcd_counter(void * processor_handle,uint16_t * xcd_count) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves node power management (NPM) status and power limit for the specified node.
# 
# @ingroup tagNodeInfo
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function queries the NPM controller for the given node and returns whether NPM is
# enabled, along with the current node-level power limit in Watts. The NPM status and limit are set
# out-of-band and reported via this API.
# 
# @param[in]  node_handle Handle to the Node to query.
# @param[out] info Pointer to amdsmi_npm_info_t structure to receive NPM status and limit.
#             Must be allocated by the user.
# 
# @return ::AMDSMI_STATUS_SUCCESS on success, non-zero on failure.
cdef amdsmi_status_t amdsmi_get_npm_info(void * node_handle,amdsmi_npm_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the firmware versions running on the device.
# 
# @ingroup tagFWVbiosQuery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] info Reference to the fw info. Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_fw_info(void * processor_handle,amdsmi_fw_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the static information for the vBIOS on the device.
# 
# @ingroup tagFWVbiosQuery
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_1vf} @platform{guest_mvf}
# @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] info Reference to static vBIOS information.
#             Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_vbios_info(void * processor_handle,amdsmi_vbios_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the temperature metric value for the specified metric, from the
# specified temperature sensor on the specified device. It is not supported on
# virtual machine guest
# 
# @ingroup tagGPUMonitor
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
# @details Given a processor handle @p processor_handle, a sensor type @p sensor_type, a
# ::amdsmi_temperature_metric_t @p metric and a pointer to an int64_t @p
# temperature, this function will write the value of the metric indicated by
# @p metric and @p sensor_type to the memory location @p temperature.
# 
# @param[in] processor_handle a processor handle
# 
# @param[in] sensor_type part of device from which temperature should be
# obtained. This should come from the enum ::amdsmi_temperature_type_t
# 
# @param[in] metric enum indicated which temperature value should be
# retrieved
# 
# @param[in,out] temperature a pointer to int64_t to which the temperature is in Celsius.
# 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.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_temp_metric(void * processor_handle,amdsmi_temperature_type_t sensor_type,amdsmi_temperature_metric_t metric,int64_t * temperature) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the current usage of the GPU engines (GFX, MM and MEM).
# Each usage is reported as a percentage from 0-100%.
# 
# @ingroup tagGPUMonitor
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] info Reference to the gpu engine usage structure. Must be allocated by user.
# When @p gfx_activity is unavailable it is reported as N/A using the sentinel
# 0x0000FFFF (a uint16_t max value carried in the uint32_t field), not 0xFFFFFFFF.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_activity(void * processor_handle,amdsmi_engine_usage_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Returns the current power and voltage of the GPU.
# 
#  @ingroup tagGPUMonitor
# 
#  @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
#  @note amdsmi_power_info_t::socket_power metric can rarely spike above the socket power limit in
# some cases
#  @note unsupported struct members are set to UINT32_MAX
# 
#  @param[in] processor_handle PF of a processor for which  to query
# 
#  @param[out] info Reference to the gpu power structure. Must be allocated by user.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_power_info(void * processor_handle,amdsmi_power_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns is power management enabled
# 
# @ingroup tagGPUMonitor
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @param[in] processor_handle PF of a processor for which to query
# 
# @param[out] enabled Reference to bool. Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_is_gpu_power_management_enabled(void * processor_handle,_Bool * enabled) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the measurements of the clocks in the GPU
#        for the GFX and multimedia engines and Memory. This call
#        reports the averages over 1s in MHz. It is not supported
#        on virtual machine guest
# 
# @ingroup tagGPUMonitor
# 
# @platform{gpu_bm_linux} @platform{host} @platform{guest_windows}
# 
# @param[in] processor_handle Device which to query
# 
# @param[in] clk_type Enum representing the clock type to query.
# 
# @param[out] info Reference to the gpu clock structure.
#             Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_clock_info(void * processor_handle,amdsmi_clk_type_t clk_type,amdsmi_clk_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Returns the VRAM usage (both total and used memory) in MegaBytes.
# 
# @ingroup tagGPUMonitor
# 
# @platform{gpu_bm_linux} @platform{guest_windows}
# 
# @param[in]      processor_handle Device which to query
# 
# @param[out] info Reference to vram information. Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_gpu_vram_usage(void * processor_handle,amdsmi_vram_usage_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief          Returns the violations for a processor
# 
# Warning: API will be slow due to polling driver for 2 samples. Require
# a minimum wait of 100ms between the 2 samples in order to calculate. Otherwise
# users would need to use amdsmi_get_gpu_metrics_info for BM. See that API's struct
# for calculations.
# 
# @ingroup tagGPUMonitor
# 
# @platform{gpu_bm_linux}
# 
# @param[in]      processor_handle Device which to query
# 
# @param[out]     info Reference to all violation status details available.
#                 Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_violation_status(void * processor_handle,amdsmi_violation_status_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Returns the list of process information running on a given GPU.
#  If pdh.dll is not present on the system, this API returns
#  AMDSMI_STATUS_NOT_SUPPORTED. Sum of the process memory is not expected to be the total memory
# usage.
# 
#  @ingroup tagProcessInfo
# 
#  @platform{gpu_bm_linux} @platform{guest_windows}
# 
#  @warning IMPORTANT: To get valid return values, at least 1 second needs to pass
#  from starting the program to the first call of this function,
#  and before every following call of this function after that, to get correct values
# 
#  @note The user provides a buffer to store the list and the maximum
#        number of processes that can be returned. If the user sets
#        max_processes to 0, the current total number of processes will
#        replace max_processes param. After that, the function needs to be
#        called again, with updated max_processes, to successfully fill the
#        process list, which was previously allocated with max_processes
# 
#  @note If the reserved size for processes is smaller than the number of
#        actual processes running. The AMDSMI_STATUS_OUT_OF_RESOURCES is
#        an indication the caller should handle the situation (resize).
#        The max_processes is always changed to reflect the actual size of
#        list of processes running, so the caller knows where it is at.
# 
#  @param[in]      processor_handle Device which to query
# 
#  @param[in,out]  max_processes Reference to the size of the list buffer in
#                  number of elements. Returns the return number of elements
#                  in list or the number of running processes if equal to 0,
#                  and if given value in param max_processes is less than
#                  number of processes currently running,
#                  AMDSMI_STATUS_OUT_OF_RESOURCES will be returned.
# 
#                  For cases where max_process is not zero (0), it specifies the list's size limit.
#                  That is, the maximum size this list will be able to hold. After the list is
# built internally, as a return status, we will have AMDSMI_STATUS_OUT_OF_RESOURCES when the
# original size limit is smaller than the actual list of processes running. Hence, the caller is
# aware the list size needs to be resized, or AMDSMI_STATUS_SUCCESS otherwise. Holding a copy of
# max_process before it is passed in will be helpful for monitoring the allocations done upon each
# call since the max_process will permanently be changed to reflect the actual number of processes
# running.
# 
#  @param[out]     list Reference to a user-provided buffer where the process
#                  list will be returned. This buffer must contain at least
#                  max_processes entries of type amd_proc_info_list_t. Must be allocated
#                  by user.
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success,
#                            | ::AMDSMI_STATUS_OUT_OF_RESOURCES, filled list buffer with data, but
# number of actual running processes is larger than the size provided.
cdef amdsmi_status_t amdsmi_get_gpu_process_list(void * processor_handle,uint32_t * max_processes,amdsmi_proc_info_t * list) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get the list of processes running on one or more GPUs, grouped by PID.
# 
#  @details Aggregates per-GPU process lists across all provided processor handles
#  and returns one entry per unique PID. Each entry contains the per-GPU breakdown
#  for every GPU that PID is active on. Results are sorted ascending by PID.
# 
#  @ingroup tagProcessInfo
# 
#  @platform{gpu_bm_linux}
# 
#  @param[in]  processor_handles  Array of processor handles to query
#  @param[in]  num_processors     Number of handles in processor_handles
#  @param[out] procs              Caller-allocated buffer of amdsmi_proc_info_by_pid_t.
#                                 Pass NULL to query the required size via max_processes.
#  @param[in,out] max_processes   On input: capacity of procs. On output: number of
#                                 unique PIDs written (or required if procs is NULL).
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success,
#                            | ::AMDSMI_STATUS_OUT_OF_RESOURCES if max_processes was too small,
#                            | ::AMDSMI_STATUS_INVAL if processor_handles is NULL or num_processors
# is 0
cdef amdsmi_status_t amdsmi_get_gpu_process_list_by_pid(void ** processor_handles,uint32_t num_processors,amdsmi_proc_info_by_pid_t * procs,uint32_t * max_processes) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get PTL enable/disable state
# 
# @ingroup tagPTL
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function retrieves whether PTL (Peak Tops Limiter) is currently
# enabled or disabled for the specified processor. This is a simple state query
# that returns the current PTL operational state without detailed configuration.
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] enabled Pointer to boolean that will be set to true if PTL is
# enabled, false if PTL is disabled
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success,
#         ::AMDSMI_STATUS_NOT_SUPPORTED if PTL is not supported on this device,
#         non-zero on other failures
cdef amdsmi_status_t amdsmi_get_gpu_ptl_state(void * processor_handle,_Bool * enabled) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set PTL enable/disable state
# 
# @ingroup tagPTL
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function enables or disables PTL (Peak Tops Limiter) operation.
# Use amdsmi_set_gpu_ptl_enable_with_formats()
# for more control over the preferred data formats when enabling.
# 
# @param[in] processor_handle Device to configure
# 
# @param[in] enable Boolean flag: true to enable PTL with default formats,
# false to disable PTL
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_gpu_ptl_state(void * processor_handle,_Bool enable) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get PTL (Peak Tops Limiter) formats for the processor
# 
# @ingroup tagPTL
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function retrieves the current PTL formats
# for the specified processor. PTL prevents the product to never deliver more
# than a specified TOPS/second. If function returns 0 for both formats,
# PTL was never enabled before on that system
# 
# @param[in] processor_handle Device which to query
# 
# @param[out] data_format1 Pointer to first preferred data format that receives peak performance
# 
# @param[out] data_format2 Pointer to second preferred data format that receives peak performance
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success,
#         ::AMDSMI_STATUS_NOT_SUPPORTED if PTL is not supported on this device,
#         non-zero on other failures
cdef amdsmi_status_t amdsmi_get_gpu_ptl_formats(void * processor_handle,amdsmi_ptl_data_format_t * data_format1,amdsmi_ptl_data_format_t * data_format2) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set PTL with specified preferred data formats
# 
# @ingroup tagPTL
# 
# @platform{gpu_bm_linux} @platform{host}
# 
# @details This function sets PTL with the specified preferred data format pair.
# PTL must be enabled first before calling this function using amdsmi_set_gpu_ptl_state.
# The two specified formats will receive accurate performance monitoring and peak
# performance. F8 and XF32 formats always receive peak performance regardless of this setting.
# 
# @param[in] processor_handle Device to configure
# 
# @param[in] data_format1 First preferred data format (must be from the limited set:
# I8, F16, BF16, F32, F64)
# 
# @param[in] data_format2 Second preferred data format (must be from the limited set:
# I8, F16, BF16, F32, F64, and different from data_format1)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success,
#         ::AMDSMI_STATUS_NOT_SUPPORTED if PTL is not supported on this device,
#         non-zero on other failures
cdef amdsmi_status_t amdsmi_set_gpu_ptl_formats(void * processor_handle,amdsmi_ptl_data_format_t data_format1,amdsmi_ptl_data_format_t data_format2) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the list of cpu handles in the system.
# 
# @ingroup tagEsmiProcDiscovery
# 
# @platform{cpu_bm}
# 
# @details Depends on AMDSMI_INIT_AMD_CPUS flag passed to ::amdsmi_init.
# The processor handles can be used in other APIs to get processor detail information.
# 
# @param[in,out] cpu_count As input, the value passed
# through this parameter is the number of ::amdsmi_processor_handle that
# may be safely written to the memory pointed to by @p processor_handles. This is the
# limit on how many processor handles will be written to @p processor_handles. On return, @p
# socket_count will contain the number of processor handles written to @p processor_handles,
# or the number of processor handles that could have been written if enough memory had been
# provided.
# If @p processor_handles is NULL, as output, @p cpu_count will contain
# how many processors are available to read in the system.
# 
# @param[in,out] processor_handles A pointer to a block of memory to which the
# ::amdsmi_processor_handle values will be written. This value may be NULL.
# In this case, this function can be used to query how many processors are
# available to read in the system.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_handles(uint32_t * cpu_count,void ** processor_handles) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the list of the cpu core handles in a system.
# 
# @ingroup tagEsmiProcDiscovery
# 
# @platform{cpu_bm}
# 
# @details This function retrieves the cpu core handles of a system.
# 
# @param[in,out] cores_count As input, the value passed
# through this parameter is the number of ::amdsmi_processor_handle's that
# may be safely written to the memory pointed to by @p processor_handles. This is the
# limit on how many core handles will be written to @p processor_handles. On return, @p
# cores_count will contain the number of core processor handles written to @p processor_handles,
# or the number of core processor handles that could have been written if enough memory had been
# provided.
# If @p processor_handles is NULL, as output, @p processor_count will contain
# how many cpu cores are available to read in the system.
# 
# @param[in,out] processor_handles A pointer to a block of memory to which the
# ::amdsmi_processor_handle values will be written. This value may be NULL.
# In this case, this function can be used to query how many processors are
# available to read.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpucore_handles(uint32_t * cores_count,void ** processor_handles) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the core energy for a given core.
# 
# @ingroup tagEsmiEnergyInfo
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu core which to query
# 
# @param[in,out]    penergy - Input buffer to return the core energy
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_core_energy(void * processor_handle,uint64_t * penergy) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the socket energy for a given socket.
# 
# @ingroup tagEsmiEnergyInfo
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]    penergy - Input buffer to return the socket energy
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_energy(void * processor_handle,uint64_t * penergy) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get Number of threads Per Core.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in,out]    threads_per_core - Input buffer to return the Number of threads Per Core
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_threads_per_core(uint32_t * threads_per_core) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get HSMP Driver Version.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# @param[in,out]  amdsmi_hsmp_driver_ver - Input buffer to return the HSMP Driver version
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_hsmp_driver_version(void * processor_handle,amdsmi_hsmp_driver_version_t * amdsmi_hsmp_driver_ver) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get SMU Firmware Version.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# @param[in,out]    amdsmi_smu_fw - Input buffer to return the firmware version
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_smu_fw_version(void * processor_handle,amdsmi_smu_fw_version_t * amdsmi_smu_fw) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get HSMP protocol Version.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# @param[in,out]    proto_ver - Input buffer to return the protocol version
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_hsmp_proto_ver(void * processor_handle,uint32_t * proto_ver) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get normalized status of the processor's PROCHOT status.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]    prochot - Input buffer to return the procohot status.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_prochot_status(void * processor_handle,uint32_t * prochot) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get Data fabric clock and Memory clock in MHz.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]    fclk - Input buffer to return fclk
# 
# @param[in,out]    mclk - Input buffer to return mclk
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_fclk_mclk(void * processor_handle,uint32_t * fclk,uint32_t * mclk) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get core clock in MHz.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]    cclk - Input buffer to return core clock
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_cclk_limit(void * processor_handle,uint32_t * cclk) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get current active frequency limit of the socket.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]    freq - Input buffer to return frequency value in MHz
# 
# @param[in,out]    src_type - Input buffer to return frequency source name
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_current_active_freq_limit(void * processor_handle,uint16_t * freq,char ** src_type) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get socket frequency range.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]    fmax - Input buffer to return maximum frequency
# 
# @param[in,out]    fmin - Input buffer to return minimum frequency
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_freq_range(void * processor_handle,uint16_t * fmax,uint16_t * fmin) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get socket frequency limit of the core.
# 
# @ingroup tagEsmiHSMPSystemStats
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu core which to query
# 
# @param[in,out]    freq - Input buffer to return frequency.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_core_current_freq_limit(void * processor_handle,uint32_t * freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Set CPU rail isolated frequency policy for independent core clock control per power rail
# 
#  This API configures the frequency policy for CPU power rails.
#  - If a socket-wide limit (e.g., PPT) is setting the core clock frequency, this setting has no
# effect.
#  - For other limiters specific to CPU power rails (e.g., TDC),
#    this policy enables or disables independent core clocks per rail (VDDCR_CPU0 or VDDCR_CPU1).
# 
#  Policy values:
#  - 0: Disable independent control (all cores on both rails have the same frequency limit)
#  - 1: Enable independent control (each rail has an independent frequency limit)
# 
#  @ingroup tagEsmiHSMPSystemStats
# 
#  @platform{cpu_bm}
# 
#  @param[in]	processor_handle Cpu socket which to query
# 
#  @param[in,out]  rail_isofreq_policy - Input buffer to store policy value, indicating the CPU
#                                        rail ISO frequency Policy setting:
#                        - 0: Disable independent control - each rail has its own independent
#                             frequency limit.
#                        - 1: Enable independent control - all cores on both rails share the same
#                             frequency limit.
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_rail_isofreq_policy(void * processor_handle,_Bool * rail_isofreq_policy) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get CPU rail isolated frequency policy status for independent core clock control per
# power rail.
# 
# This API retrieves the current frequency policy configuration for CPU power rails.
#  - If a socket-wide limit (e.g., PPT) is setting the core clock frequency, the effective policy
# may be overridden.
#  - For other limiters specific to CPU power rails (e.g., TDC),
#    this policy indicates whether independent core clocks per rail (VDDCR_CPU0 or VDDCR_CPU1) are
# enabled or disabled.
# 
#  Policy values returned:
#  - 0: Independent control disabled (all cores on both rails have the same frequency limit)
#  - 1: Independent control enabled (each rail has an independent frequency limit)
# 
#  @ingroup tagEsmiHSMPSystemStats
# 
#  @platform{cpu_bm}
# 
#  @param[in]      processor_handle Cpu socket which to query
# 
#  @param[in,out]  rail_isofreq_policy - Input buffer to receive the current cpu rail isolated
#                                        frequency policy
# 
#  @return ::amdsmi_status_t
#          ::AMDSMI_STATUS_SUCCESS on success, non-zero on failure
cdef amdsmi_status_t amdsmi_get_cpu_rail_isofreq_policy(void * processor_handle,uint8_t * rail_isofreq_policy) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Set the DFCState enabling control.
# 
#  DFCState control values for setting:
#  - 0: Disable DFC control
#  - 1: Enable DFC control
# 
#  @ingroup tagEsmiDFCEnableControl
# 
#  @platform{cpu_bm}
# 
#  @param[in]	processor_handle Cpu socket handle to query
# 
#  @param[in]  dfc_ctrl - Input buffer indicating whether to enable (1) or disable (0) DFCState
# control
# 
#  @return ::amdsmi_status_t
#          ::AMDSMI_STATUS_SUCCESS on success, non-zero on failure
cdef amdsmi_status_t amdsmi_set_cpu_dfc_ctrl(void * processor_handle,uint8_t * dfc_ctrl) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the current DFCState enabling control status.
# 
# Returned DFCState control values:
# - 0: DFC control is disabled
# - 1: DFC control is enabled
# 
# @ingroup tagEsmiDFCEnableControl
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket handle to query
# 
# @param[in,out]  dfc_ctrl - Input buffer to receive the current DFCState control status
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on success, non-zero on failure
cdef amdsmi_status_t amdsmi_get_cpu_dfc_ctrl(void * processor_handle,uint8_t * dfc_ctrl) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the core boost limit.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]     processor_handle Cpu core which to query
# 
# @param[in,out] pboostlimit - Input buffer to fill the boostlimit value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_core_boostlimit(void * processor_handle,uint32_t * pboostlimit) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the socket c0 residency.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]     processor_handle Cpu socket which to query
# 
# @param[in,out] pc0_residency - Input buffer to fill the c0 residency value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_c0_residency(void * processor_handle,uint32_t * pc0_residency) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the core boostlimit value.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in] processor_handle Cpu core which to query
# 
# @param[in] boostlimit - boostlimit value to be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_core_boostlimit(void * processor_handle,uint32_t boostlimit) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the socket boostlimit value.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in] processor_handle Cpu socket which to query
# 
# @param[in] boostlimit - boostlimit value to be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_socket_boostlimit(void * processor_handle,uint32_t boostlimit) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the CPU core floor limit frequency.
# 
# @details This function retrieves the floor frequency limit for the specified CPU core.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle CPU core which to query
# 
# @param[in,out]  floor_freq - Input buffer to fill the floor limit frequency in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_core_floor_freq_limit(void * processor_handle,uint32_t * floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the CPU floor limit frequency.
# 
# @details This function retrieves the floor frequency limit for the specified CPU socket.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle CPU socket which to query
# 
# @param[in,out]  floor_freq - Input buffer to fill the floor limit frequency in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_floor_freq_limit(void * processor_handle,uint32_t * floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the CPU core effective floor limit frequency.
# 
# @details This function returns the effective floor frequency limit for the specified CPU core.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle CPU core which to query
# 
# @param[in,out]  eff_floor_freq - Input buffer to fill the effective floor limit frequency in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_core_eff_floor_freq_limit(void * processor_handle,uint32_t * eff_floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the CPU effective floor limit frequency.
# 
# @details This function returns the effective floor frequency limit for the specified CPU socket.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle CPU socket which to query
# 
# @param[in,out]  eff_floor_freq - Input buffer to fill the effective floor limit frequency in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_eff_floor_freq_limit(void * processor_handle,uint32_t * eff_floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the CPU core floor limit frequency.
# 
# @details This function sets the floor frequency limit for the specified CPU core.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle CPU core which to set
# 
# @param[in]  floor_freq - floor limit frequency value to be set in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_core_floor_freq_limit(void * processor_handle,uint32_t floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the CPU socket floor limit frequency.
# 
# @details This function sets the floor frequency limit for the specified CPU socket.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle CPU socket which to set
# 
# @param[in]  floor_freq - floor limit frequency value to be set in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_floor_freq_limit(void * processor_handle,uint32_t floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Set CPU floor limit frequency via MSR(Model Specific Register).
# 
#  @details This function sets the floor frequency limit via MSR(Model Specific Register) for the
# specified CPU socket.
# 
#  @ingroup tagEsmiPerfControl
# 
#  @platform{cpu_bm}
# 
#  @param[in]  processor_handle CPU socket which to set
# 
#  @param[in]  msr_floor_freq - MSR floor limit frequency value to be set in MHz
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_msr_floor_freq_limit(void * processor_handle,uint32_t msr_floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set CPU core MSR floor limit frequency.
# 
# @details This function sets the MSR floor frequency limit for the specified CPU core.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle CPU core which to set
# 
# @param[in]  msr_floor_freq - MSR floor limit frequency value to be set in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_core_msr_floor_freq_limit(void * processor_handle,uint32_t msr_floor_freq) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the CPU socket frequency range.
# 
# @details This function retrieves frequency limit range for CPU socket 0.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[out]  fmax - Output buffer to retrieve maximum frequency in MHz
# @param[out]  fmin - Output buffer to retrieve minimum frequency in MHz
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_freq_range(uint32_t * fmax,uint32_t * fmin) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the SDPS(Socket DIMM Power Sloshing) limit for a given processor socket.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Processor handle for which to set the limit
# 
# @param[in]  sdps_limit - SDPS limit value in milliwatts
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_sdps_limit(void * processor_handle,uint32_t sdps_limit) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the current SDPS limit for a given processor socket.
# 
# @ingroup tagEsmiPerfControl
# 
# @platform{cpu_bm}
# 
# @param[in]   processor_handle Processor handle for which to query the limit
# @param[out]  sdps_limit - Input buffer to receive the current SDPS limit value in
#                           milliwatts (mW)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_sdps_limit(void * processor_handle,uint32_t * sdps_limit) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the DDR bandwidth data.
# 
# @ingroup tagEsmiDDRBandwidthMonitor
# 
# @platform{cpu_bm}
# 
# @param[in]     processor_handle Cpu socket which to query
# 
# @param[in,out] ddr_bw - Input buffer to fill ddr bandwidth data
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_ddr_bw(void * processor_handle,amdsmi_ddr_bw_metrics_t * ddr_bw) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get socket temperature.
# 
# @ingroup tagEsmiTempQuery
# 
# @platform{cpu_bm}
# 
# @param[in]     processor_handle Cpu socket which to query
# 
# @param[in,out] ptmon - Input buffer to fill temperature value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_temperature(void * processor_handle,uint32_t * ptmon) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Read Thermal Delta (TDELTA) Behavior
# 
# This API retrieves the thermal solution behavior value from the CPU socket
# 
# Thermal Behavior values returned:
# - 0: Thermal solution behavior is normal (operating within expected thermal range)
# - 1 or any other value: Thermal solution is out of expected range (thermal stress detected)
# 
# @ingroup tagEsmiTempQuery
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle CPU socket handle to query
# @param[out]  tdelta - input buffer to store the thermal delta behavior value:
# 				- 0: Normal thermal solution behavior
# 				- Non-zero: Thermal solution out of expected range
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on successful register read, non-zero on failure
cdef amdsmi_status_t amdsmi_get_cpu_tdelta(void * processor_handle,uint8_t * tdelta) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get Temperature of SVI3 VR(Voltage Rail)
# 
#  This API retrieves the temperature of SVI3 voltage regulator
# 
#  @ingroup tagEsmiTempQuery
# 
#  @platform{cpu_bm}
# 
#  @param[in]      processor_handle CPU socket handle to query
# 
#  @param[in,out]  rail_selection - Input buffer to to store rail_selection, rail_selection:
# 0=HottestRail, 1=IndividualRail
# 
#  @param[in,out]  rail_index - Input buffer to store rail_index, rail_index must be given when
# rail_selection = 1 rail_index: 0->VDDCR_CPU0,1->VDDCR_CPU1,2->VDDCR_SOC,3->VDDIO,4->VDDIO_MEM_S3
# 
#  @param[out]     temp - Output buffer to retrieve the temperature value
# 
#  @return ::amdsmi_status_t
#          ::AMDSMI_STATUS_SUCCESS on successful temperature read, non-zero on failure
cdef amdsmi_status_t amdsmi_get_cpu_svi3_vr_controller_temp(void * processor_handle,uint32_t * rail_selection,uint32_t * rail_index,uint32_t * temp) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get DIMM temperature range and refresh rate.
# 
# @ingroup tagEsmiDimmStatistics
# 
# @platform{cpu_bm}
# 
# @param[in]     processor_handle Cpu socket which to query
# 
# @param[in]     dimm_addr - DIMM address
# 
# @param[in,out] rate - Input buffer to fill temperature range and refresh rate value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_dimm_temp_range_and_refresh_rate(void * processor_handle,uint8_t dimm_addr,amdsmi_temp_range_refresh_rate_t * rate) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get DIMM power consumption.
# 
# @ingroup tagEsmiDimmStatistics
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# @param[in]      dimm_addr - DIMM address
# @param[in,out]  dimm_pow - Input buffer to fill power consumption value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_dimm_power_consumption(void * processor_handle,uint8_t dimm_addr,amdsmi_dimm_power_t * dimm_pow) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get DIMM thermal sensor value.
# 
# @ingroup tagEsmiDimmStatistics
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in]     dimm_addr - DIMM address
# 
# @param[in,out] dimm_temp - Input buffer to fill temperature value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_dimm_thermal_sensor(void * processor_handle,uint8_t dimm_addr,amdsmi_dimm_thermal_t * dimm_temp) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Read DIMM sideband register data
# 
# @ingroup tagEsmiDimmStatistics
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Processor handle for the target socket
# 
# @param[in]  dimm_addr - DIMM address
# 
# @param[in]  lid - The local identifier of the device on DIMM
# 
# @param[in]  reg_offset - Register offset within the specified register space
# 
# @param[in]  reg_space - Register space selector:
# 				- 0: Volatile register space
# 				- 1: Non-volatile memory (NVM) register space
# 
# @param[out] data - Input buffer to store the 4-byte read data from the register
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on successful register read, non-zero on failure
cdef amdsmi_status_t amdsmi_get_cpu_dimm_sb_reg(void * processor_handle,uint32_t dimm_addr,uint32_t lid,uint32_t reg_offset,uint32_t reg_space,uint32_t * data) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Write Data to DIMM Sideband Register
# 
# @ingroup tagEsmiDimmStatistics
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Processor handle for the target socket
# 
# @param[in]  dimm_addr - DIMM address
# 
# @param[in]  lid - The local identifier of the device on DIMM
# 
# @param[in]  reg_offset - Register offset within the specified register space
# 
# @param[in]  reg_space - Register space selector:
# 				- 0: Volatile register space
# 				- 1: Non-volatile memory (NVM) register space
# 
# @param[in]  write_data - 4-byte data value to write to the target register
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on successful register write, non-zero on failure
cdef amdsmi_status_t amdsmi_set_cpu_dimm_sb_reg(void * processor_handle,uint32_t dimm_addr,uint32_t lid,uint32_t reg_offset,uint32_t reg_space,uint32_t write_data) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set xgmi width.
# 
# @ingroup tagEsmiXGMIBandwidthCont
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to query
# 
# @param[in]  min - Minimum xgmi width to be set
# 
# @param[in]  max - maximum xgmi width to be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_xgmi_width(void * processor_handle,uint8_t min,uint8_t max) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set gmi3 link width range.
# 
# @ingroup tagEsmiGMI3WidthCont
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to query
# 
# @param[in]  min_link_width - minimum link width to be set.
# 
# @param[in]  max_link_width - maximum link width to be set.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_gmi3_link_width_range(void * processor_handle,uint8_t min_link_width,uint8_t max_link_width) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Enable APB.
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_cpu_apb_enable(void * processor_handle) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Disable APB.
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to query
# 
# @param[in]  pstate - pstate value to be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_cpu_apb_disable(void * processor_handle,uint8_t pstate) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set NBIO lclk dpm level value.
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to query
# 
# @param[in]  nbio_id - nbio index
# 
# @param[in]  min - minimum value to be set
# 
# @param[in]  max - maximum value to be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_socket_lclk_dpm_level(void * processor_handle,uint8_t nbio_id,uint8_t min,uint8_t max) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get NBIO LCLK dpm level.
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in]      nbio_id - nbio index
# 
# @param[in,out]  nbio - Input buffer to fill lclk dpm level
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_lclk_dpm_level(void * processor_handle,uint8_t nbio_id,amdsmi_dpm_level_t * nbio) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set pcie link rate.
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in]      rate_ctrl - rate control value to be set.
# 
# @param[in,out]  prev_mode - Input buffer to fill previous rate control value.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_pcie_link_rate(void * processor_handle,uint8_t rate_ctrl,uint8_t * prev_mode) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set df pstate range.
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to query
# 
# @param[in]  min_pstate - minimum pstate value to be set
# 
# @param[in]  max_pstate - maximum pstate value to be set
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_df_pstate_range(void * processor_handle,uint8_t min_pstate,uint8_t max_pstate) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the Min and Max XGMI PState Range
# 
# This API configures the XGMI P-State range for the specified processor socket.
# 
# P-State range constraints:
# - min_pstate: Minimum allowed XGMI P-State
# - max_pstate: Maximum allowed XGMI P-State
# - Constraint: max_pstate <= min_pstate
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to configure
# 
# @param[in]  min_pstate - minimum XGMI P-State value
# 
# @param[in]  max_pstate - maximum XGMI P-State value
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_xgmi_pstate_range(void * processor_handle,uint8_t min_pstate,uint8_t max_pstate) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get the Max and Min XGMI PState Range
# 
#  This API retrieves the current XGMI P-State range configuration for the specified processor
# socket.
# 
#  P-State range values returned:
#  - min_pstate: Current minimum XGMI P-State setting
#  - max_pstate: Current maximum XGMI P-State setting
#  - Relationship: max_pstate <= min_pstate
# 
#  @ingroup tagEsmiPstateSelect
# 
#  @platform{cpu_bm}
# 
#  @param[in]  processor_handle Cpu socket which to query
# 
#  @param[out]  min_pstate - Input buffer to store current minimum XGMI P-State value
# 
#  @param[out]  max_pstate - Input buffer to store current maximum XGMI P-State value
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_xgmi_pstate_range(void * processor_handle,uint8_t * min_pstate,uint8_t * max_pstate) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get the PC6 Enable State
# 
#  This API retrieves the current PC6 (Package C-state 6) enable state for the specified processor
# socket.
# 
#  PC6 enable state values returned:
#  - 0: PC6 disabled
#  - 1: PC6 enabled
# 
#  @ingroup tagEsmiPstateSelect
# 
#  @platform{cpu_bm}
# 
#  @param[in]  processor_handle Cpu socket which to query
# 
#  @param[out]  enabled - Input buffer to store the current PC6 enable state
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_pc6_enable(void * processor_handle,uint8_t * enabled) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the PC6 Enable State
# 
# This API configures the PC6 (Package C-state 6) enable state for the specified processor socket.
# 
# PC6 enable state values:
# - 0: PC6 disabled
# - 1: PC6 enabled
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to configure
# 
# @param[in]  enable - PC6 enable state (0=disable, 1=enable)
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_pc6_enable(void * processor_handle,uint8_t enable) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get the Core C6 Enable State.
# 
# This API retrieves the Core C6 (CC6) low-power state for the specified processor socket.
# 
# CC6 enable state values returned:
# - 0: CC6 state disabled
# - 1: CC6 state enabled
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]  enabled - Input buffer to store the current CC6 enable state
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on success, non-zero on failure
cdef amdsmi_status_t amdsmi_get_cpu_cc6_enable(void * processor_handle,uint8_t * enabled) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set the Core C6 Enable State.
# 
# This API configures the Core C6 (CC6) low-power state for the specified processor socket.
# 
# CC6 enable state values:
# - 0: Disable CC6 state
# - 1: Enable CC6 state
# 
# @ingroup tagEsmiPstateSelect
# 
# @platform{cpu_bm}
# 
# @param[in]  processor_handle Cpu socket which to configure
# 
# @param[in]  enable - CC6 enable state value:
# 			- 0: Disable CC6 low-power state
# 			- 1: Enable CC6 low-power state
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_set_cpu_cc6_enable(void * processor_handle,uint8_t enable) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get current input output bandwidth.
# 
# @ingroup tagEsmiBandwidthMon
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in]      link - link id and bw type to which io bandwidth to be obtained
# 
# @param[in,out]  io_bw - Input buffer to fill bandwidth data
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_current_io_bandwidth(void * processor_handle,amdsmi_link_id_bw_type_t link,uint32_t * io_bw) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get current input output bandwidth.
# 
# @ingroup tagEsmiBandwidthMon
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in]      link - link id and bw type to which xgmi bandwidth to be obtained
# 
# @param[in,out]  xgmi_bw - Input buffer to fill bandwidth data
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_current_xgmi_bw(void * processor_handle,amdsmi_link_id_bw_type_t link,uint32_t * xgmi_bw) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get HSMP metrics table version
# 
# @ingroup tagEsmiHSMPMetricsTable
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]  metrics_version input buffer to return the HSMP metrics table version.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_hsmp_metrics_table_version(void * processor_handle,uint32_t * metrics_version) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get HSMP metrics table
# 
# @ingroup tagEsmiHSMPMetricsTable
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]  metrics_table input buffer to return the HSMP metrics table.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_hsmp_metrics_table(void * processor_handle,amdsmi_hsmp_metrics_table_t * metrics_table) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get first online core on socket.
# 
# @ingroup tagEsmiCPUAuxiliary
# 
# @platform{cpu_bm}
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[in,out]  pcore_ind - Input buffer to fill first online core on socket data
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_first_online_core_on_cpu_socket(void * processor_handle,uint32_t * pcore_ind) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get CPU family.
# 
# @ingroup tagEsmiCPUAuxiliary
# 
# @platform{cpu_bm}
# 
# @param[in,out]  cpu_family - Input buffer to return the cpu family
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_family(uint32_t * cpu_family) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get CPU model.
# 
# @ingroup tagEsmiCPUAuxiliary
# 
# @platform{cpu_bm}
# 
# @param[in,out]  cpu_model - Input buffer to return the cpu model
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_model(uint32_t * cpu_model) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve the CPU processor model name based on the processor index.
# 
# @ingroup tagEsmiCPUAuxiliary
# 
# @platform{cpu_bm}
# 
# @details
# This function obtains the CPU model name associated with the specified processor index
# from the list of available processor handles. Before invoking this function, ensure that
# the list of processor handles is properly initialized and that the processor type is specified.
# This function is to be utilized for RDC and is not part of ESMI library.
# 
# @param[in]      processor_handle Cpu socket which to query
# 
# @param[out] cpu_info
#     A pointer to an `amdsmi_cpu_info_t` structure that will be populated with the
#     CPU processor model information upon successful execution of the function.
# 
# @return
#     ::amdsmi_status_t indicating the result of the operation.
#     - ::AMDSMI_STATUS_SUCCESS on successful retrieval of the model name.
#     - A non-zero error code if the operation fails.
cdef amdsmi_status_t amdsmi_get_cpu_model_name(void * processor_handle,amdsmi_cpu_info_t * cpu_info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get a description of provided AMDSMI error status for esmi errors.
# 
# @ingroup tagEsmiCPUAuxiliary
# 
# @platform{cpu_bm}
# 
# @details Set the provided pointer to a const char *, @p status_string, to
# a string containing a description of the provided error code @p status.
# 
# @param[in]    status - The error status for which a description is desired.
# 
# @param[in,out]    status_string - A pointer to a const char * which will be made
# to point to a description of the provided error code
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_esmi_err_msg(amdsmi_status_t status,const char ** status_string) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get cpu cores per socket from sys filesystem.
# 
# @ingroup tagEsmiCPUAuxiliary
# 
# @platform{cpu_bm}
# 
# @param[in]  sock_count - cpu socket count
# @param[in,out]  soc_info - Input buffer to return the cpu cores per socket
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_cores_per_socket(uint32_t sock_count,amdsmi_sock_info_t * soc_info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get CPU socket count from sys filesystem.
# 
# @ingroup tagEsmiCPUAuxiliary
# 
# @platform{cpu_bm}
# 
# @param[in,out]  sock_count - Input buffer to return the cpu socket count
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_socket_count(uint32_t * sock_count) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
#  @brief Get HSMP Enabled Commands information for a given CPU socket.
# 
#  @details This function retrieves enabled commands bit masks for both read and write commands
#  from the HSMP interface.
# 
#  @ingroup tagEsmiCPUAuxiliary
# 
#  @platform{cpu_bm}
# 
#  @param[in]  processor_handle CPU socket handle to query
#  @param[in]  r_mask - Input buffer to store read mask, indicating read or write enabled commands
# to query
#  @param[in,out]  mask0 - Input buffer to store read/write enabled hsmp command mask0
#  @param[in,out]  mask1 - Input buffer to store read/write enabled hsmp command mask1
#  @param[in,out]  mask2 - Input buffer to store read/write enabled hsmp command mask2
# 
#  @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_cpu_enabled_commands(void * processor_handle,_Bool * r_mask,uint32_t * mask0,uint32_t * mask1,uint32_t * mask2) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves information about the NIC driver
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# @param[in] processor_handle NIC for which to query
# 
# @param[out] info reference to the nic driver info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_driver_info(void * processor_handle,amdsmi_nic_driver_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves ASIC information for the NIC
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# @param[in] processor_handle NIC for which to query
# 
# @param[out] info reference to the nic asic info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_asic_info(void * processor_handle,amdsmi_nic_asic_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves BUS information for the NIC
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# @param[in] processor_handle NIC for which to query
# 
# @param[out] info reference to the nic bus info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_bus_info(void * processor_handle,amdsmi_nic_bus_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves NUMA information for the NIC
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# @param[in] processor_handle NIC for which to query
# 
# @param[out] info reference to the nic numa info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_numa_info(void * processor_handle,amdsmi_nic_numa_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves PORT information for the NIC
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# @param[in] processor_handle NIC for which to query
# 
# @param[out] info reference to the nic port info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_port_info(void * processor_handle,amdsmi_nic_port_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves RDMA devices information for the NIC
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# @param[in] processor_handle NIC for which to query
# 
# @param[out] info reference to the nic rdma devices info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_rdma_dev_info(void * processor_handle,amdsmi_nic_rdma_devices_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve RDMA port statistics for the NIC
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# This function follows a two-call pattern:
# 1. First call with stats=NULL to get the count of available statistics
# 2. Second call with allocated array to retrieve all statistics
# 
# @param[in] processor_handle NIC for which to query
# @param[in] rdma_port_index index of the NIC RDMA port to query
# @param[in,out] num_stats pointer to the number of statistics
#   - Input: maximum number of statistics that stats array can hold
#   - Output: actual number of statistics available/returned
# @param[out] stats pointer to array of amdsmi_nic_stat_t structures to be filled
#   - If NULL, only num_stats is filled with the count of available statistics
#   - If not NULL, must be allocated by user with at least num_stats elements
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_rdma_port_statistics(void * processor_handle,uint32_t rdma_port_index,uint32_t * num_stats,amdsmi_nic_stat_t * stats) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieves firmware version information for the NIC
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# @note This API depends on libmnl. If libmnl is not installed on the
# system, this function returns ::AMDSMI_STATUS_NOT_SUPPORTED.
# 
# @param[in] processor_handle NIC for which to query
# 
# @param[out] info reference to the nic firmware info struct.
# Must be allocated by user.
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_fw_info(void * processor_handle,amdsmi_nic_fw_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve PORT statistics for the specified NIC port
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# This function follows a two-call pattern:
# 1. First call with stats=NULL to get the count of available statistics
# 2. Second call with allocated array to retrieve all statistics
# 
# @param[in] processor_handle NIC for which to query
# @param[in] port_index index of the NIC port to query
# @param[in,out] num_stats pointer to the number of statistics
#   - Input: maximum number of statistics that stats array can hold
#   - Output: actual number of statistics available/returned
# @param[out] stats pointer to array of amdsmi_nic_stat_t structures to be filled
#   - If NULL, only num_stats is filled with the count of available statistics
#   - If not NULL, must be allocated by user with at least num_stats elements
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_port_statistics(void * processor_handle,uint32_t port_index,uint32_t * num_stats,amdsmi_nic_stat_t * stats) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Retrieve vendor specific statistics for the NIC port
# 
# @ingroup tagNicInfo
# 
# @platform{host} @platform{gpu_bm_linux}
# 
# This function follows a two-call pattern:
# 1. First call with stats=NULL to get the count of available statistics
# 2. Second call with allocated array to retrieve all statistics
# 
# This API provides access to vendor/driver specific statistics that may vary
# between different NIC vendors and driver/fw versions. The statistic names are
# preserved as provided by the underlying driver implementation.
# 
# @param[in] processor_handle NIC for which to query
# @param[in] port_index index of the NIC port to query
# @param[in,out] num_stats pointer to the number of statistics
#   - Input: maximum number of statistics that stats array can hold
#   - Output: actual number of statistics available/returned
# @param[out] stats pointer to array of amdsmi_nic_stat_t structures to be filled
#   - If NULL, only num_stats is filled with the count of available statistics
#   - If not NULL, must be allocated by user with at least num_stats elements
# 
# @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
cdef amdsmi_status_t amdsmi_get_nic_vendor_statistics(void * processor_handle,uint32_t port_index,uint32_t * num_stats,amdsmi_nic_stat_t * stats) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


cdef extern from "amd_smi/amdsmi.h":

    ctypedef struct amdsmi_uma_carveout_option_t:
        uint32_t index
        char description[256]

    ctypedef struct amdsmi_uma_carveout_info_t:
        uint32_t current_index
        uint32_t num_options
        amdsmi_uma_carveout_option_t options[16]

    ctypedef struct amdsmi_ttm_info_t:
        uint64_t current_pages

# 
# @brief Get UMA carveout configuration information
# 
# This function retrieves the current UMA (Unified Memory Architecture) carveout
# configuration for the specified GPU. UMA carveout controls dedicated GPU memory
# allocation on APU systems.
# 
# @note This uses a kernel UAPI sysfs interface, not libdrm.
# 
# @ingroup tagMemConfig
# 
# @platform{gpu_bm_linux}
# 
# @param[in] processor_handle GPU device handle
# @param[out] info Pointer to receive UMA carveout information
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on success
#         ::AMDSMI_STATUS_NOT_SUPPORTED if UMA carveout is not available on this device
#         ::AMDSMI_STATUS_INVAL if info is nullptr
cdef amdsmi_status_t amdsmi_get_gpu_uma_carveout_info(void * processor_handle,amdsmi_uma_carveout_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set UMA carveout configuration
# 
# This function sets the UMA carveout configuration for the specified GPU.
# The system must be rebooted for changes to take effect.
# 
# @note This uses a kernel UAPI sysfs interface, not libdrm.
# 
# @ingroup tagMemConfig
# 
# @platform{gpu_bm_linux}
# 
# @param[in] processor_handle GPU device handle
# @param[in] option_index Index of the carveout option to set
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on success
#         ::AMDSMI_STATUS_NOT_SUPPORTED if UMA carveout is not available on this device
#         ::AMDSMI_STATUS_NO_PERM if insufficient permissions
#         ::AMDSMI_STATUS_INVAL if option_index is out of range
cdef amdsmi_status_t amdsmi_set_gpu_uma_carveout(void * processor_handle,uint32_t option_index) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Get TTM configuration information
# 
# This function retrieves the current TTM (Translation Table Manager) pages limit.
# TTM controls shared GPU memory (GTT) allocation.
# 
# @note This uses a kernel UAPI interface (modprobe.d), not libdrm.
# 
# @ingroup tagMemConfig
# 
# @platform{gpu_bm_linux}
# 
# @param[out] info Pointer to receive TTM configuration information
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on success
#         ::AMDSMI_STATUS_NOT_SUPPORTED if TTM configuration is not available
#         ::AMDSMI_STATUS_INVAL if info is nullptr
cdef amdsmi_status_t amdsmi_get_ttm_info(amdsmi_ttm_info_t * info) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Set TTM pages limit
# 
# This function configures the TTM pages limit by creating/updating
# /etc/modprobe.d/ttm.conf. The system must be rebooted for changes to take effect.
# 
# @note This uses a kernel UAPI interface (modprobe.d), not libdrm.
# 
# @ingroup tagMemConfig
# 
# @platform{gpu_bm_linux}
# 
# @param[in] pages Number of pages to allocate for TTM
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on success
#         ::AMDSMI_STATUS_NO_PERM if insufficient permissions
#         ::AMDSMI_STATUS_INVAL if pages is 0
cdef amdsmi_status_t amdsmi_set_ttm_pages_limit(uint64_t pages) except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


# 
# @brief Reset TTM pages limit to system default
# 
# This function resets the TTM pages limit to system default by removing
# /etc/modprobe.d/ttm.conf. The system must be rebooted for changes to take effect.
# 
# @note This uses a kernel UAPI interface (modprobe.d), not libdrm.
# 
# @ingroup tagMemConfig
# 
# @platform{gpu_bm_linux}
# 
# @return ::amdsmi_status_t
#         ::AMDSMI_STATUS_SUCCESS on success
#         ::AMDSMI_STATUS_NO_PERM if insufficient permissions
cdef amdsmi_status_t amdsmi_reset_ttm_pages_limit() except? AMDSMI_STATUS_INTERNAL_EXCEPTION nogil


cdef bint __amdsmi_has_symbol(const char* name) noexcept nogil