From: Richard Biener <rguenther@suse.de>
To: Matthew Malcomson <matthew.malcomson@arm.com>
Cc: David Malcolm <dmalcolm@redhat.com>,
gcc-patches@gcc.gnu.org, richard.sandiford@arm.com,
Xi Ruoyao <xry111@xry111.site>,
Andrew Pinski <pinskia@gmail.com>
Subject: Re: [PATCH] mid-end: Use integral time intervals in timevar.cc
Date: Fri, 4 Aug 2023 10:18:02 +0000 (UTC) [thread overview]
Message-ID: <nycvar.YFH.7.77.849.2308041017440.12935@jbgna.fhfr.qr> (raw)
In-Reply-To: <e2b7daef-7a54-4f81-9cec-5fe24196f634@AZ-NEU-EX04.Arm.com>
On Fri, 4 Aug 2023, Matthew Malcomson wrote:
> Hopefully last update ...
>
> > Specifically, please try compiling with
> > -ftime-report -fdiagnostics-format=sarif-file
> > and have a look at the generated .sarif file, e.g. via
> > python -m json.tool foo.c.sarif
> > which will pretty-print the JSON to stdout.
>
> Rebasing onto the JSON output was quite simple -- I've inlined the only
> change in the patch below (to cast to floating point seconds before
> generating the json report).
>
> I have manually checked the SARIF output as you suggested and all looks
> good (an in fact better because we no longer save some strange times
> like the below due to avoiding the floating point rounding).
> "wall": -4.49516e-09,
>
>
> >
> > The patch looks OK to me if it passes bootstrap / regtest and the
> > output of -ftime-report doesn't change (too much).
> >
> > Thanks,
> > Richard.
>
> Though I don't expect you were asking for this, confirmation below that
> the output doesn't change. (Figured I may as well include that info
> since the rebase to include the JSON output that David had just added
> required re-sending an email anyway).
>
>
>
> ```
> hw-a20-8:checking-theory [10:07:01] $ ${old_build}/gcc/xgcc -B${old_build}/gcc/ -fdiagnostics-plain-output -Os -w -S test-sum.c -o /dev/null -ftime-report
>
> Time variable usr sys wall GGC
> phase setup : 0.01 ( 14%) 0.00 ( 0%) 0.02 ( 18%) 3389k ( 74%)
> phase parsing : 0.03 ( 43%) 0.02 ( 67%) 0.06 ( 55%) 982k ( 21%)
> phase opt and generate : 0.03 ( 43%) 0.01 ( 33%) 0.03 ( 27%) 215k ( 5%)
> callgraph functions expansion : 0.02 ( 29%) 0.00 ( 0%) 0.03 ( 27%) 162k ( 4%)
> callgraph ipa passes : 0.01 ( 14%) 0.01 ( 33%) -0.00 ( -0%) 38k ( 1%)
> CFG verifier : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 0 ( 0%)
> preprocessing : 0.02 ( 29%) 0.02 ( 67%) 0.02 ( 18%) 272k ( 6%)
> lexical analysis : 0.01 ( 14%) 0.00 ( 0%) 0.02 ( 18%) 0 ( 0%)
> parser (global) : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 637k ( 14%)
> parser function body : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 18k ( 0%)
> tree CFG cleanup : 0.00 ( 0%) 0.01 ( 33%) 0.00 ( 0%) 0 ( 0%)
> tree STMT verifier : 0.01 ( 14%) 0.00 ( 0%) 0.00 ( 0%) 0 ( 0%)
> expand : 0.01 ( 14%) 0.00 ( 0%) 0.00 ( 0%) 12k ( 0%)
> loop init : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 12k ( 0%)
> initialize rtl : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 15k ( 0%)
> rest of compilation : 0.01 ( 14%) 0.00 ( 0%) 0.00 ( 0%) 6920 ( 0%)
> TOTAL : 0.07 0.03 0.11 4587k
> Extra diagnostic checks enabled; compiler may run slowly.
> Configure with --enable-checking=release to disable checks.
> hw-a20-8:checking-theory [10:06:44] $ ${new_build}/gcc/xgcc -B${new_build}/gcc/ -fdiagnostics-plain-output -Os -w -S test-sum.c -o /dev/null -ftime-report
>
> Time variable usr sys wall GGC
> phase setup : 0.01 ( 17%) 0.00 ( 0%) 0.02 ( 18%) 3389k ( 74%)
> phase parsing : 0.02 ( 33%) 0.03 ( 75%) 0.05 ( 45%) 982k ( 21%)
> phase opt and generate : 0.03 ( 50%) 0.01 ( 25%) 0.04 ( 36%) 215k ( 5%)
> callgraph construction : 0.00 ( 0%) 0.01 ( 25%) 0.00 ( 0%) 1864 ( 0%)
> callgraph functions expansion : 0.02 ( 33%) 0.00 ( 0%) 0.03 ( 27%) 162k ( 4%)
> callgraph ipa passes : 0.01 ( 17%) 0.00 ( 0%) 0.01 ( 9%) 38k ( 1%)
> ipa free lang data : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 0 ( 0%)
> CFG verifier : 0.02 ( 33%) 0.00 ( 0%) 0.00 ( 0%) 0 ( 0%)
> preprocessing : 0.01 ( 17%) 0.03 ( 75%) 0.01 ( 9%) 272k ( 6%)
> lexical analysis : 0.01 ( 17%) 0.00 ( 0%) 0.02 ( 18%) 0 ( 0%)
> parser (global) : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 637k ( 14%)
> parser inl. func. body : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 19k ( 0%)
> tree STMT verifier : 0.01 ( 17%) 0.00 ( 0%) 0.00 ( 0%) 0 ( 0%)
> expand : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 12k ( 0%)
> integrated RA : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 50k ( 1%)
> initialize rtl : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( 9%) 15k ( 0%)
> TOTAL : 0.06 0.04 0.11 4587k
> Extra diagnostic checks enabled; compiler may run slowly.
> Configure with --enable-checking=release to disable checks.
> ```
>
>
> N.b. in the change below it's worth mentioning that the
> `nanosec_to_floating_sec` and `percent_of` macros were already defined.
> I just moved them to below the `make_json_for_timevar_time_def`
> function.
LGTM.
Thanks for doing this,
Richard.
> ############### Changes to the previous patch. ###############
>
>
> @@ -832,12 +841,16 @@ json::object *
> make_json_for_timevar_time_def (const timevar_time_def &ttd)
> {
> json::object *obj = new json::object ();
> - obj->set ("user", new json::float_number (ttd.user));
> - obj->set ("sys", new json::float_number (ttd.sys));
> - obj->set ("wall", new json::float_number (ttd.wall));
> + obj->set ("user",
> + new json::float_number (nanosec_to_floating_sec (ttd.user)));
> + obj->set ("sys", new json::float_number (nanosec_to_floating_sec (ttd.sys)));
> + obj->set ("wall",
> + new json::float_number (nanosec_to_floating_sec (ttd.wall)));
> obj->set ("ggc_mem", new json::integer_number (ttd.ggc_mem));
> return obj;
> }
> +#undef nanosec_to_floating_sec
> +#undef percent_of
>
> /* Create a json value representing this object, suitable for use
> in SARIF output. */
>
>
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
next prev parent reply other threads:[~2023-08-04 10:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-21 12:11 [PATCH] Reduce floating-point difficulties " Matthew Malcomson
2023-07-21 12:47 ` Richard Biener
2023-07-21 13:11 ` Matthew Malcomson
2023-07-21 13:41 ` Richard Biener
2023-07-21 13:45 ` Xi Ruoyao
2023-07-21 13:58 ` Alexander Monakov
2023-07-21 15:11 ` Xi Ruoyao
2023-07-21 15:56 ` Alexander Monakov
2023-07-21 15:24 ` Matthew Malcomson
2023-08-03 13:38 ` [PATCH] mid-end: Use integral time intervals " Matthew Malcomson
2023-08-03 14:09 ` David Malcolm
2023-08-03 14:54 ` Matthew Malcomson
2023-08-03 15:34 ` David Malcolm
2023-08-04 6:44 ` Richard Biener
2023-08-04 9:41 ` Matthew Malcomson
2023-08-04 10:18 ` Richard Biener [this message]
2023-07-21 12:49 ` [PATCH] Reduce floating-point difficulties " Xi Ruoyao
2023-07-21 17:41 ` Andrew Pinski
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=nycvar.YFH.7.77.849.2308041017440.12935@jbgna.fhfr.qr \
--to=rguenther@suse.de \
--cc=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=matthew.malcomson@arm.com \
--cc=pinskia@gmail.com \
--cc=richard.sandiford@arm.com \
--cc=xry111@xry111.site \
/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.
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).