Struct furiosa_device::Device

source ·
pub struct Device { /* private fields */ }
Expand description

Abstraction for a single Furiosa NPU device.

About Furiosa NPU

A Furiosa NPU device contains a number of cores and offers several ways called DeviceMode to combine multiple cores to a single logical device, as following:

  • Single: A logical device is composed of a single core.
  • Fusion: Multiple cores work together as if they were one device. This mode is useful when a DNN model requires much computation power and large memory capacity.
  • MultiCore: A logical device uses multiple cores, each of which communicates to one another through interconnect. In this mode, partitions of a model or multiple models can be pipelined. (See DeviceConfig and find_device_files).

Hence a Furiosa NPU device exposes several devfs files for each purpose above. They can be listed by calling dev_files method, which returns a list of DeviceFiles. Each DeviceFile again offers mode method to identify its DeviceMode.

Implementations§

source§

impl Device

source

pub fn name(&self) -> String

Returns the name of the device (e.g., npu0).

source

pub fn device_index(&self) -> u8

Returns the device index (e.g., 0 for npu0).

source

pub fn arch(&self) -> Arch

Returns Arch of the device(e.g., Warboy).

source

pub fn alive(&self) -> DeviceResult<bool>

Returns a liveness state of the device.

source

pub fn atr_error(&self) -> DeviceResult<HashMap<String, u32>>

Returns error states of the device.

source

pub fn busname(&self) -> DeviceResult<String>

Returns PCI bus number of the device.

source

pub fn pci_dev(&self) -> DeviceResult<String>

Returns PCI device ID of the device.

source

pub fn device_sn(&self) -> DeviceResult<String>

Returns serial number of the device.

source

pub fn device_uuid(&self) -> DeviceResult<String>

Returns UUID of the device.

source

pub fn firmware_version(&self) -> DeviceResult<String>

Retrieves firmware revision from the device.

source

pub fn driver_version(&self) -> DeviceResult<String>

Retrieves driver version for the device.

source

pub fn heartbeat(&self) -> DeviceResult<u32>

Returns uptime of the device.

source

pub fn clock_frequency(&self) -> DeviceResult<Vec<ClockFrequency>>

Returns clock frequencies of components in the device.

source

pub fn numa_node(&self) -> DeviceResult<NumaNode>

Retrieve NUMA node ID associated with the NPU’s PCI lane

source

pub fn core_num(&self) -> u8

Counts the number of cores.

source

pub fn cores(&self) -> &Vec<u8>

List the core indices.

source

pub fn dev_files(&self) -> &Vec<DeviceFile>

List device files under this device.

source

pub fn performance_counters(&self) -> Vec<(&DeviceFile, PerformanceCounter)>

List performance counters for each device files.

source

pub async fn get_status_core(&self, core: u8) -> DeviceResult<CoreStatus>

Examine a specific core of the device, whether it is available or not.

source

pub async fn get_status_all(&self) -> DeviceResult<HashMap<u8, CoreStatus>>

Examine each core of the device, whether it is available or not.

source

pub fn get_hwmon_fetcher(&self) -> &Fetcher

Returns Fetcher for hwmon metric of the device.

Trait Implementations§

source§

impl Clone for Device

source§

fn clone(&self) -> Device

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Device

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Device

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Ord for Device

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Device> for Device

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Device> for Device

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Eq for Device

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more