Subject: Re: bug#52283: [PATCH 00/10] Tuning packages for CPU micro-architectures

From: Mathieu Othacehe <[email-masked]>
Date: Sun, 05 Dec 2021 09:37:09 +0100

Hey Ludo,

Wooh, nice addition!

> +(define-record-type <cpu>
> +  (cpu architecture family model flags)
> +  cpu?
> +  (architecture cpu-architecture)                 ;string, from 'uname'
> +  (family       cpu-family)                       ;integer
> +  (model        cpu-model)                        ;integer
> +  (flags        cpu-flags))                       ;set of strings

When using the "--tune" transformation option with "native", we can
expect the current-cpu method to fill the <cpu> record correctly.

However, when the user is passing a custom cpu name, it might be
incorrect. I think we should check the user input against a list of
valid/supported cpu architectures.

That's something we should also enforce for the system and target
fields. Currently, this command "guix build -s arch64-linux hello" is
failing with an unpleasant backtrace, while it could warn that the
given system is not supported.

Maybe the (guix cpu) and (gnu platform) modules should be merged somehow
to define the supported CPU micro-architectures:

--8<---------------cut here---------------start------------->8---
(define armv7-linux
  (platform
   (target "arm-linux-gnueabihf")
   (system "armhf-linux")
   (linux-architecture "arm")
   (supported-march '("armv7" "armv7-a" "armv7ve"))
--8<---------------cut here---------------end--------------->8---

we could then use those platform records in the (gnu ci) module to build
packages against all the supported micro architectures and remove the
"%x86-64-micro-architecture" variable you propose to introduce there.

WDYT?

Thanks,

Mathieu