Skip to content

Commit

Permalink
Add Blackwell to DeviceArchitecture enum (#70)
Browse files Browse the repository at this point in the history
Adds Blackwell to DeviceArchitecture enum

Co-authored-by: Marco Morais <[email protected]>
  • Loading branch information
marcoemorais and Marco Morais authored Feb 14, 2025
1 parent 36101a9 commit a2a9d12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nvml-wrapper-sys/nvml.h
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,8 @@ typedef struct nvmlGridLicensableFeatures_st

#define NVML_DEVICE_ARCH_HOPPER 9 // Devices based on the NVIDIA Hopper architecture

#define NVML_DEVICE_ARCH_BLACKWELL 10 // Devices based on the NVIDIA Blackwell architecture

#define NVML_DEVICE_ARCH_UNKNOWN 0xffffffff // Anything else, presumably something newer

typedef unsigned int nvmlDeviceArchitecture_t;
Expand Down
1 change: 1 addition & 0 deletions nvml-wrapper-sys/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub const NVML_DEVICE_ARCH_TURING: u32 = 6;
pub const NVML_DEVICE_ARCH_AMPERE: u32 = 7;
pub const NVML_DEVICE_ARCH_ADA: u32 = 8;
pub const NVML_DEVICE_ARCH_HOPPER: u32 = 9;
pub const NVML_DEVICE_ARCH_BLACKWELL: u32 = 10;
pub const NVML_DEVICE_ARCH_UNKNOWN: u32 = 4294967295;
pub const NVML_BUS_TYPE_UNKNOWN: u32 = 0;
pub const NVML_BUS_TYPE_PCI: u32 = 1;
Expand Down
5 changes: 5 additions & 0 deletions nvml-wrapper/src/enums/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ pub enum DeviceArchitecture {
Ada,
/// <https://en.wikipedia.org/wiki/Hopper_(microarchitecture)>
Hopper,
/// https://en.wikipedia.org/wiki/Blackwell_(microarchitecture)
Blackwell,
/// Unknown device architecture (most likely something newer).
Unknown,
}
Expand All @@ -241,6 +243,7 @@ impl DeviceArchitecture {
Self::Ampere => NVML_DEVICE_ARCH_AMPERE,
Self::Ada => NVML_DEVICE_ARCH_ADA,
Self::Hopper => NVML_DEVICE_ARCH_HOPPER,
Self::Blackwell => NVML_DEVICE_ARCH_BLACKWELL,
Self::Unknown => NVML_DEVICE_ARCH_UNKNOWN,
}
}
Expand All @@ -259,6 +262,7 @@ impl TryFrom<nvmlDeviceArchitecture_t> for DeviceArchitecture {
NVML_DEVICE_ARCH_AMPERE => Ok(Self::Ampere),
NVML_DEVICE_ARCH_ADA => Ok(Self::Ada),
NVML_DEVICE_ARCH_HOPPER => Ok(Self::Hopper),
NVML_DEVICE_ARCH_BLACKWELL => Ok(Self::Blackwell),
NVML_DEVICE_ARCH_UNKNOWN => Ok(Self::Unknown),
_ => Err(NvmlError::UnexpectedVariant(data)),
}
Expand All @@ -276,6 +280,7 @@ impl Display for DeviceArchitecture {
Self::Ampere => f.write_str("Ampere"),
Self::Ada => f.write_str("Ada"),
Self::Hopper => f.write_str("Hopper"),
Self::Blackwell => f.write_str("Blackwell"),
Self::Unknown => f.write_str("Unknown"),
}
}
Expand Down

0 comments on commit a2a9d12

Please sign in to comment.