Timur Tabi
2025-Nov-08 05:03 UTC
[PATCH v6 3/4] gpu: nova-core: make Architecture behave as a u8 type
On Fri, 2025-11-07 at 20:39 -0800, John Hubbard wrote:> ?/// Enum representation of the GPU generation. > -#[derive(fmt::Debug)] > +#[derive(fmt::Debug, Default, Copy, Clone)] > +#[repr(u8)] > ?pub(crate) enum Architecture { > +??? #[default] > ???? Turing = 0x16, > ???? Ampere = 0x17, > ???? Ada = 0x19, > @@ -142,6 +144,13 @@ fn try_from(value: u8) -> Result<Self> { > ???? } > ?}Does it make sense to designate a default Architecture? Turing is not a fallback for Ampere -- you can't boot an Ampere with Turing's HAL. Also, we don't even make Turing cards any more, so over time, Turing will be less and less common.
John Hubbard
2025-Nov-08 05:08 UTC
[PATCH v6 3/4] gpu: nova-core: make Architecture behave as a u8 type
On 11/7/25 9:03 PM, Timur Tabi wrote:> On Fri, 2025-11-07 at 20:39 -0800, John Hubbard wrote: >> ?/// Enum representation of the GPU generation. >> -#[derive(fmt::Debug)] >> +#[derive(fmt::Debug, Default, Copy, Clone)] >> +#[repr(u8)] >> ?pub(crate) enum Architecture { >> +??? #[default] >> ???? Turing = 0x16, >> ???? Ampere = 0x17, >> ???? Ada = 0x19, >> @@ -142,6 +144,13 @@ fn try_from(value: u8) -> Result<Self> { >> ???? } >> ?} > > Does it make sense to designate a default Architecture? Turing is not a fallback for Ampere --Definitely not! However, we do want to use Architecture in places (register! and bitfield! macros) that expect u8 or u32, and that also expect to use integer defaults. So that's why we have to supply it. thanks, -- John Hubbard