On 2026-09-04 at 19:34 +1000, Danilo Krummrich <[email protected]> wrote... > On Fri Sep 4, 2026 at 9:49 AM CEST, Alistair Popple wrote: > > On 2026-09-03 at 20:42 +1000, Danilo Krummrich <[email protected]> wrote... > >> I think there never was a "rather than". The point was that if userspace > >> has > >> conditionals based on the architecture it shouldn't have to figure it out > >> based > >> on the chipid, as this has been done by the kernel already. > > > > I see. Maybe that was a bad assumption on my behalf, because I assumed that > > if > > you make a precise hardware description available (chip-id) there'd be no > > point > > making an imprecise subset of that description (arch) available as it isn't > > particularly useful if you can't use it in isolation for any generic > > purpose. > > Except that it is used in isolation for a generic purpose e.g. in NAK. > > >> Then in NAK (src/nouveau/compiler/nak/ir.rs), there's this code. > >> > >> fn is_turing(&self) -> bool { > >> self.sm() >= 73 && self.sm() < 80 > >> } > >> > >> fn is_ampere(&self) -> bool { > >> self.sm() >= 80 && self.sm() < 89 > >> } > >> > >> fn is_ada(&self) -> bool { > >> self.sm() == 89 > >> } > >> > >> #[allow(dead_code)] > >> fn is_hopper(&self) -> bool { > >> self.sm() >= 90 && self.sm() < 100 > >> } > >> > >> fn is_blackwell_a(&self) -> bool { > >> self.sm() >= 100 && self.sm() < 110 > >> } > >> > >> fn is_blackwell_b(&self) -> bool { > >> self.sm() >= 120 && self.sm() < 130 > >> } > >> > >> fn is_blackwell(&self) -> bool { > >> self.is_blackwell_a() || self.is_blackwell_b() > >> } > >> > >> That's two unnecessary indirections for something the kernel already has > >> available. > > > > Again though is what the kernel provides in the form of an arch actually > > useful > > to user-space? Obviously the code above makes it look nice and simple like > > that, > > but as I have been saying more complete implementations can't just rely on > > arch > > alone and so are still going to have lookup tables both for SM and for other > > info the kernel can't provide. > > Are you saying that NAK oversimplifies things and hence gets away with per > architecture checks in src/nouveau/compiler/nak/sm70.rs? And that a "more > complete implementation" would be specialized to a point where it becomes > impossible to have any common code per architecture and in general?
That is my understanding yes, AFAICT we cannot reliably derive the SM ISA from the chip architecture alone as it's defined here. Obviously in practice not everything must change for every ISA or the NAK implementation above wouldn't work at all, so there must be some commonality, but HW makes no compatibility guarantees between ISA versions so we can't really make assumptions about the ISA based on the architecture alone. - Alistair
