Furiosa-smi
Loading...
Searching...
No Matches
furiosa_smi.h File Reference
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
Include dependency graph for furiosa_smi.h:

Go to the source code of this file.

Data Structures

struct  FuriosaSmiDeviceHandles
 Represent a device handle list in the system. More...
 
struct  FuriosaSmiVersion
 Represent the version of device component. More...
 
struct  FuriosaSmiDeviceInfo
 Represent a device information. More...
 
struct  FuriosaSmiDeviceFile
 Represent a device file information. More...
 
struct  FuriosaSmiDeviceFiles
 Represent a device file list of device. More...
 
struct  FuriosaSmiPeStatus
 
struct  FuriosaSmiCoreStatuses
 Represent a core status list of device. More...
 
struct  FuriosaSmiPeFrequency
 
struct  FuriosaSmiCoreFrequency
 Represent a core frequency information (MHz). More...
 
struct  FuriosaSmiMemoryFrequency
 Represent a memory frequency information (MHz). More...
 
struct  FuriosaSmiPePerformanceCounter
 Represent a PE performance counter. More...
 
struct  FuriosaSmiDevicePerformanceCounter
 Represent a device performance counter. More...
 
struct  FuriosaSmiDevicePowerConsumption
 Represent a power consumption of device. More...
 
struct  FuriosaSmiDeviceTemperature
 Represent a temperature information of device. More...
 
struct  FuriosaSmiDisabledDevices
 
struct  FuriosaSmiPcieDeviceInfo
 Represent a PCIe device information. More...
 
struct  FuriosaSmiPcieLinkInfo
 Represent a PCIe link information. More...
 
struct  FuriosaSmiSriovInfo
 Represent a SR-IOV information. More...
 
struct  FuriosaSmiPcieRootComplexInfo
 Represent a PCIe root complex information. More...
 
struct  FuriosaSmiPcieSwitchInfo
 Represent a PCIe switch information. If switch doesn't exist, all values are max value. More...
 

Macros

#define FURIOSA_SMI_MAX_PATH_SIZE   256
 
#define FURIOSA_SMI_MAX_DEVICE_FILE_SIZE   64
 
#define FURIOSA_SMI_MAX_CORE_STATUS_SIZE   128
 
#define FURIOSA_SMI_MAX_PE_SIZE   64
 
#define FURIOSA_SMI_MAX_DEVICE_HANDLE_SIZE   64
 
#define FURIOSA_SMI_MAX_CSTR_SIZE   96
 

Typedefs

typedef uint32_t FuriosaSmiDeviceHandle
 
typedef char FuriosaSmiBdf[FURIOSA_SMI_MAX_CSTR_SIZE]
 

Enumerations

enum  FuriosaSmiArch { FURIOSA_SMI_ARCH_WARBOY = 0 , FURIOSA_SMI_ARCH_RNGD , FURIOSA_SMI_ARCH_RNGD_MAX , FURIOSA_SMI_ARCH_RNGD_S }
 Represent an architecture type of device. More...
 
enum  FuriosaSmiCoreStatus { FURIOSA_SMI_CORE_STATUS_AVAILABLE = 0 , FURIOSA_SMI_CORE_STATUS_OCCUPIED }
 Represent a core status. More...
 
enum  FuriosaSmiDeviceToDeviceLinkType {
  FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_UNKNOWN = 0 , FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_INTERCONNECT = 10 , FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_CPU = 20 , FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_BRIDGE = 30 ,
  FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_NOC = 70
}
 Represent a device link type. More...
 
enum  FuriosaSmiGovernorProfile { FURIOSA_SMI_GOVERNOR_PROFILE_PERFORMANCE = 0 , FURIOSA_SMI_GOVERNOR_PROFILE_POWER_SAVE }
 Represent a governor profile. More...
 
enum  FuriosaSmiReturnCode {
  FURIOSA_SMI_RETURN_CODE_OK = 0 , FURIOSA_SMI_RETURN_CODE_INVALID_ARGUMENT_ERROR , FURIOSA_SMI_RETURN_CODE_NULL_POINTER_ERROR , FURIOSA_SMI_RETURN_CODE_MAX_BUFFER_SIZE_EXCEED_ERROR ,
  FURIOSA_SMI_RETURN_CODE_DEVICE_NOT_FOUND_ERROR , FURIOSA_SMI_RETURN_CODE_DEVICE_LOST_ERROR , FURIOSA_SMI_RETURN_CODE_DEVICE_BUSY_ERROR , FURIOSA_SMI_RETURN_CODE_IO_ERROR ,
  FURIOSA_SMI_RETURN_CODE_PERMISSION_DENIED_ERROR , FURIOSA_SMI_RETURN_CODE_UNKNOWN_ARCH_ERROR , FURIOSA_SMI_RETURN_CODE_INCOMPATIBLE_DRIVER_ERROR , FURIOSA_SMI_RETURN_CODE_UNEXPECTED_VALUE_ERROR ,
  FURIOSA_SMI_RETURN_CODE_PARSE_ERROR , FURIOSA_SMI_RETURN_CODE_UNKNOWN_ERROR , FURIOSA_SMI_RETURN_CODE_INTERNAL_ERROR , FURIOSA_SMI_RETURN_CODE_UNINITIALIZED_ERROR ,
  FURIOSA_SMI_RETURN_CODE_CONTEXT_ERROR , FURIOSA_SMI_RETURN_CODE_NOT_SUPPORTED_ERROR
}
 Represent a return status. More...
 

