unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How do I use `native-comp-compiler-options`?
@ 2023-09-03 16:54 StrawberryTea
  2023-09-03 17:06 ` Eli Zaretskii
  2023-09-04  0:23 ` Emanuel Berg
  0 siblings, 2 replies; 4+ messages in thread
From: StrawberryTea @ 2023-09-03 16:54 UTC (permalink / raw)
  To: emacs-devel


Hi. So I'm just wondering how to use `native-comp-compiler-options`.
Does it just take the same values that CFLAGS can take? I'm asking
because I patched my Emacs to define `native-comp-compiler-options` as

```
`("-march=skylake" "-Ofast" "-g0" "-fno-finite-math-only"
"-fomit-frame-pointer" "-malign-data=cacheline" "-fira-region=mixed"
"-fira-algorithm=CB" "-fira-hoist-pressure" "-fira-loop-pressure"
"-floop-nest-optimize" "-fgraphite-identity")
```

but I don't really notice any difference in performance in usage nor in
any of the benchmarks in my config file:
https://github.com/lemonbreezes/cae-emacs/blob/master/benchmarks/seq-cl-dash-benchmarks.org?plain=1#L9
https://github.com/lemonbreezes/cae-emacs/blob/master/benchmarks/silly-loop.el#L3

Nor do I see a difference when I compile `silly-loop` with and without
the above options. I am using `native-comp-speed` 3 and lexical binding
for all files and my GCC version is
```
gcc (Gentoo 14.0.0 p, commit d0b55776a4e1d2f293db5ba0e4a04aefed055ec4)
14.0.0 20230903 (experimental) a7d052b3200c7928d903a0242b8cfd75d131e374
```

I'm not sure if it's because my benchmarks are too trivial or because I
have `native-comp-speed` 3 so there is not much to optimize beyond that.
I definitely do notice the numbers change more when I recompile Emacs
itself with different CFLAGS and I think I did notice a difference
bumpin `native-comp-speed` up from 2 to 3 but not from setting
`native-comp-compiler-options`.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I use `native-comp-compiler-options`?
  2023-09-03 16:54 How do I use `native-comp-compiler-options`? StrawberryTea
@ 2023-09-03 17:06 ` Eli Zaretskii
  2023-09-05 10:14   ` Andrea Corallo
  2023-09-04  0:23 ` Emanuel Berg
  1 sibling, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2023-09-03 17:06 UTC (permalink / raw)
  To: StrawberryTea, Andrea Corallo; +Cc: emacs-devel

> From: StrawberryTea <look@strawberrytea.xyz>
> Date: Sun, 03 Sep 2023 11:54:03 -0500
> 
> 
> Hi. So I'm just wondering how to use `native-comp-compiler-options`.
> Does it just take the same values that CFLAGS can take? I'm asking
> because I patched my Emacs to define `native-comp-compiler-options` as
> 
> ```
> `("-march=skylake" "-Ofast" "-g0" "-fno-finite-math-only"
> "-fomit-frame-pointer" "-malign-data=cacheline" "-fira-region=mixed"
> "-fira-algorithm=CB" "-fira-hoist-pressure" "-fira-loop-pressure"
> "-floop-nest-optimize" "-fgraphite-identity")
> ```
> 
> but I don't really notice any difference in performance in usage nor in
> any of the benchmarks in my config file:
> https://github.com/lemonbreezes/cae-emacs/blob/master/benchmarks/seq-cl-dash-benchmarks.org?plain=1#L9
> https://github.com/lemonbreezes/cae-emacs/blob/master/benchmarks/silly-loop.el#L3
> 
> Nor do I see a difference when I compile `silly-loop` with and without
> the above options. I am using `native-comp-speed` 3 and lexical binding
> for all files and my GCC version is
> ```
> gcc (Gentoo 14.0.0 p, commit d0b55776a4e1d2f293db5ba0e4a04aefed055ec4)
> 14.0.0 20230903 (experimental) a7d052b3200c7928d903a0242b8cfd75d131e374
> ```
> 
> I'm not sure if it's because my benchmarks are too trivial or because I
> have `native-comp-speed` 3 so there is not much to optimize beyond that.
> I definitely do notice the numbers change more when I recompile Emacs
> itself with different CFLAGS and I think I did notice a difference
> bumpin `native-comp-speed` up from 2 to 3 but not from setting
> `native-comp-compiler-options`.

I think you will be better off asking these questions the libgccjit
developers (they are on the GCC team) -- they know better which of the
GCC Flags affect native-code emitted by native compilation.

I've added Andrea, in case he has any insights.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I use `native-comp-compiler-options`?
  2023-09-03 16:54 How do I use `native-comp-compiler-options`? StrawberryTea
  2023-09-03 17:06 ` Eli Zaretskii
