This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/15936] New: Computing sin and cos is very slow when using AVX-powered processors


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

            Bug ID: 15936
           Summary: Computing sin and cos is very slow when using
                    AVX-powered processors
           Product: glibc
           Version: 2.17
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: faltet at gmail dot com

Created attachment 7191
  --> http://sourceware.org/bugzilla/attachment.cgi?id=7191&action=edit
C program showing an slow behavior of sin/cos

When computing expressions containing sin() and cos() (and possibly more), I am
experiencing very slow performance.

In the attachment you can see a program that takes around 2.3 sec on my
Intel(R) Core(TM) i5-3380M CPU @ 2.90GHz using openSUSE 12.3 (latest) and glibc
2.17, while in a virtual machine inside this machine (using VirtualBox here)
with no support for AVX the time for executing the same code goes down to 0.436
sec (5x faster).  The virtual machine uses Ubuntu Quantal 64 bit with glibc
(libc6) 2.15.

The fact that supports my suspicion that AVX support is flaky in libm is that
'perf top' is reporting the next usage in my machine:

```
 49.72%  libm-2.17.so                 [.] feraiseexcept
 21.34%  libm-2.17.so                 [.] __cos_avx
 20.75%  libm-2.17.so                 [.] __sin_avx
  2.26%  bug-avx                      [.] main
```

so apparently the AVX versions of cos and sin are incorrectly raising floating
point exceptions (feraiseexcept) that should not happen.  In my virtual machine
(Ubuntu Quantal 64, glibc 2.15) 'perf top' reports this:

```
 61.52%  libm-2.15.so        [.] sincos
  8.50%  perf_3.5.0-21       [.] 0x00000000000413f0
  6.45%  libc-2.15.so        [.] 0x000000000008044b
  5.96%  bug-avx             [.] main
```

We tried a another native OS, Fedora 19, which comes with glibc 2.17 and with a
processor that supports AVX, and we are getting an important slowdown too.

Thanks

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]