Re: [Qemu-devel] [PATCH v2 00/14] fp-test + hardfloat

2018-03-27 Thread Bastian Koppelmann
Hi Emilio,

On 03/27/2018 07:33 AM, Emilio G. Cota wrote:
> v1: https://lists.nongnu.org/archive/html/qemu-devel/2018-03/msg05908.html
> 
[...]
> 
> Perf numbers are in the last patch. They are a little different than
> last week; I cannot replicate last week's performance (even with
> the very same binaries; might have to reboot the machine I'm using
> soon), but as of today v2 is certainly faster than v1 (e.g. 5% faster
> for nbench-fp).
> 
> I have checked all checkpatch warnings; they're all false positives.
> 
> You can fetch the series from:
>   https://github.com/cota/qemu/tree/hardfloat-v2

When I try to build your tree with gcc version 7.3.1 20180312 (GCC), I get:

  CC  tricore-softmmu/fpu/softfloat.o
/home/kbastian/coding/upstream-qemu/qemu-fpu/fpu/softfloat.c:417:19:
error: conflicting types for ‘canonicalize’
 static FloatParts canonicalize(FloatParts part, const FloatFmt *parm,
   ^~~~
In file included from /usr/include/features.h:423:0,
 from /usr/include/bits/libc-header-start.h:33,
 from /usr/include/math.h:27,
 from
/home/kbastian/coding/upstream-qemu/qemu-fpu/fpu/softfloat.c:85:
/usr/include/bits/mathcalls.h:385:1: note: previous declaration of
‘canonicalize’ was here
 __MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x));

Cheers,
Bastian



Re: [Qemu-devel] [PATCH v2 00/14] fp-test + hardfloat