Functions

FuriosaSmiReturnCode furiosa_smi_init (void)
 Initialize Furiosa SMI library.
 
FuriosaSmiReturnCode furiosa_smi_get_device_handles (FuriosaSmiDeviceHandles *out_handles)
 Get all device handles of Furiosa NPU devices in the system.
 
FuriosaSmiReturnCode furiosa_smi_get_device_handle_by_uuid (const char *uuid, FuriosaSmiDeviceHandle *out_handle)
 Get a device handle of Furiosa NPU device by uuid.
 
FuriosaSmiReturnCode furiosa_smi_get_device_handle_by_serial (const char *serial, FuriosaSmiDeviceHandle *out_handle)
 Get a device handle of Furiosa NPU device by serial.
 
FuriosaSmiReturnCode furiosa_smi_get_device_handle_by_bdf (const char *bdf, FuriosaSmiDeviceHandle *out_handle)
 Get a device handle of Furiosa NPU device by bdf.
 
FuriosaSmiReturnCode furiosa_smi_get_device_info (FuriosaSmiDeviceHandle handle, FuriosaSmiDeviceInfo *out_device_info)
 Get a device information of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_device_files (FuriosaSmiDeviceHandle handle, FuriosaSmiDeviceFiles *out_device_files)
 Get a device file list of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_device_core_status (FuriosaSmiDeviceHandle handle, FuriosaSmiCoreStatuses *out_core_status)
 Get a core status list of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_device_liveness (FuriosaSmiDeviceHandle handle, bool *out_liveness)
 Get a liveness of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_device_to_device_link_type (FuriosaSmiDeviceHandle handle1, FuriosaSmiDeviceHandle handle2, FuriosaSmiDeviceToDeviceLinkType *out_link_type)
 Get a device link type between two Furiosa NPU devices.
 
FuriosaSmiReturnCode furiosa_smi_get_p2p_accessible (FuriosaSmiDeviceHandle handle1, FuriosaSmiDeviceHandle handle2, bool *out_accessible)
 Checks if two Furiosa NPU devices are P2P accessible.
 
FuriosaSmiReturnCode furiosa_smi_get_driver_info (FuriosaSmiVersion *out_driver_info)
 Get a driver information of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_core_frequency (FuriosaSmiDeviceHandle handle, FuriosaSmiCoreFrequency *out_core_frequency_info)
 Get a core frequency of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_memory_frequency (FuriosaSmiDeviceHandle handle, FuriosaSmiMemoryFrequency *out_memory_frequency_info)
 Get a memory frequency of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_device_performance_counter (FuriosaSmiDeviceHandle handle, FuriosaSmiDevicePerformanceCounter *out_performance_counter_info)
 Get a performance counter of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_device_power_consumption (FuriosaSmiDeviceHandle handle, FuriosaSmiDevicePowerConsumption *out_power_consumption)
 Get a power consumption of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_device_temperature (FuriosaSmiDeviceHandle handle, FuriosaSmiDeviceTemperature *out_temperature)
 Get a power consumption of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_governor_profile (FuriosaSmiDeviceHandle handle, FuriosaSmiGovernorProfile *out_governor_profile)
 Get a governor state of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_set_governor_profile (FuriosaSmiDeviceHandle handle, FuriosaSmiGovernorProfile governor_profile)
 Set a governor state into Furiosa NPU device. This requires root privileges.
 
FuriosaSmiReturnCode furiosa_smi_enable_device (FuriosaSmiDeviceHandle handle)
 Bind a Furiosa NPU device. This requires root privileges.
 
FuriosaSmiReturnCode furiosa_smi_disable_device (FuriosaSmiDeviceHandle handle)
 Unbind a Furiosa NPU device. This requires root privileges.
 
FuriosaSmiReturnCode furiosa_smi_get_disabled_devices (FuriosaSmiDisabledDevices *out_disabled_devices)
 Get a list of disabled Furiosa NPU devices.
 
FuriosaSmiReturnCode furiosa_smi_get_pcie_device_info (FuriosaSmiDeviceHandle handle, FuriosaSmiPcieDeviceInfo *out_pcie_device_info)
 Get a PCIe information of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_pcie_link_info (FuriosaSmiDeviceHandle handle, FuriosaSmiPcieLinkInfo *out_pcie_link_info)
 Get a PCIe link information of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_sriov_info (FuriosaSmiDeviceHandle handle, FuriosaSmiSriovInfo *out_sriov_info)
 Get a SR-IOV information of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_pcie_root_complex_info (FuriosaSmiDeviceHandle handle, FuriosaSmiPcieRootComplexInfo *out_root_complex_info)
 Get a PCIe root complex information of Furiosa NPU device.
 
