public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Patrick McGehearty <patrick.mcgehearty@oracle.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] Improves __ieee754_exp() performance by greater than 5x on sparc/x86.
Date: Mon, 01 Jan 2018 16:31:00 -0000	[thread overview]
Message-ID: <028264ef-2605-07bd-bea0-aaafbbe8f081@oracle.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1801010131530.28505@digraph.polyomino.org.uk>

On 12/31/2017 7:36 PM, Joseph Myers wrote:
> On Fri, 29 Dec 2017, Patrick McGehearty wrote:
>
>> Version 9 of proposed patch.
>>
>> Replaced get_rounding_mode and libc_fesetround() with SET_RESTORE_ROUND
>> to avoid Intel rounding mode issue which showed as test failures in
>> tgamma_upward. Adds noticable overhead for platforms that incur
>> significant cost when rounding mode is already FE_TONEAREST. Added
>> SET_RESTORE_ROUND to two more cases which resolved 1 ulp rounding
>> errors for cexp().
> Is the "5x" in the subject still correct?  (The subject line of a patch
> should be suitable for the summary line of the commit message, so must
> always reflect the current patch version accurately.  Likewise, the text
> of the patch submission, minus anything about changes relative to a
> previous patch version, must be suitable for the longer part of the commit
> message.)
I can't be sure the "make bench" test gives representative data since 
many of the test values
seem at the extreme ranges and may trigger the "extremely precise and 
slow" paths in
the old code. Those tests still show very large improves (mean: old 5473 
vs new 418).
I'll reconfirm with my own "typical values" tests.  I used 5x as a value 
that I considered
very conservative originally to allow for platform to platform 
variations and for differences
with different ideas of "typical values".
>
>> Expanded the scaling table from 64 entries to 128 entries, renaming
>> invln2_64 to invln2_256 as well as ln2_64hi and ln2_64lo to ln2_256hi
>> and ln2_256lo. That reduces the 1 ulp error rate per 1000 values from
>> 1.6 to 0.6.
> I think this expansion - and corresponding increase in cache usage - is a
> bad idea.  Table size should be kept down, consistent with suitable
> accuracy of e.g. < 1 ulp in this case.

The table size verses error rate tradeoff:
  32 entries (512 bytes) 2.95
  64 entries (1K bytes)  1.62
128 entries (2K bytes)  0.98
256 entries (4K bytes)  0.65
That is the number of 1 ulp diffs from the old version per 1000 test values.
As far as I can determine, the old code had an error rate 0.0 values per 
1000.
I was going for more accuracy to reduce the chances for
pushback from the field once this change starts getting used
more widely.

With typical L3 caches now measured in Mbytes/thread
and L2 caches at least 64Kbytes/thread if not 256Kbytes/thread
having modestly larger tables is a reasonable tradeoff,
especially since we are trading so much performance improvement
but giving up some accuracy. I retained the 64 and 128 entry
versions, so I can switch out the table size easily.

>
> This patch version also appears to be missing the fixups I made as part of
> committing the previous patch.  See
> <https://sourceware.org/ml/libc-alpha/2017-12/msg00649.html>.  In addition
> to the extra slowexp.c removals I noted there, I also needed to remove
> trailing whitespace from a few lines - you should make sure your patch
> does not include any additions of lines with trailing spaces, as the
> commit hooks will reject any push that adds such lines.
>
I'll fix the i386, ia64, and m68k issues and look for trailing 
whitespace in all the changed files.

- patrick

  reply	other threads:[~2018-01-01 16:31 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29 23:42 Patrick McGehearty
2018-01-01  1:36 ` Joseph Myers
2018-01-01 16:31   ` Patrick McGehearty [this message]
2018-01-01 16:41     ` Joseph Myers
  -- strict thread matches above, loose matches on Subject: below --
2017-12-08 23:08 Patrick McGehearty
2017-12-11  8:14 ` Siddhesh Poyarekar
2017-12-11 17:04   ` Patrick McGehearty
2017-12-11 17:53     ` Siddhesh Poyarekar
2017-12-14  1:28 ` Joseph Myers
2017-12-18 20:11   ` Patrick McGehearty
2017-12-04 21:53 Patrick McGehearty
2017-12-05 23:20 ` Joseph Myers
2017-12-01  0:51 Patrick McGehearty
2017-12-01  0:56 ` Joseph Myers
2017-11-07  4:25 Patrick McGehearty
2017-11-16 17:52 ` Patrick McGehearty
2017-11-16 18:27   ` Carlos O'Donell
2017-11-16 18:31   ` Joseph Myers
2017-11-23 21:19 ` Joseph Myers
2017-12-01  0:47   ` Patrick McGehearty
2017-10-26 22:53 Patrick McGehearty
2017-11-01  0:26 ` Joseph Myers
2017-10-26 16:44 Patrick McGehearty
2017-10-26 17:20 ` Joseph Myers
2017-10-26 17:25   ` Joseph Myers
2017-10-26 18:30     ` Patrick McGehearty
2017-10-26 19:44       ` Joseph Myers
2017-10-20 13:38 Wilco Dijkstra
2017-10-20 14:58 ` Patrick McGehearty
2017-10-16 16:56 Patrick McGehearty
2017-10-18 17:22 ` Joseph Myers
2017-10-18 23:22   ` Joseph Myers
2017-10-19 22:31   ` Patrick McGehearty
2017-10-19 22:48     ` Joseph Myers
2017-10-20 15:04       ` Patrick McGehearty
2017-10-21  5:23       ` Patrick McGehearty
2017-10-23 12:47         ` Joseph Myers
2017-10-23 19:58           ` Patrick McGehearty
2017-10-23 21:31             ` Joseph Myers
2017-10-20 11:41     ` Szabolcs Nagy
2017-10-20 14:56       ` Patrick McGehearty
2017-10-20 16:10       ` Joseph Myers
2017-10-23 12:25 ` Siddhesh Poyarekar
2017-10-23 15:58   ` Joseph Myers

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=028264ef-2605-07bd-bea0-aaafbbe8f081@oracle.com \
    --to=patrick.mcgehearty@oracle.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.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).