2018-03-27 Thread Bastian Koppelmann
On 03/27/2018 11:56 AM, Bastian Koppelmann wrote:
> Hi Emilio,
> 
> On 03/27/2018 07:33 AM, Emilio G. Cota wrote:
>> v1: https://lists.nongnu.org/archive/html/qemu-devel/2018-03/msg05908.html
>>
> [...]
>>
>> Perf numbers are in the last patch. They are a little different than
>> last week; I cannot replicate last week's performance (even with
>> the very same binaries; might have to reboot the machine I'm using
>> soon), but as of today v2 is certainly faster than v1 (e.g. 5% faster
>> for nbench-fp).
>>
>> I have checked all checkpatch warnings; they're all false positives.
>>
>> You can fetch the series from:
>>   https://github.com/cota/qemu/tree/hardfloat-v2
> 
> When I try to build your tree with gcc version 7.3.1 20180312 (GCC), I get:
> 
>   CC  tricore-softmmu/fpu/softfloat.o
> /home/kbastian/coding/upstream-qemu/qemu-fpu/fpu/softfloat.c:417:19:
> error: conflicting types for ‘canonicalize’
>  static FloatParts canonicalize(FloatParts part, const FloatFmt *parm,
>^~~~
> In file included from /usr/include/features.h:423:0,
>  from /usr/include/bits/libc-header-start.h:33,
>  from /usr/include/math.h:27,
>  from
> /home/kbastian/coding/upstream-qemu/qemu-fpu/fpu/softfloat.c:85:
> /usr/include/bits/mathcalls.h:385:1: note: previous declaration of
> ‘canonicalize’ was here
>  __MATHDECL_1 (int, canonicalize,, (_Mdouble_ *__cx, const _Mdouble_ *__x));
> 

git bisect points to fb1514a0104df6740e4a60c1b08b5daf173f9737

Author: Emilio G. Cota 
Date:   Sat Mar 17 02:13:59 2018 -0400

fpu: introduce hardfloat

Cheers,
Bastian



Re: [Qemu-devel] [PATCH v2 00/14] fp-test + hardfloat

2018-03-28 Thread Alex Bennée

Emilio G. Cota  writes:

> v1: https://lists.nongnu.org/archive/html/qemu-devel/2018-03/msg05908.html
>
> Changes from v1:
>
> - Rename series from "hostfloat" to "hardfloat". The series already uses
>   "host" as an option for fp-test, so this change should make things clearer
>
> - Rebase on top of master (4c2c101590).
>
> - Move code from fpu/hostfloat.c to fpu/softfloat.c. I am not mentioning
>   anything about the license; I read the softfloat-2a license and I'm OK
>   with it. [ Laurent: thanks for the clarification on this. ]
>
> - Fix target-m68k build breakage
>
> - Merge is_normal and is_denormal additions into a single commit
>
> - Add tricore patch to use float32_is_denormal
>
> - Keep the flatten attribute for the soft-fp implementations that
>   have now become a slow path
>
> - Add the noinline attribute to the soft-fp primitives. Not doing
>   this reduces performance significantly

Yep - we want to avoid the compiler having to inline the complex
softfloat code in the hardfloat fast path. However I think we can still
keep the non-macro style and achieve this.

>
> - Add a comment about why dealing with denormals in hardfloat is
>   a bad idea
>
> - Keep separate float32 and float64 implementations for most ops. This
>   improves performance as shown in the commit logs.
>   + I'm keeping the macro-based definitions to make testing easier.
>   + In v1 I wrongly reported similar float/double results for fp-bench;
>   I noticed that in my testing I forgot to set -p single/double, so I was
>   benchmarking only with the default precision (single). Ouch!
>
> - Update commit logs with fresh (correct) numbers from fp-bench.
>
> - Move some zero-input detection (addsub/div) *after* checking for
>   <= min_normal. This makes the common case (i.e. not all inputs are zero)
>   faster, still allowing us to handle the 0-input cases in hardfloat
>
> - Update the commit log of the comparison patch to mention that
>   int64_to_float32/64 are still in soft-fp and take quite a bit of
>   execution time for fp-bench -o cmp.
>
> - fp-test:
>   + add *.txt to fp-test/.gitignore instead of just whitelist.txt
>
> - fp-bench
>   + generate only positive numbers for testing sqrt
>   + add -o cmp
>   + use g_strjoinv to print the list of available ops in the
> help message
>   + remove libc headers except math.h
>   + use qemu/timer.h's get_clock_realtime instead of open-coding it
>   + add entry to tests/Makefile.include to call fp-test/Makefile
> when building anything in tests/fp-test/
>
> Perf numbers are in the last patch. They are a little different than
> last week; I cannot replicate last week's performance (even with
> the very same binaries; might have to reboot the machine I'm using
> soon), but as of today v2 is certainly faster than v1 (e.g. 5% faster
> for nbench-fp).

And I made mul32 faster in my common code variant:

mul32 Before:
  101.95 MFlops
  102.29 MFlops
  101.62 MFlops

mul32 After:
  154.26 MFlops
  154.42 MFlops
  154.58 MFlops

I don't think macros are needed for this, just careful control of the
inline/flatten boundaries.

What do you think?

>
> I have checked all checkpatch warnings; they're all false positives.
>
> You can fetch the series from:
>   https://github.com/cota/qemu/tree/hardfloat-v2
>
> Thanks,
>
>   Emilio
>
> diffstat:
>  configure   |2 +
>  fpu/softfloat.c |  619 ++--
>  include/fpu/softfloat.h |   20 +
>  target/tricore/fpu_helper.c |9 +-
>  tests/.gitignore|2 +
>  tests/Makefile.include  |6 +-
>  tests/fp-bench.c|  334 +++
>  tests/fp-test/.gitignore|3 +
>  tests/fp-test/Makefile  |   34 ++
>  tests/fp-test/fp-test.c | 1183 ++
>  tests/fp-test/muladd.fptest |   51 ++
>  11 files changed, 2212 insertions(+), 51 deletions(-)
>  create mode 100644 tests/fp-bench.c
>  create mode 100644 tests/fp-test/.gitignore
>  create mode 100644 tests/fp-test/Makefile
>  create mode 100644 tests/fp-test/fp-test.c
>  create mode 100644 tests/fp-test/muladd.fptest


--
Alex Bennée



Re: [Qemu-devel] [PATCH v2 00/14] fp-test + hardfloat

