[Bug math/20123] New: Enable libmvec vector math library on POWER VSX

classic Classic list List threaded Threaded
31 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] New: Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

            Bug ID: 20123
           Summary: Enable libmvec vector math library on POWER VSX
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: dje at gcc dot gnu.org
  Target Milestone: ---

Add PPC64 LE Linux support for the libmvec vector math library to exploit the
POWER8 VSX SIMD instruction set.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sjmunroe at us dot ibm.com,
                   |                            |tuliom at linux dot vnet.ibm.com

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |powerpc64le-linux

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Enable libmvec vector math  |[powerpc] Enable libmvec
                   |library on POWER VSX        |vector math library on
                   |                            |POWER VSX

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

David Edelsohn <dje at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dje at sourceware dot org

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

Hi-Angel <hi-angel at yandex dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hi-angel at yandex dot ru

--- Comment #1 from Hi-Angel <hi-angel at yandex dot ru> ---
(In reply to David Edelsohn from comment #0)
> Add PPC64 LE Linux support for the libmvec vector math library to exploit
> the POWER8 VSX SIMD instruction set.

Hello, I wanted to take a stab at it, but could you please clarify how am I
supposed to test it? I found "POWER9 Functional Emulator"¹, which comes with a
README on how to run it, however boot-linux-le-skiboot.tcl which supposedly
ought to run a VM quits with errors. E.g.:

        $ tclsh /opt/ibm/systemsim-p9/run/p9/linux/boot-linux-le-skiboot.tcl
        no such variable
                (read trace on "env(LIB_DIR)")
                invoked from within
        "source $env(LIB_DIR)/p9/systemsim.tcl"
                (file
"/opt/ibm/systemsim-p9/run/p9/linux/boot-linux-le-skiboot.tcl" line 77)

I managed to workaround env-related errors by wrapping into a script, but whole
tcl-part seems to be broken because scripts lack lots of functions and
variables. And they're really don't seem to be defined, e.g. it's failing on
renaming `::help`, but there isn't `proc help` to begin with. I defined `help`,
but now it's failing on non-existing `config` variable.

Initially I tried it on Archlinux, but then I installed a Ubuntu VM, and tested
there, it behaves absolutely the same.

-----

Advises on getting an environment for solving the bug is appreciated.

1: https://www-304.ibm.com/webapp/set2/sas/f/pwrfs/pwr9/home.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #2 from Hi-Angel <hi-angel at yandex dot ru> ---
(In reply to Hi-Angel from comment #1)

> (In reply to David Edelsohn from comment #0)
> > Add PPC64 LE Linux support for the libmvec vector math library to exploit
> > the POWER8 VSX SIMD instruction set.
>
> Hello, I wanted to take a stab at it, but could you please clarify how am I
> supposed to test it? I found "POWER9 Functional Emulator"¹, which comes with
> a README on how to run it, however boot-linux-le-skiboot.tcl which
> supposedly ought to run a VM quits with errors. E.g.:
>
> $ tclsh /opt/ibm/systemsim-p9/run/p9/linux/boot-linux-le-skiboot.tcl
> no such variable
> (read trace on "env(LIB_DIR)")
> invoked from within
> "source $env(LIB_DIR)/p9/systemsim.tcl"
> (file "/opt/ibm/systemsim-p9/run/p9/linux/boot-linux-le-skiboot.tcl" line
> 77)
>
> I managed to workaround env-related errors by wrapping into a script, but
> whole tcl-part seems to be broken because scripts lack lots of functions and
> variables. And they're really don't seem to be defined, e.g. it's failing on
> renaming `::help`, but there isn't `proc help` to begin with. I defined
> `help`, but now it's failing on non-existing `config` variable.
>
> Initially I tried it on Archlinux, but then I installed a Ubuntu VM, and
> tested there, it behaves absolutely the same.
>
> -----
>
> Advises on getting an environment for solving the bug is appreciated.
>
> 1: https://www-304.ibm.com/webapp/set2/sas/f/pwrfs/pwr9/home.html

Ok, I found a "install & use" tab on the linked page, from the pdf turned out
the correct command would be

        ./opt/ibm/systemsim-p9/run/p9/power9 -f
opt/ibm/systemsim-p9/run/p9/linux/boot-linux-le-skiboot.tcl

It didn't work this way right away though, didn't recognize paths in tcl script
I ought to edit, and after I got fenced with lots of simlinks it required some
IOCTL. I took a risk of running it under root, and it finally got launched.

A wall of startup text after it presented me with a login prompt. Acc. to
README login=root and password=mambo; but the prompt just doesn't react to the
text being typed. It even quits upon pressing ^C. I'm stuck.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #3 from David Edelsohn <dje at gcc dot gnu.org> ---
The feature request specifies Power8 VSX, not Power9 VSX. There is no need to
access Powerr not to utilize QEMU.

There are numerous Power8 systems publicly available for Open Source
developers.
https://developer.ibm.com/linuxonpower/cloud-resources/

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

Book Moons <waic9e at protonmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |waic9e at protonmail dot com

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #5 from David Edelsohn <dje at gcc dot gnu.org> ---
Power VSX does not support all of the vector modes available on AVX2 and
AVX512, but I believe that Power compatibility with the x86 ABI would be most
convenient. The goal is interoperability with x86 uses of libmvec.

Do you see a reason that libmvec ABI should be different on Power where the VSX
functionality matches AVX?

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

David Edelsohn <dje at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|sjmunroe at us dot ibm.com         |

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #4 from Book Moons <waic9e at protonmail dot com> ---
Hello. I'm digging into this.

There's a Vector Function ABI referenced on the libmvec page. It defines
calling convention and various other things. It seems to be for x86_64 only:
https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt

Is there something like this for POWER8? (Or is determining that maybe part of
this effort?)

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #6 from Book Moons <waic9e at protonmail dot com> ---
Came across this document last night after some more searching.

Power Architecture 64-Bit ELF V2 ABI Specification
https://openpowerfoundation.org/wp-content/uploads/2016/03/ABI64BitOpenPOWERv1.1_16July2015_pub4.pdf

It has a whole section 6 that defines Vector Programming Interfaces. And an
appendix A that gives Predefined Functions for Vector Programming. More high
level support than I anticipated really.

If there's compiler support for this, I wonder if implementing against it is
suitable? Especially the vector data types and vectorized operators seem like
they would make it easier to work with. There are builtin functions defined
that compile down to individual VSX instructions, so full power should be
accessible.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #7 from David Edelsohn <dje at gcc dot gnu.org> ---
One can experiment with implementing libmvec against the VSX intrinsics. The
intrinsics are implemented in GCC, LLVM and XLC.

The mmintrin support in GCC is implemented on top of the VSX intrinsics.

One must look at the resulting code to see if it truly is optimized, and
whether the intrinsic could be improved or the particular function must be
implemented more directly in assembly language.  The answer may be a
combination of the approaches.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #8 from Book Moons <waic9e at protonmail dot com> ---
Understood, thanks David. I'm heading for assembly so I don't have to mess with
it.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #9 from Book Moons <waic9e at protonmail dot com> ---
There's no way to link to bountysource, so I'm establishing the connection
here: my bountysource account is bookmoons.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #10 from Book Moons <waic9e at protonmail dot com> ---
Documents with relevant technical details, for posterity. Will come back to the
ABI question after some more investigation.

Power ISA Version 2.08 (POWER8 spec)
https://web.archive.org/web/20160414023226/https://www.power.org/wp-content/uploads/2013/05/PowerISA_V2.07_PUBLIC.pdf

C11 specification draft (basic definitions of C stdlib functions targeted for
vectorization)
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

POSIX.1-2008 (more complete definitions of C stdlib functions targeted for
vectorization)
http://pubs.opengroup.org/onlinepubs/9699919799/

libm (Math component of glibc, some discussion of vector math)
https://sourceware.org/glibc/wiki/libm

libmvec (Vector math component of glibc)
https://sourceware.org/glibc/wiki/libmvec

GCC PowerPC options (indicates support for ELFV2)
https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/RS_002f6000-and-PowerPC-Options.html

GCC OpenMP support (brief overview)
https://gcc.gnu.org/wiki/openmp

OpenMP 4.0 Specification
http://www.openmp.org/wp-content/uploads/OpenMP4.0.0.pdf

Explicit Vector Programming with OpenMP 4.0 SIMD Extensions (technical overview
article)
http://primeurmagazine.com/repository/PrimeurMagazine-AE-PR-12-14-32.pdf

Power Architecture 64-Bit ELF V2 ABI Specification
https://openpowerfoundation.org/wp-content/uploads/2016/03/ABI64BitOpenPOWERv1.1_16July2015_pub4.pdf

Intel Vector Function ABI 0.9.5 (inspires glibc ABI)
https://www.cilkplus.org/sites/default/files/open_specifications/Intel-ABI-Vector-Function-2012-v0.9.5.pdf

glibc vector function ABI (presented as x86_64 specific, possibly adaptable for
Power)
https://sourceware.org/glibc/wiki/libmvec?action=AttachFile&do=view&target=VectorABI.txt

Discussion of glibc vector function ABI
https://groups.google.com/forum/#!topic/x86-64-abi/LmppCfN1rZ4

sysdeps/x86_64/fpu/multiarch (x86_64 SIMD implementation, in svml_*.*,
ifunc-mathvec-*.h)
https://sourceware.org/git/?p=glibc.git;a=tree;f=sysdeps/x86_64/fpu/multiarch;h=e02f7399c04049978672544f3380567762cc9670;hb=HEAD

libm-simd-decl-stubs.h (definition of expected SIMD optimized math functions)
https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/libm-simd-decl-stubs.h;h=520b4bbe435b18fef936ad3bded4279543e41100;hb=HEAD

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #11 from Book Moons <waic9e at protonmail dot com> ---
Typoed that first document, but it is actually the correct v2.07 / POWER8 of
the ISA spec.

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

--- Comment #12 from Book Moons <waic9e at protonmail dot com> ---
Here's the floating point standard I'm working with, referenced by the ISA.
It's a version prior to the latest.

IEEE 754-1985 (ISA implemented floating point spec)
https://standards.ieee.org/findstds/standard/754-1985.html

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug math/20123] [powerpc] Enable libmvec vector math library on POWER VSX

986882896 at qq dot com
In reply to this post by 986882896 at qq dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20123

David Edelsohn <dje at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |24206


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=24206
[Bug 24206] [powerpc] Enable sin/sinf in libmvec vector math library on POWER
VSX
--
You are receiving this mail because:
You are on the CC list for the bug.
12