GNU bug report logs - #55431
[PATCH] guix: cpu: recognize other architectures.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Sun, 15 May 2022 17:13:01 UTC

Severity: normal

Tags: patch

Done: Efraim Flashner <efraim <at> flashner.co.il>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55431 in the body.
You can then email your comments to 55431 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#55431; Package guix-patches. (Sun, 15 May 2022 17:13:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Julien Lepiller <julien <at> lepiller.eu>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 15 May 2022 17:13:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: guix-patches <at> gnu.org
Subject: [PATCH] guix: cpu: recognize other architectures.
Date: Sun, 15 May 2022 19:11:32 +0200
[Message part 1 (text/plain, inline)]
Hi Guix!

The attached patch lets (guix cpu) recognize other architectures. The
code of (current-cpu) is based on the content of /proc/cpuinfo which
can be pretty different on non-intel architectures. For instance,
here's a sample from an armhf machine:

processor	: 0
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 45.47
Features	: half thumb fastmult vfp edsp thumbee neon vfpv3 tls
vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc07
CPU revision	: 4

In particular, there's no flags entry, so (current-cpu) doesn't stop
until eof, and returns #f.

It's an issue because a test uses this code, for testing manifests with
--tune. If no cpu is returned, the test crashes:

In guix/transformations.scm:
   864:25  1 (_ _ _ _ ((package ad-hoc-package "gcc-toolchain")
(<E2><80><A6>) <E2><80><A6>)) In guix/cpu.scm:
     94:2  0 (cpu->gcc-architecture #f)

Since the test fails, the "guix" package doesn't build, and I can't
reconfigure on armhf or aarch64. (well armhf has other issues right
now...)

The attached patch changes the logic of the code to read all lines,
find information about the CPU even if it's an ARM CPU, and returns
always something (to prevent the crash) when it reads eof. This means
that it will return architecture information about the last CPU,
instead of the first. I don't think that's an issue because this code
is used for --tune which really only works on intel where you don't
have multiple CPUs with too different features.

WDYT?
[0001-guix-cpu-Recognize-other-architectures.patch (text/x-patch, attachment)]

Reply sent to Efraim Flashner <efraim <at> flashner.co.il>:
You have taken responsibility. (Tue, 17 May 2022 13:01:02 GMT) Full text and rfc822 format available.

Notification sent to Julien Lepiller <julien <at> lepiller.eu>:
bug acknowledged by developer. (Tue, 17 May 2022 13:01:02 GMT) Full text and rfc822 format available.

Message #10 received at 55431-done <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 55431-done <at> debbugs.gnu.org
Subject: Re: [bug#55431] [PATCH] guix: cpu: recognize other architectures.
Date: Tue, 17 May 2022 15:59:15 +0300
[Message part 1 (text/plain, inline)]
On Sun, May 15, 2022 at 07:11:32PM +0200, Julien Lepiller wrote:
> Hi Guix!
> 
> The attached patch lets (guix cpu) recognize other architectures. The
> code of (current-cpu) is based on the content of /proc/cpuinfo which
> can be pretty different on non-intel architectures. For instance,
> here's a sample from an armhf machine:
> 
> processor	: 0
> model name	: ARMv7 Processor rev 4 (v7l)
> BogoMIPS	: 45.47
> Features	: half thumb fastmult vfp edsp thumbee neon vfpv3 tls
> vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer	: 0x41
> CPU architecture: 7
> CPU variant	: 0x0
> CPU part	: 0xc07
> CPU revision	: 4
> 
> In particular, there's no flags entry, so (current-cpu) doesn't stop
> until eof, and returns #f.
> 
> It's an issue because a test uses this code, for testing manifests with
> --tune. If no cpu is returned, the test crashes:
> 
> In guix/transformations.scm:
>    864:25  1 (_ _ _ _ ((package ad-hoc-package "gcc-toolchain")
> (<E2><80><A6>) <E2><80><A6>)) In guix/cpu.scm:
>      94:2  0 (cpu->gcc-architecture #f)
> 
> Since the test fails, the "guix" package doesn't build, and I can't
> reconfigure on armhf or aarch64. (well armhf has other issues right
> now...)
> 
> The attached patch changes the logic of the code to read all lines,
> find information about the CPU even if it's an ARM CPU, and returns
> always something (to prevent the crash) when it reads eof. This means
> that it will return architecture information about the last CPU,
> instead of the first. I don't think that's an issue because this code
> is used for --tune which really only works on intel where you don't
> have multiple CPUs with too different features.
> 
> WDYT?

I just pushed mine without seeing yours, sorry.

I did check the gcc source code and I found the options for determining
the cpu flags for arm* processors in gcc/config/arm/arm-cpus.in. Do you
think it'd be worth it to add detection for armv7 CPUs?

Also, I'm pretty sure we can overlap armhf and aarch64 together, and
i686 and x86_64 together, and then running 32-bit code on 64-bit
processors will get a nice boost since it'll be tuned for the actual
hardware.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55431; Package guix-patches. (Tue, 17 May 2022 15:57:01 GMT) Full text and rfc822 format available.

Message #13 received at 55431-done <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: Efraim Flashner <efraim <at> flashner.co.il>
Cc: 55431-done <at> debbugs.gnu.org
Subject: Re: [bug#55431] [PATCH] guix: cpu: recognize other architectures.
Date: Tue, 17 May 2022 17:55:38 +0200
[Message part 1 (text/plain, inline)]
Thanks for fixing that anyway :)

I was only interested in it because it made me unable to reconfigure my systems. I don't care too much about the --tune code, and I don't understand what you suggest. Do you mean to create "x86 on x86_64" as a separate architecture? Or as a --tune target?

On May 17, 2022 2:59:15 PM GMT+02:00, Efraim Flashner <efraim <at> flashner.co.il> wrote:
>On Sun, May 15, 2022 at 07:11:32PM +0200, Julien Lepiller wrote:
>> Hi Guix!
>> 
>> The attached patch lets (guix cpu) recognize other architectures. The
>> code of (current-cpu) is based on the content of /proc/cpuinfo which
>> can be pretty different on non-intel architectures. For instance,
>> here's a sample from an armhf machine:
>> 
>> processor	: 0
>> model name	: ARMv7 Processor rev 4 (v7l)
>> BogoMIPS	: 45.47
>> Features	: half thumb fastmult vfp edsp thumbee neon vfpv3 tls
>> vfpv4 idiva idivt vfpd32 lpae evtstrm CPU implementer	: 0x41
>> CPU architecture: 7
>> CPU variant	: 0x0
>> CPU part	: 0xc07
>> CPU revision	: 4
>> 
>> In particular, there's no flags entry, so (current-cpu) doesn't stop
>> until eof, and returns #f.
>> 
>> It's an issue because a test uses this code, for testing manifests with
>> --tune. If no cpu is returned, the test crashes:
>> 
>> In guix/transformations.scm:
>>    864:25  1 (_ _ _ _ ((package ad-hoc-package "gcc-toolchain")
>> (<E2><80><A6>) <E2><80><A6>)) In guix/cpu.scm:
>>      94:2  0 (cpu->gcc-architecture #f)
>> 
>> Since the test fails, the "guix" package doesn't build, and I can't
>> reconfigure on armhf or aarch64. (well armhf has other issues right
>> now...)
>> 
>> The attached patch changes the logic of the code to read all lines,
>> find information about the CPU even if it's an ARM CPU, and returns
>> always something (to prevent the crash) when it reads eof. This means
>> that it will return architecture information about the last CPU,
>> instead of the first. I don't think that's an issue because this code
>> is used for --tune which really only works on intel where you don't
>> have multiple CPUs with too different features.
>> 
>> WDYT?
>
>I just pushed mine without seeing yours, sorry.
>
>I did check the gcc source code and I found the options for determining
>the cpu flags for arm* processors in gcc/config/arm/arm-cpus.in. Do you
>think it'd be worth it to add detection for armv7 CPUs?
>
>Also, I'm pretty sure we can overlap armhf and aarch64 together, and
>i686 and x86_64 together, and then running 32-bit code on 64-bit
>processors will get a nice boost since it'll be tuned for the actual
>hardware.
>
>-- 
>Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
>GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
>Confidentiality cannot be guaranteed on emails sent or received unencrypted
[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55431; Package guix-patches. (Wed, 18 May 2022 12:07:01 GMT) Full text and rfc822 format available.

Message #16 received at 55431-done <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 55431-done <at> debbugs.gnu.org
Subject: Re: [bug#55431] [PATCH] guix: cpu: recognize other architectures.
Date: Wed, 18 May 2022 15:05:38 +0300
[Message part 1 (text/plain, inline)]
On Tue, May 17, 2022 at 05:55:38PM +0200, Julien Lepiller wrote:
> Thanks for fixing that anyway :)
> 
> I was only interested in it because it made me unable to reconfigure my systems. I don't care too much about the --tune code, and I don't understand what you suggest. Do you mean to create "x86 on x86_64" as a separate architecture? Or as a --tune target?
> 

As part of the autotuning process. GCC internally groups i686 and x86_64
together when determining how to tune for --march=native, and I'm pretty
sure I've added some i686 hardware for AMD when I was adding autotuning
support for AMD CPUs. Its similar for aarch64 and armhf, there are armhf
targets internally that accept armv8.X-a targets, so there's no need to
limit armhf tuning to armv7.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Jun 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 305 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.