2018-03-29 Thread no-reply
Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 1522128840-498-1-git-send-email-c...@braap.org
Subject: [Qemu-devel] [PATCH v2 00/14] fp-test + hardfloat

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram

commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]   
patchew/20180328130723.20831-1-marcandre.lur...@redhat.com -> 
patchew/20180328130723.20831-1-marcandre.lur...@redhat.com
Switched to a new branch 'test'
acf121ab02 hardfloat: support float32_to_float64
717c53e9e1 hardfloat: support float32/64 comparison
96c01923f0 hardfloat: support float32/64 square root
f2df632dcd hardfloat: support float32/64 fused multiply-add
9ed1261941 hardfloat: support float32/64 division
030055e5dd hardfloat: support float32/64 multiplication
a6ceaae3fd hardfloat: support float32/64 addition and subtraction
85ac349d03 fpu: introduce hardfloat
4661c2c7a8 target/tricore: use float32_is_denormal
bb6b4e9ee9 softfloat: add float{32, 64}_is_{de, }normal
6b0d547870 fp-test: add muladd variants
c56f6dc7d1 softfloat: fix {min, max}nummag for same-abs-value inputs
bfa4c9f682 tests: add fp-test, a floating point test suite
0787c157b4 tests: add fp-bench, a collection of simple floating-point 
microbenchmarks

=== OUTPUT BEGIN ===
Checking PATCH 1/14: tests: add fp-bench, a collection of simple floating-point 
microbenchmarks...
ERROR: braces {} are necessary for all arms of this statement
#158: FILE: tests/fp-bench.c:107:
+} while (!f32_is_normal(r));
[...]

ERROR: braces {} are necessary for all arms of this statement
#183: FILE: tests/fp-bench.c:132:
+} while (!f64_is_normal(r));
[...]

ERROR: spaces required around that '*' (ctx:WxV)
#206: FILE: tests/fp-bench.c:155:
+static void NAME(volatile PRECISION *res)   \
 ^

ERROR: Use of volatile is usually wrong, please add a comment
#206: FILE: tests/fp-bench.c:155:
+static void NAME(volatile PRECISION *res)   \

ERROR: Use of volatile is usually wrong, please add a comment
#212: FILE: tests/fp-bench.c:161:
+volatile PRECISION a;   \

ERROR: Use of volatile is usually wrong, please add a comment
#226: FILE: tests/fp-bench.c:175:
+static void NAME(volatile PRECISION *res)   \

ERROR: Use of volatile is usually wrong, please add a comment
#233: FILE: tests/fp-bench.c:182:
+volatile PRECISION a = glue(get_random_, PRECISION)(&ra);   \

ERROR: Use of volatile is usually wrong, please add a comment
#234: FILE: tests/fp-bench.c:183:
+volatile PRECISION b = glue(get_random_, PRECISION)(&rb);   \

ERROR: Use of volatile is usually wrong, please add a comment
#253: FILE: tests/fp-bench.c:202:
+static void NAME(volatile PRECISION *res)   \

ERROR: Use of volatile is usually wrong, please add a comment
#260: FILE: tests/fp-bench.c:209:
+volatile PRECISION a = glue(get_random_, PRECISION)(&ra);   \

ERROR: Use of volatile is usually wrong, please add a comment
#261: FILE: tests/fp-bench.c:210:
+volatile PRECISION b = glue(get_random_, PRECISION)(&rb);   \

ERROR: Use of volatile is usually wrong, please add a comment
#274: FILE: tests/fp-bench.c:223:
+static void NAME(volatile PRECISION *res)   \

ERROR: Use of volatile is usually wrong, please add a comment
#282: FILE: tests/fp-bench.c:231:
+volatile PRECISION a = glue(get_random_, PRECISION)(&ra);   \

ERROR: Use of volatile is usually wrong, please add a comment
#283: FILE: tests/fp-bench.c:232:
+volatile PRECISION b = glue(get_random_, PRECISION)(&rb);   \

