This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] PowerPC: modf optimization
- From: Andreas Jaeger <aj at suse dot com>
- To: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- Cc: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>, "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Wed, 27 Mar 2013 15:11:58 +0100
- Subject: Re: [PATCH] PowerPC: modf optimization
- References: <51508CA8 dot 5090203 at linux dot vnet dot ibm dot com> <515091DD dot 5030504 at suse dot com> <51509695 dot 7020508 at linux dot vnet dot ibm dot com> <CAAHN_R3H+6gxbCRWqGapdz5JGJhfVLePqfo08P4xGkaDMXRRUg at mail dot gmail dot com> <5152F9C4 dot 1000705 at linux dot vnet dot ibm dot com>
On 03/27/2013 02:53 PM, Adhemerval Zanella wrote:
On 03/26/2013 09:51 AM, Siddhesh Poyarekar wrote:
On 25 March 2013 23:55, Adhemerval Zanella <azanella@linux.vnet.ibm.com> wrote:
I measuring with a simple benchmark that calls the function multiple times and
calculate the average time on different kind of inputs. I'll check the benchmark
testsuite.
Oh yes please! The instructions in benchtests/Makefile should be
sufficient, but please don't hesitate to reach out to me directly too
if needed.
Thanks,
Siddhesh
Ok, here it an updated version using the benchtest framework. Using it I got:
PATCH - m32: modf: ITERS:200000: TOTAL:0.00169022s, MAX:16.982ns, MIN:7.118ns, 1.18328e+08 iter/s
MASTER: modf: ITERS:200000: TOTAL:0.00307463s, MAX:18.642ns, MIN:13.8ns, 6.50484e+07 iter/s
PATCH - m64: modf: ITERS:200000: TOTAL:0.0011649s, MAX:8.36ns, MIN:5.458ns, 1.71688e+08 iter/s
MASTER modf: ITERS:200000: TOTAL:0.00340596s, MAX:21.344ns, MIN:16.85ns, 5.87206e+07 iter/s
Current patch adds the objects s_floor, s_ceil, s_floorf, and s_ceilf on libc.so
(since __ceil and __floor needs redirection to its implementation for POWER4). I
thought about an option on adding this optimization solely for POWER5+, avoiding
this inclusion. Any tips, advices, comments?
--
I'm fine with the benchtests addition (see one comment below).
I'm not sure about the __ceil, __floor issue and would like feedback
from others on how to handle this,
Andreas
2013-03-25 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* sysdeps/powerpc/fpu/s_modf.c: New file: modf optimization for POWER.
* sysdeps/powerpc/fpu/s_modff.c: New file: modff optimization for POWER.
* sysdeps/powerpc/fpu/Makefile: Add s_floor[f] and s_ceil[f] for
powerpc64/POWER4 builds.
* benchtests/Makefile: Add modf testcase.
* benchtests/bench-modf.c: New file: Benchmark test for modf.
--
[...]
diff --git a/benchtests/bench-modf.c b/benchtests/bench-modf.c
new file mode 100644
index 0000000..1751bee
--- /dev/null
+++ b/benchtests/bench-modf.c
@@ -0,0 +1,10 @@
Please always add a copyright header.
+extern double modf ( double, double*);
+#define CALL_BENCH_FUNC(j, i) modf ( in[j].arg0, &i);
+struct args { double arg0; } in[] = {{42.42}, {-42.42}
+};
+#define NUM_SAMPLES (sizeof (in) / sizeof (struct args))
+static volatile double ret = 0.0;
+#define BENCH_FUNC(j) ({double iptr; ret = CALL_BENCH_FUNC (j, iptr);})
+#define ITER 100000
+#define FUNCNAME "modf"
+#include "bench-skeleton.c"
--
Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn,Jennifer Guild,Felix Imendörffer,HRB16746 (AG Nürnberg)
GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126