From: "Nicolas Bértolo" <nicolasbertolo@gmail.com>
To: Andrea Corallo <akrl@sdf.org>
Cc: 41615@debbugs.gnu.org
Subject: bug#41615: [feature/native-comp] Dump prettier C code.
Date: Sun, 31 May 2020 14:26:46 -0300 [thread overview]
Message-ID: <CAFnS-O=5u3cqUjhFGnEc8Pa==0r2Jtx4A6uhfDBOBuN60wTE4A@mail.gmail.com> (raw)
In-Reply-To: <xjf367gkpob.fsf@sdf.org>
> I believe bzero is unnecessary given these are static allocated.
Ok with me.
> For memcpy we can just use the standard library implementation given
> elns are linked to it. The other advantage is that doing this way (here
> at least) memcpy is not inlined also at speed 3, so we don't trap in the
> optimizer issue!
This is good!
> All summed is even a little faster than the stock patch and closer to
> the one with the specific GCC blob support.
Good.
> Let me know if you like the attached and if does the job for you too.
I like it. I see calls to memcpy even with -O3, which is great.
Nico
El dom., 31 may. 2020 a las 13:57, Andrea Corallo (<akrl@sdf.org>) escribió:
>
> Nicolas Bértolo <nicolasbertolo@gmail.com> writes:
>
> >> I like this considerably less :)
> >
> > Ok, let's say goodbye to this patch.
> >
> >> It introduces quite some complexity and the same advantage in
> >> debuggability can be achieved with something like the attached 8 line
> >> patch (untested).
> >
> > Sounds good, I haven't tested it either.
> >
> >> Generally speaking I want to try to keep our back-end as simple as we
> >> manage to.
> >
> > I initially wrote this patch chasing the reason for slow compile times. I think
> > that a 10k line C file should be compiled much faster than what gccjit achieves.
> > I thought that "uncommon" (for C) ways of doing thing were causing gccjit to get
> > stuck trying to optimize them hard, until it gave up. I thought that filling the
> > static data using memcpy() and constant strings would help GCC recognize this as
> > a constant initialization and hopefully just store a completely initialized copy
> > in memory.
> >
> > I found that GCC would inline memcpy() and the static initialization would turn
> > into a very long unrolled loop with SSE instructions. I tested this with -O3
> > only in gccjit to force maximum optimization. I found this super strange
> > considering that -ftree-loop-distribute-patterns is enabled at -O3 and it should
> > recognize the naive_memcpy() function as an implementation of memcpy() and issue
> > calls to libc's implementation. Instead, it was inlining and unrolling it.
>
> Ok you confirm the suspects I wrote in the other mail!
>
> I've used your patch as a base, apart for minors here and there I've
> stripped out the definitions of bzero and memcpy.
>
> I believe bzero is unnecessary given these are static allocated.
>
> For memcpy we can just use the standard library implementation given
> elns are linked to it. The other advantage is that doing this way (here
> at least) memcpy is not inlined also at speed 3, so we don't trap in the
> optimizer issue!
>
> All summed is even a little faster than the stock patch and closer to
> the one with the specific GCC blob support.
>
> Let me know if you like the attached and if does the job for you too.
>
> Thanks
>
> Andrea
>
> --
> akrl@sdf.org
next prev parent reply other threads:[~2020-05-31 17:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-30 15:08 bug#41615: [feature/native-comp] Dump prettier C code Nicolas Bértolo
2020-05-30 22:20 ` Nicolas Bértolo
2020-05-31 10:45 ` Andrea Corallo
2020-05-31 15:42 ` Nicolas Bértolo
2020-05-31 11:37 ` Andrea Corallo
2020-05-31 15:48 ` Andrea Corallo
2020-05-31 15:54 ` Nicolas Bértolo
2020-05-31 16:57 ` Andrea Corallo
2020-05-31 17:26 ` Nicolas Bértolo [this message]
2020-05-31 18:11 ` Andrea Corallo
2020-05-31 19:38 ` Nicolas Bértolo
2020-05-31 20:00 ` Andrea Corallo
2020-05-31 20:18 ` Andrea Corallo
2020-06-01 7:19 ` Andrea Corallo
2020-06-01 12:25 ` Nicolas Bértolo
2020-06-01 20:28 ` Andrea Corallo
2020-06-01 23:11 ` Nicolas Bértolo
2020-06-04 9:52 ` Andrea Corallo
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFnS-O=5u3cqUjhFGnEc8Pa==0r2Jtx4A6uhfDBOBuN60wTE4A@mail.gmail.com' \
--to=nicolasbertolo@gmail.com \
--cc=41615@debbugs.gnu.org \
--cc=akrl@sdf.org \
/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 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).