ERROR: Use of volatile is usually wrong, please add a comment
#284: FILE: tests/fp-bench.c:233:
+volatile PRECISION c = glue(get_random_, PRECISION)(&rc);   \

ERROR: braces {} are necessary for all arms of this statement
#359: FILE: tests/fp-bench.c:308:
+} while (0)
[...]

total: 16 errors, 0 warnings, 356 lines checked

Your patch has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

Checking PATCH 2/14: tests: add fp-test, a floating point test suite...
ERROR: Macros with complex values should be enclosed in parenthesis
#391: FILE: tests/fp-test/fp-test.c:

Re: [Qemu-devel] [PATCH v2 00/14] fp-test + hardfloat

2018-03-29 Thread no-reply
Hi,

This series failed build test on s390x host. Please find the details below.

Type: series
Message-id: 1522128840-498-1-git-send-email-c...@braap.org
Subject: [Qemu-devel] [PATCH v2 00/14] fp-test + hardfloat

=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
set -e
echo "=== ENV ==="
env
echo "=== PACKAGES ==="
rpm -qa
echo "=== TEST BEGIN ==="
CC=$HOME/bin/cc
INSTALL=$PWD/install
BUILD=$PWD/build
echo -n "Using CC: "
realpath $CC
mkdir -p $BUILD $INSTALL
SRC=$PWD
cd $BUILD
$SRC/configure --cc=$CC --prefix=$INSTALL
make -j4
# XXX: we need reliable clean up
# make check -j4 V=1
make install
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
acf121ab02 hardfloat: support float32_to_float64
717c53e9e1 hardfloat: support float32/64 comparison
96c01923f0 hardfloat: support float32/64 square root
f2df632dcd hardfloat: support float32/64 fused multiply-add
9ed1261941 hardfloat: support float32/64 division
030055e5dd hardfloat: support float32/64 multiplication
a6ceaae3fd hardfloat: support float32/64 addition and subtraction
85ac349d03 fpu: introduce hardfloat
4661c2c7a8 target/tricore: use float32_is_denormal
bb6b4e9ee9 softfloat: add float{32, 64}_is_{de, }normal
6b0d547870 fp-test: add muladd variants
c56f6dc7d1 softfloat: fix {min, max}nummag for same-abs-value inputs
bfa4c9f682 tests: add fp-test, a floating point test suite
0787c157b4 tests: add fp-bench, a collection of simple floating-point 
microbenchmarks

