public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/15424] New: modf benchtest gives bogus results
@ 2013-05-01 22:00 ondra at iuuk dot mff.cuni.cz
  2013-05-10  8:19 ` [Bug libc/15424] " siddhesh at redhat dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ondra at iuuk dot mff.cuni.cz @ 2013-05-01 22:00 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15424

             Bug #: 15424
           Summary: modf benchtest gives bogus results
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: unassigned@sourceware.org
        ReportedBy: ondra@iuuk.mff.cuni.cz
                CC: drepper.fsp@gmail.com
    Classification: Unclassified


When running benchtest for modf function I consistently get following results:

modf(): ITERS:2e+06: TOTAL:0.0150672s, MAX:1.32739e+08ns, MIN:9.88625e-321ns,
1.4822e-323 iter/s

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/15424] modf benchtest gives bogus results
  2013-05-01 22:00 [Bug libc/15424] New: modf benchtest gives bogus results ondra at iuuk dot mff.cuni.cz
@ 2013-05-10  8:19 ` siddhesh at redhat dot com
  2013-05-10  9:16 ` neleai at seznam dot cz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: siddhesh at redhat dot com @ 2013-05-10  8:19 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15424

Siddhesh Poyarekar <siddhesh at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |siddhesh at redhat dot com
         AssignedTo|unassigned at sourceware    |siddhesh at redhat dot com
                   |dot org                     |

--- Comment #1 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-05-10 08:19:48 UTC ---
Does this happen with latest master?  Changing from fixed iterations to fixed
time showed such spurious results with bench-modf once (likely because it was
not rebuilt), which went away when I did a bench-clean and rebuilt it.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/15424] modf benchtest gives bogus results
  2013-05-01 22:00 [Bug libc/15424] New: modf benchtest gives bogus results ondra at iuuk dot mff.cuni.cz
  2013-05-10  8:19 ` [Bug libc/15424] " siddhesh at redhat dot com
@ 2013-05-10  9:16 ` neleai at seznam dot cz
  2013-05-17 12:01 ` siddhesh at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: neleai at seznam dot cz @ 2013-05-10  9:16 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15424

--- Comment #2 from Ondrej Bilka <neleai at seznam dot cz> 2013-05-10 09:16:24 UTC ---
On Fri, May 10, 2013 at 08:19:48AM +0000, siddhesh at redhat dot com wrote:
> http://sourceware.org/bugzilla/show_bug.cgi?id=15424
> 
> Siddhesh Poyarekar <siddhesh at redhat dot com> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|NEW                         |WAITING
>                  CC|                            |siddhesh at redhat dot com
>          AssignedTo|unassigned at sourceware    |siddhesh at redhat dot com
>                    |dot org                     |
> 
> --- Comment #1 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-05-10 08:19:48 UTC ---
> Does this happen with latest master?  Changing from fixed iterations to fixed
> time showed such spurious results with bench-modf once (likely because it was
> not rebuilt), which went away when I did a bench-clean and rebuilt it.
>
Now it shows following results. According to them atan is ten times
faster than modf which is clearly wrong.

atan(): ITERS:4.48268e+09: TOTAL:7.79352s, MAX:166.672ns, MIN:0.638ns,
5.7518e+08 iter/s
atan(768bits): ITERS:4.8324e+08: TOTAL:9.83724s, MAX:38.805ns, MIN:17.654ns,
4.91235e+07 iter/s
modf(): ITERS:6.8975e+08: TOTAL:9.53964s, MAX:193.448ns, MIN:4.486ns,
7.23035e+07 iter/s

A following benchmark takes  8.9s which is order of magnitude more than
what benchtest tells.

extern double modf (double, double *);
int main(){ int i;
  double x=0;
  double ret=0;
  double f;
  for(i=0;i<1000000000;i++){
     ret+=modf(x,&f);
    x+=0.1;
  }
  return ret;
}

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/15424] modf benchtest gives bogus results
  2013-05-01 22:00 [Bug libc/15424] New: modf benchtest gives bogus results ondra at iuuk dot mff.cuni.cz
  2013-05-10  8:19 ` [Bug libc/15424] " siddhesh at redhat dot com
  2013-05-10  9:16 ` neleai at seznam dot cz
@ 2013-05-17 12:01 ` siddhesh at redhat dot com
  2013-05-17 13:40 ` siddhesh at redhat dot com
  2014-06-13 18:09 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: siddhesh at redhat dot com @ 2013-05-17 12:01 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15424

--- Comment #3 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-05-17 12:01:27 UTC ---
The problem is not modf, it is the code generated for atan.  gcc figures out
that the atan call is needed only once and optimizes it out of the loop.  It's
a problem with all trigonometrict functions - look for functions that take ~1-2
cycles minimum time.  Patch coming up.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/15424] modf benchtest gives bogus results
  2013-05-01 22:00 [Bug libc/15424] New: modf benchtest gives bogus results ondra at iuuk dot mff.cuni.cz
                   ` (2 preceding siblings ...)
  2013-05-17 12:01 ` siddhesh at redhat dot com
@ 2013-05-17 13:40 ` siddhesh at redhat dot com
  2014-06-13 18:09 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: siddhesh at redhat dot com @ 2013-05-17 13:40 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=15424

Siddhesh Poyarekar <siddhesh at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-05-17 13:40:34 UTC ---
Fixed in master.

commit 48a18de1e1e7dfeab6d034765caaf732b53cfcb7
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri May 17 19:10:33 2013 +0530

    Prevent optimizing out of benchmark function call

    Resolves: #15424

    The compiler would optimize the benchmark function call out of the
    loop and call it only once, resulting in blazingly fast times for some
    benchmarks (notably atan, sin and cos).  Mark the inputs as volatile
    so that the code is forced to read again from the input for each
    iteration.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug libc/15424] modf benchtest gives bogus results
  2013-05-01 22:00 [Bug libc/15424] New: modf benchtest gives bogus results ondra at iuuk dot mff.cuni.cz
                   ` (3 preceding siblings ...)
  2013-05-17 13:40 ` siddhesh at redhat dot com
@ 2014-06-13 18:09 ` fweimer at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13 18:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=15424

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2014-06-13 18:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-01 22:00 [Bug libc/15424] New: modf benchtest gives bogus results ondra at iuuk dot mff.cuni.cz
2013-05-10  8:19 ` [Bug libc/15424] " siddhesh at redhat dot com
2013-05-10  9:16 ` neleai at seznam dot cz
2013-05-17 12:01 ` siddhesh at redhat dot com
2013-05-17 13:40 ` siddhesh at redhat dot com
2014-06-13 18:09 ` fweimer at redhat dot com

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).