From: Ekaitz Zarraga <ekaitz@elenq.tech>
To: Efraim Flashner <efraim@flashner.co.il>
Cc: 67075@debbugs.gnu.org
Subject: [bug#67075] [PATCH] build: zig-build-system: Add CPU option
Date: Sun, 12 Nov 2023 16:38:10 +0000 [thread overview]
Message-ID: <9H9-d5-fHPyPl1K4orVOGtBJD1l-IkO3i_PliKpymBR4abn8CwidP7hNlaqafHnHBu54egehC0wYtVc-R4azbkd1sjEMPITj9dbUHl8W6dM=@elenq.tech> (raw)
In-Reply-To: <ZVDjgqABjiAuWaoZ@3900XT>
Hi Efraim,
On Sunday, November 12th, 2023 at 15:38, Efraim Flashner <efraim@flashner.co.il> wrote:
> What are the values that the compiler can take for this flag? Also,
> this seems like something that can be addressed with the tuning
> mechanism, so we can run 'guix build foo --tune' and it'll do The Right
> Thing™.
It's not that simple. I talked with Andrew Kelley and he told me the values
are obtained from LLVM and they have some patching. I checked the list and
they are similar to those we use in the -march field:
https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#x86-Options
The full list is accessible in `zig targets` and it's very extensive.
I don't know if we can just rely on that mechanism...
> Alternatively, if we do go this route, you still need to update the
> documentation.
That's very true. I will.
> On Sat, Nov 11, 2023 at 01:09:07PM +0000, Ekaitz Zarraga wrote:
>
> > From a647a8ee689022cafef4bab05784b32b1c97bee7 Mon Sep 17 00:00:00 2001
> > Message-ID: a647a8ee689022cafef4bab05784b32b1c97bee7.1699708101.git.ekaitz@elenq.tech
> > From: Ekaitz Zarraga ekaitz@elenq.tech
> > Date: Sat, 11 Nov 2023 14:05:23 +0100
> > Subject: [PATCH] build: zig-build-system: Add CPU option
> >
> > Zig packages are optimized by default, adding `-Dcpu=baseline` to the
> > build command builds them for an standard cpu that should work in every
> > machine.
> >
> > This change sets that by default but also allows users to choose their
> > cpu by the `#:zig-cpu` argument.
> >
> > * guix/build-system/zig.scm (build): add zig-cpu
> > * guix/build/zig-build-system.scm (zig-build) add zig-cpu
> >
> > Change-Id: Ib4b2124179e7b5492e7c77c64e1f8336832032ea
> > ---
> > guix/build-system/zig.scm | 2 ++
> > guix/build/zig-build-system.scm | 2 ++
> > 2 files changed, 4 insertions(+)
> >
> > diff --git a/guix/build-system/zig.scm b/guix/build-system/zig.scm
> > index 16b8a712cc..f90e76104e 100644
> > --- a/guix/build-system/zig.scm
> > +++ b/guix/build-system/zig.scm
> > @@ -47,6 +47,7 @@ (define* (zig-build name inputs
> > source
> > (tests? #t)
> > (test-target #f)
> > + (zig-cpu #f)
> > (zig-build-flags ''())
> > (zig-test-flags ''())
> > (zig-release-type #f)
> > @@ -67,6 +68,7 @@ (define* (zig-build name inputs
> > #:source #+source
> > #:system #$system
> > #:test-target #$test-target
> > + #:zig-cpu #$zig-cpu
> > #:zig-build-flags #$zig-build-flags
> > #:zig-test-flags #$zig-test-flags
> > #:zig-release-type #$zig-release-type
> > diff --git a/guix/build/zig-build-system.scm b/guix/build/zig-build-system.scm
> > index d414ebfb17..99a81314d4 100644
> > --- a/guix/build/zig-build-system.scm
> > +++ b/guix/build/zig-build-system.scm
> > @@ -44,6 +44,7 @@ (define* (set-zig-global-cache-dir #:rest args)
> > (setenv "ZIG_GLOBAL_CACHE_DIR" global-cache-dir))
> >
> > (define* (build #:key
> > + zig-cpu
> > zig-build-flags
> > zig-release-type ;; "safe", "fast" or "small" empty for a
> > ;; debug build"
> > @@ -59,6 +60,7 @@ (define* (build #:key
> > ,@(if zig-release-type
> > (list (string-append "-Drelease-" zig-release-type))
> > '())
> > + ,(string-append "-Dcpu=" (or zig-cpu "baseline"))
> > ,@zig-build-flags)))
> > (format #t "running: ~s~%" call)
> > (apply invoke call)))
> >
> > base-commit: af6105afc67a15a491a0a4fd18a28c9f801a0b94
> > --
> > 2.41.0
>
>
> --
> Efraim Flashner efraim@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
next prev parent reply other threads:[~2023-11-12 16:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-11 13:09 [bug#67075] [PATCH] build: zig-build-system: Add CPU option Ekaitz Zarraga
2023-11-12 14:38 ` Efraim Flashner
2023-11-12 16:38 ` Ekaitz Zarraga [this message]
2023-11-12 16:41 ` Ekaitz Zarraga
2023-11-18 16:52 ` Ekaitz Zarraga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='9H9-d5-fHPyPl1K4orVOGtBJD1l-IkO3i_PliKpymBR4abn8CwidP7hNlaqafHnHBu54egehC0wYtVc-R4azbkd1sjEMPITj9dbUHl8W6dM=@elenq.tech' \
--to=ekaitz@elenq.tech \
--cc=67075@debbugs.gnu.org \
--cc=efraim@flashner.co.il \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.