FuriosaSmiReturnCode furiosa_smi_get_pcie_switch_info (FuriosaSmiDeviceHandle handle, FuriosaSmiPcieSwitchInfo *out_pcie_switch_info)
 Get a PCIe switch information of Furiosa NPU device.
 

Macro Definition Documentation

◆ FURIOSA_SMI_MAX_CORE_STATUS_SIZE

#define FURIOSA_SMI_MAX_CORE_STATUS_SIZE   128

◆ FURIOSA_SMI_MAX_CSTR_SIZE

#define FURIOSA_SMI_MAX_CSTR_SIZE   96

◆ FURIOSA_SMI_MAX_DEVICE_FILE_SIZE

#define FURIOSA_SMI_MAX_DEVICE_FILE_SIZE   64

◆ FURIOSA_SMI_MAX_DEVICE_HANDLE_SIZE

#define FURIOSA_SMI_MAX_DEVICE_HANDLE_SIZE   64

◆ FURIOSA_SMI_MAX_PATH_SIZE

#define FURIOSA_SMI_MAX_PATH_SIZE   256

◆ FURIOSA_SMI_MAX_PE_SIZE

#define FURIOSA_SMI_MAX_PE_SIZE   64

Typedef Documentation

◆ FuriosaSmiBdf

typedef char FuriosaSmiBdf[FURIOSA_SMI_MAX_CSTR_SIZE]

◆ FuriosaSmiDeviceHandle

typedef uint32_t FuriosaSmiDeviceHandle

Enumeration Type Documentation

◆ FuriosaSmiArch

Represent an architecture type of device.

Enumerator
FURIOSA_SMI_ARCH_WARBOY 

Warboy architecture.

FURIOSA_SMI_ARCH_RNGD 

RNGD architecture.

FURIOSA_SMI_ARCH_RNGD_MAX 

RNGD-Max architecture.

FURIOSA_SMI_ARCH_RNGD_S 

RNGD-S architecture.

◆ FuriosaSmiCoreStatus

Represent a core status.

Enumerator
FURIOSA_SMI_CORE_STATUS_AVAILABLE 

Device is available.

FURIOSA_SMI_CORE_STATUS_OCCUPIED 

Device is occupied.

◆ FuriosaSmiDeviceToDeviceLinkType

Represent a device link type.

Enumerator
FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_UNKNOWN 

Unknown link type.

FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_INTERCONNECT 

Link type under same machine.

FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_CPU 

Link type under same cpu.

FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_BRIDGE 

Link type under same switch.

FURIOSA_SMI_DEVICE_TO_DEVICE_LINK_TYPE_NOC 

Link type under same socket.

◆ FuriosaSmiGovernorProfile

Represent a governor profile.

Enumerator
FURIOSA_SMI_GOVERNOR_PROFILE_PERFORMANCE 

'performance' governor profile

FURIOSA_SMI_GOVERNOR_PROFILE_POWER_SAVE 

'powersave' governor profile

◆ FuriosaSmiReturnCode

Represent a return status.

Enumerator
FURIOSA_SMI_RETURN_CODE_OK 

When a function call is successful.

FURIOSA_SMI_RETURN_CODE_INVALID_ARGUMENT_ERROR 

When an invalid argument is given.

FURIOSA_SMI_RETURN_CODE_NULL_POINTER_ERROR 

When a null pointer is given to output buffer.

FURIOSA_SMI_RETURN_CODE_MAX_BUFFER_SIZE_EXCEED_ERROR 

When a data exceeds the maximum buffer size.

FURIOSA_SMI_RETURN_CODE_DEVICE_NOT_FOUND_ERROR 

When a device is not found with the given option.

FURIOSA_SMI_RETURN_CODE_DEVICE_LOST_ERROR 

When a device is lost.

FURIOSA_SMI_RETURN_CODE_DEVICE_BUSY_ERROR 

When a device state is busy.

FURIOSA_SMI_RETURN_CODE_IO_ERROR 

When a certain operation is failed by an unexpected io error.

FURIOSA_SMI_RETURN_CODE_PERMISSION_DENIED_ERROR 

When a certain operation is failed by a permission deny.

FURIOSA_SMI_RETURN_CODE_UNKNOWN_ARCH_ERROR 

When an arch is unknown.

FURIOSA_SMI_RETURN_CODE_INCOMPATIBLE_DRIVER_ERROR 

When a driver is incompatible.

FURIOSA_SMI_RETURN_CODE_UNEXPECTED_VALUE_ERROR 

When a retrieved value is invalid.

FURIOSA_SMI_RETURN_CODE_PARSE_ERROR 

When a certain parsing operation is failed.

FURIOSA_SMI_RETURN_CODE_UNKNOWN_ERROR 

When a reason is unknown.

FURIOSA_SMI_RETURN_CODE_INTERNAL_ERROR 

When an internal operation is failed.

FURIOSA_SMI_RETURN_CODE_UNINITIALIZED_ERROR 

When the system is not initialized.

FURIOSA_SMI_RETURN_CODE_CONTEXT_ERROR 

When a context cannot be captured.

FURIOSA_SMI_RETURN_CODE_NOT_SUPPORTED_ERROR 

When a certain operation is not supported.