1use std::fmt::Display;
2
3use crate::shared::Architecture;
4
5pub enum MetalArchitecture {
8 Metal3,
9 Other,
10}
11
12impl Display for MetalArchitecture {
13 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
14 match self {
15 Self::Metal3 => write!(f, "metal3"),
16 Self::Other => write!(f, "other"),
17 }
18 }
19}
20
21impl MetalArchitecture {
22 pub fn parse(arg: &str) -> Result<Self, String> {
23 let norm = arg.to_lowercase();
24 if norm.starts_with("metal3") {
25 Ok(MetalArchitecture::Metal3)
26 } else {
27 Ok(MetalArchitecture::Other)
28 }
29 }
30}
31
32impl Architecture for MetalArchitecture {
33 fn warp_size(&self) -> u32 {
34 64
35 }
36
37 fn is_wmma_capable(&self) -> bool {
38 true
39 }
40
41 fn is_mfma_capable(&self) -> bool {
42 false
43 }
44}