=== OUTPUT BEGIN ===
=== ENV ===
LANG=en_US.UTF-8
XDG_SESSION_ID=120232
USER=fam
PWD=/var/tmp/patchew-tester-tmp-t8mztrft/src
HOME=/home/fam
SHELL=/bin/sh
SHLVL=2
PATCHEW=/home/fam/patchew/patchew-cli -s http://patchew.org --nodebug
LOGNAME=fam
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1012/bus
XDG_RUNTIME_DIR=/run/user/1012
PATH=/usr/bin:/bin
_=/usr/bin/env
=== PACKAGES ===
gpg-pubkey-873529b8-54e386ff
glibc-debuginfo-common-2.24-10.fc25.s390x
fedora-release-26-1.noarch
dejavu-sans-mono-fonts-2.35-4.fc26.noarch
xemacs-filesystem-21.5.34-22.20170124hgf412e9f093d4.fc26.noarch
bash-4.4.12-7.fc26.s390x
freetype-2.7.1-9.fc26.s390x
libSM-1.2.2-5.fc26.s390x
libmpc-1.0.2-6.fc26.s390x
libaio-0.3.110-7.fc26.s390x
libverto-0.2.6-7.fc26.s390x
perl-Scalar-List-Utils-1.48-1.fc26.s390x
iptables-libs-1.6.1-2.fc26.s390x
p11-kit-trust-0.23.9-2.fc26.s390x
tcl-8.6.6-2.fc26.s390x
libxshmfence-1.2-4.fc26.s390x
expect-5.45-23.fc26.s390x
perl-Thread-Queue-3.12-1.fc26.noarch
perl-encoding-2.19-6.fc26.s390x
keyutils-1.5.10-1.fc26.s390x
gmp-devel-6.1.2-4.fc26.s390x
enchant-1.6.0-16.fc26.s390x
net-snmp-libs-5.7.3-17.fc26.s390x
python-gobject-base-3.24.1-1.fc26.s390x
python3-enchant-1.6.10-1.fc26.noarch
python-lockfile-0.11.0-6.fc26.noarch
python2-pyparsing-2.1.10-3.fc26.noarch
python2-lxml-4.1.1-1.fc26.s390x
librados2-10.2.7-2.fc26.s390x
trousers-lib-0.3.13-7.fc26.s390x
libpaper-1.1.24-14.fc26.s390x
libdatrie-0.2.9-4.fc26.s390x
libsoup-2.58.2-1.fc26.s390x
passwd-0.79-9.fc26.s390x
bind99-libs-9.9.10-3.P3.fc26.s390x
python3-rpm-4.13.0.2-1.fc26.s390x
systemd-233-7.fc26.s390x
virglrenderer-0.6.0-1.20170210git76b3da97b.fc26.s390x
s390utils-ziomon-1.36.1-3.fc26.s390x
s390utils-osasnmpd-1.36.1-3.fc26.s390x
libXrandr-1.5.1-2.fc26.s390x
libglvnd-glx-1.0.0-1.fc26.s390x
texlive-ifxetex-svn19685.0.5-33.fc26.2.noarch
texlive-psnfss-svn33946.9.2a-33.fc26.2.noarch
texlive-dvipdfmx-def-svn40328-33.fc26.2.noarch
texlive-natbib-svn20668.8.31b-33.fc26.2.noarch
texlive-xdvi-bin-svn40750-33.20160520.fc26.2.s390x
texlive-cm-svn32865.0-33.fc26.2.noarch
texlive-beton-svn15878.0-33.fc26.2.noarch
texlive-fpl-svn15878.1.002-33.fc26.2.noarch
texlive-mflogo-svn38628-33.fc26.2.noarch
texlive-texlive-docindex-svn41430-33.fc26.2.noarch
texlive-luaotfload-bin-svn34647.0-33.20160520.fc26.2.noarch
texlive-koma-script-svn41508-33.fc26.2.noarch
texlive-pst-tree-svn24142.1.12-33.fc26.2.noarch
texlive-breqn-svn38099.0.98d-33.fc26.2.noarch
texlive-xetex-svn41438-33.fc26.2.noarch
gstreamer1-plugins-bad-free-1.12.3-1.fc26.s390x
xorg-x11-font-utils-7.5-33.fc26.s390x
ghostscript-fonts-5.50-36.fc26.noarch
libXext-devel-1.3.3-5.fc26.s390x
libusbx-devel-1.0.21-2.fc26.s390x
libglvnd-devel-1.0.0-1.fc26.s390x
emacs-25.3-3.fc26.s390x
alsa-lib-devel-1.1.4.1-1.fc26.s390x
kbd-2.0.4-2.fc26.s390x
dconf-0.26.0-2.fc26.s390x
ccache-3.3.4-1.fc26.s390x
mc-4.8.19-5.fc26.s390x
doxygen-1.8.13-9.fc26.s390x
dpkg-1.18.24-1.fc26.s390x
libtdb-1.3.13-1.fc26.s390x
python2-pynacl-1.1.1-1.fc26.s390x
nss-sysinit-3.34.0-1.0.fc26.s390x
kernel-4.13.16-202.fc26.s390x
perl-Filter-1.58-1.fc26.s390x
python2-pip-9.0.1-11.fc26.noarch
dnf-2.7.5-2.fc26.noarch
sssd-common-1.16.0-4.fc26.s390x
python2-sssdconfig-1.16.0-4.fc26.noarch
bind-license-9.11.2-1.P1.fc26.noarch
libtasn1-4.13-1.fc26.s390x
glusterfs-fuse-3.10.10-1.fc26.s390x
cpp-7.3.1-2.fc26.s390x
pkgconf-1.3.12-2.fc26.s390x
python2-fedora-0.10.0-1.fc26.noarch
cmake