public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/64432] [5 Regression] SYSTEM_CLOCK(COUNT_RATE=rate) wrong result for integer(4)::rate
Date: Sun, 04 Jan 2015 22:53:00 -0000	[thread overview]
Message-ID: <bug-64432-4-A4AJZ34LIQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64432-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64432

--- Comment #13 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Francois-Xavier Coudert from comment #12)
> (In reply to Harald Anlauf from comment #10)
> > Partial patch to handle proposed behavior of system_clock
> 
> Thanks for the partial patch. Some quick critique:
>   - it doesn't handle mixed argument kinds (you said you don't care, but
> others might)

I originally said that I wouldn't care, but after playing with other
compilers I reconsidered (see comment #7).

Actually the patch does handle it in the most simple way: all arguments
are independent.  See the test case in comment #11.  (My tentative patch
did not remove code that compares the kinds of the arguments etc.)

>   - it creates multiple calls to the library (performance issue, especially
> on a timing routine)

True.  But as long as only COUNT is present, there's no performance
difference to the old behavior.  That's how I use SYSTEM_CLOCK.

Optimizations for multiple present arguments are possible but require
lengthy coding.  I haven't looked at the library code, but calls to
determine count_max and count_rate should be extremely cheap.

>   - I disagree with the logic for COUNT_RATE: we don't care what kind it is,
> because any "decent" kind (32-bit int, 64-bit int, or any real kind) is
> large enough to store the value.

Probably true for all present and future gfortran implementations.
(With crayftn I have seen COUNT_RATE = cpu clockspeed for integer(8),
and 2.6 GHz is too large for 32 bit...).

Nevertheless, I'd prefer the same COUNT_RATE for default integer(4)
and default real(4), and similarly for integer(>=8) and real(>=8).

> We've got to define an implementation that works for everyone, and for all
> corner cases. Then we can implement it. I've indicated on comp.lang.fortran
> what I think is the best strategy:
> 
>   a) if any integer kind is 1 or 2, we emit a warning at compile-time and
> behave as if no clock is available

OK.  This is better than a timer with ridiculously low count_rate/_max.

>   b) for COUNT_RATE, we treat a real as a "wide" int (64-bit or more)

I'd prefer real(4) ~ integer(4), see above reasoning.

>   c) if the kinds of present arguments don't match, issue a compile-time
> warning

OK.  (No other compiler I've met complains here, but it's good to warn
users to expect trouble).

>   d) if all present args are wide, go for high-res, otherwise go for low-res.

That's up to you.  But I'd prefer to stay consistent with what other
compilers do.  (I didn't post the crayftn behavior, but it is sort
of similar to what Intel does, except for somewhat odd count_rates.)

> How does that sound?
> 
> 
> I will have some time to deal with this in a week.


  parent reply	other threads:[~2015-01-04 22:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 10:44 [Bug fortran/64432] New: " anlauf at gmx dot de
2014-12-29 11:14 ` [Bug fortran/64432] " anlauf at gmx dot de
2014-12-29 11:18 ` anlauf at gmx dot de
2014-12-29 11:20 ` janus at gcc dot gnu.org
2014-12-29 11:21 ` janus at gcc dot gnu.org
2014-12-29 14:13 ` fxcoudert at gcc dot gnu.org
2014-12-29 15:04 ` anlauf at gmx dot de
2014-12-29 15:23 ` anlauf at gmx dot de
2014-12-30  9:48 ` Joost.VandeVondele at mat dot ethz.ch
2014-12-30 10:05 ` Joost.VandeVondele at mat dot ethz.ch
2015-01-04 21:47 ` anlauf at gmx dot de
2015-01-04 21:56 ` anlauf at gmx dot de
2015-01-04 22:04 ` fxcoudert at gcc dot gnu.org
2015-01-04 22:53 ` anlauf at gmx dot de [this message]
2015-01-09 11:20 ` rguenth at gcc dot gnu.org
2015-01-09 14:12 ` jakub at gcc dot gnu.org
2015-01-19 20:49 ` anlauf at gmx dot de
2015-02-11 21:20 ` jvdelisle at gcc dot gnu.org
2015-02-13 22:31 ` anlauf at gmx dot de
2015-02-15  4:59 ` jvdelisle at gcc dot gnu.org
2015-02-16  3:14 ` jvdelisle at gcc dot gnu.org
2015-02-16 12:04 ` anlauf at gmx dot de
2015-02-16 20:04 ` jvdelisle at gcc dot gnu.org
2015-02-18  4:21 ` jvdelisle at gcc dot gnu.org
2015-02-18 20:04 ` anlauf at gmx dot de
2015-02-18 20:12 ` anlauf at gmx dot de
2015-02-19 16:32 ` jvdelisle at gcc dot gnu.org
2015-02-20 17:11 ` jvdelisle at gcc dot gnu.org
2015-02-20 22:14 ` anlauf at gmx dot de
2015-02-22 12:06 ` dominiq at lps dot ens.fr
2015-02-22 12:56 ` dominiq at lps dot ens.fr
2015-02-22 17:11 ` jvdelisle at gcc dot gnu.org
2015-02-26 17:44 ` jvdelisle at gcc dot gnu.org
2015-03-15 21:29 ` anlauf at gmx dot de
2015-03-17  1:02 ` jvdelisle at gcc dot gnu.org
2015-03-17  1:05 ` jvdelisle at gcc dot gnu.org
2015-03-17  1:22 ` jvdelisle at gcc dot gnu.org
2015-03-17 21:16 ` anlauf at gmx dot de
2015-03-17 22:33 ` jvdelisle at gcc dot gnu.org
2015-03-18  1:47 ` jvdelisle at gcc dot gnu.org
2015-03-20  7:38 ` jvdelisle at gcc dot gnu.org

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=bug-64432-4-A4AJZ34LIQ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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.
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).