#[non_exhaustive]pub enum ArchTarget {
Gfx(GfxTarget),
Sm(ComputeCapability),
Xe(IntelArch),
Apple(AppleFamily),
}Expand description
The architecture a prebuilt GPU artifact must target.
Each vendor names this differently but uses it the same way — to select a build the device can actually run — so one field carries whichever form applies. A GPU has at most one, which the type enforces.
use gpu_probe::{ArchTarget, GfxTarget};
let target = ArchTarget::Gfx(GfxTarget::new(10, 1, 3));
assert_eq!(target.to_string(), "gfx1013");
assert_eq!(target.gfx(), Some(GfxTarget::new(10, 1, 3)));
assert_eq!(target.sm(), None);Deliberately not Ord: comparing an AMD target against an NVIDIA one has no
meaning. Order within a vendor by matching out GfxTarget or
ComputeCapability, both of which are ordered.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Gfx(GfxTarget)
AMD: the --offload-arch value a ROCm/HIP code object is built for.
Sm(ComputeCapability)
NVIDIA: the compute capability a CUDA artifact is built for.
Xe(IntelArch)
Intel: the GPU architecture family, from the PCI device id.
Apple(AppleFamily)
Apple: the Metal GPU family. A capability tier rather than a build
target — see AppleFamily.
Implementations§
Source§impl ArchTarget
impl ArchTarget
Sourcepub const fn gfx(self) -> Option<GfxTarget>
pub const fn gfx(self) -> Option<GfxTarget>
The AMD target, or None when this names another vendor’s.
Sourcepub const fn sm(self) -> Option<ComputeCapability>
pub const fn sm(self) -> Option<ComputeCapability>
The NVIDIA compute capability, or None when this names another
vendor’s.
Sourcepub const fn xe(self) -> Option<IntelArch>
pub const fn xe(self) -> Option<IntelArch>
The Intel architecture family, or None when this names another
vendor’s.
Sourcepub const fn apple(self) -> Option<AppleFamily>
pub const fn apple(self) -> Option<AppleFamily>
The Apple GPU family, or None when this names another vendor’s.
Trait Implementations§
Source§impl Clone for ArchTarget
impl Clone for ArchTarget
Source§fn clone(&self) -> ArchTarget
fn clone(&self) -> ArchTarget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more