@ 2023-09-04  0:23 ` Emanuel Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2023-09-04  0:23 UTC (permalink / raw)
  To: emacs-devel

StrawberryTea wrote:

> gcc (Gentoo 14.0.0 p, commit d0b55776a4e1d2f293db5ba0e4a04aefed055ec4)
> 14.0.0 20230903 (experimental) a7d052b3200c7928d903a0242b8cfd75d131e374
>
> I'm not sure if it's because my benchmarks are too trivial
> or because I have `native-comp-speed` 3 so there is not much
> to optimize beyond that. I definitely do notice the numbers
> change more when I recompile Emacs itself with different
> CFLAGS and I think I did notice a difference bumpin
> `native-comp-speed` up from 2 to 3 but not from setting
> `native-comp-compiler-options`.

See if you can install elisp-benchmarks from GNU ELPA or
the web:

  https://elpa.gnu.org/packages/elisp-benchmarks.html

Then you can clearly see if it makes a difference what speed
native-compile is set to.

You can also try 0 and 1, and report the results here, if
you like.

I'm on gcc (Debian 10.2.1-6) 10.2.1 20210110 - I think that
(too old version of gcc) was the reason Emacs and the computer
got nonresponsive when trying `native-comp-speed' at 3.

I don't know if it is trivial to install a newer version of
gcc from scratch on Debian, maybe I'll try it tonight.

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I use `native-comp-compiler-options`?
  2023-09-03 17:06 ` Eli Zaretskii
@ 2023-09-05 10:14   ` Andrea Corallo
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Corallo @ 2023-09-05 10:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: StrawberryTea, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

>> From: StrawberryTea <look@strawberrytea.xyz>
>> Date: Sun, 03 Sep 2023 11:54:03 -0500
>> 
>> 
>> Hi. So I'm just wondering how to use `native-comp-compiler-options`.
>> Does it just take the same values that CFLAGS can take? I'm asking
>> because I patched my Emacs to define `native-comp-compiler-options` as
>> 
>> ```
>> `("-march=skylake" "-Ofast" "-g0" "-fno-finite-math-only"
>> "-fomit-frame-pointer" "-malign-data=cacheline" "-fira-region=mixed"
>> "-fira-algorithm=CB" "-fira-hoist-pressure" "-fira-loop-pressure"
>> "-floop-nest-optimize" "-fgraphite-identity")
>> ```
>> 
>> but I don't really notice any difference in performance in usage nor in
>> any of the benchmarks in my config file:
>> https://github.com/lemonbreezes/cae-emacs/blob/master/benchmarks/seq-cl-dash-benchmarks.org?plain=1#L9
>> https://github.com/lemonbreezes/cae-emacs/blob/master/benchmarks/silly-loop.el#L3
>> 
>> Nor do I see a difference when I compile `silly-loop` with and without
>> the above options. I am using `native-comp-speed` 3 and lexical binding
>> for all files and my GCC version is
>> ```
>> gcc (Gentoo 14.0.0 p, commit d0b55776a4e1d2f293db5ba0e4a04aefed055ec4)
>> 14.0.0 20230903 (experimental) a7d052b3200c7928d903a0242b8cfd75d131e374
>> ```
>> 
>> I'm not sure if it's because my benchmarks are too trivial or because I
>> have `native-comp-speed` 3 so there is not much to optimize beyond that.
>> I definitely do notice the numbers change more when I recompile Emacs
>> itself with different CFLAGS and I think I did notice a difference
>> bumpin `native-comp-speed` up from 2 to 3 but not from setting
>> `native-comp-compiler-options`.
>
> I think you will be better off asking these questions the libgccjit
> developers (they are on the GCC team) -- they know better which of the
> GCC Flags affect native-code emitted by native compilation.
>
> I've added Andrea, in case he has any insights.

Yep, it should digest all the CFLAGS that are used by the compiler (not
the linker).

I'm only unsure if one specifies say -O3 if this takes precedence on
what we control with native-comp-speed
(GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL), this should be a question for
the libgccjit mailing list.

Bests

  Andrea



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-05 10:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-03 16:54 How do I use `native-comp-compiler-options`? StrawberryTea
2023-09-03 17:06 ` Eli Zaretskii
2023-09-05 10:14   ` Andrea Corallo
2023-09-04  0:23 ` Emanuel Berg

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).