std::experimental::simd implementation

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

std::experimental::simd implementation

Matthias Kretz-2
I'm working on getting my code reorganized, refactored, and underscored for
submission to libstdc++. You can find the current state at: https://
github.com/VcDevel/Vc/tree/mkretz/contribute_to_libstdc%2B%2B/experimental

I'll need a bit of help to get it ready:

* I'm sure there's a bit of internal machinery that I had to write that
libstdc++ already has. Any idea how to deduplicate this? I have no idea about
the libstdc++ internals.

* Naming conventions. I've started adding underscores, but I guess you'd like
to have at least _M_ prefixes for data members? Where do I find the
documentation?

* I have no idea how to integrate my tests. I have not even tried to
understand how testing currently works in libstdc++, so that's at least one
part... ;-)

* I reduced the number of source files. But 200k headers isn't pretty either.
There's still some room for refactoring to get the size down (constexpr if is
such a great help - and my (too late) discovery how to deduce value_type and
size from a [[gnu::vector_size(N)]] builtin type) - I'm mostly focusing on
this. (I'm down from more than 1MB total size.)

* I have a lot of x86 specific code (using intrinsics) to avoid missed
optimization. I prefer to keep them in constexpr if blocks, as otherwise the
boilerplate for extra functions just explodes. Is that acceptable?

So far.
Cheers,
  Matthias

--
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                                https://kretzfamily.de
 GSI Helmholtzzentrum für Schwerionenforschung             https://gsi.de
 SIMD easy and portable                     https://github.com/VcDevel/Vc
──────────────────────────────────────────────────────────────────────────
Reply | Threaded
Open this post in threaded view
|

Re: std::experimental::simd implementation

Jonathan Wakely-3
On 01/11/18 17:34 +0100, Matthias Kretz wrote:
>I'm working on getting my code reorganized, refactored, and underscored for
>submission to libstdc++.

Great!

>You can find the current state at: https://
>github.com/VcDevel/Vc/tree/mkretz/contribute_to_libstdc%2B%2B/experimental

>I'll need a bit of help to get it ready:
>
>* I'm sure there's a bit of internal machinery that I had to write that
>libstdc++ already has. Any idea how to deduplicate this? I have no idea about
>the libstdc++ internals.
>
>* Naming conventions. I've started adding underscores, but I guess you'd like
>to have at least _M_ prefixes for data members? Where do I find the
>documentation?

Yes, _M_ for data members and member functions, or _S_ if they're
static (we have a few static members that use _M_ but they shouldn't
really).

The docs are at https://gcc.gnu.org/onlinedocs/libstdc++/manual/source_code_style.html

>* I have no idea how to integrate my tests. I have not even tried to
>understand how testing currently works in libstdc++, so that's at least one
>part... ;-)

Just put .cc files anywhere under one of the existing test
directories. The script scripts/create_testsuite_files shows the
commands used to find files to be tested.

If a test is expected to fail (e.g. you're testing that something
*doesn't* compile) then things get a bit more complicated, but
basically you just need to add some DejaGnu directives in comments,
e.g. // { dg-error "invalid conversion" }

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/test.html for full
details.

The main docs in the GCC internals manual:
https://gcc.gnu.org/onlinedocs/gccint/Directives.html

Also https://gcc.gnu.org/onlinedocs/libstdc++/manual/source_organization.html

>* I reduced the number of source files. But 200k headers isn't pretty either.
>There's still some room for refactoring to get the size down (constexpr if is
>such a great help - and my (too late) discovery how to deduce value_type and
>size from a [[gnu::vector_size(N)]] builtin type) - I'm mostly focusing on
>this. (I'm down from more than 1MB total size.)
>
>* I have a lot of x86 specific code (using intrinsics) to avoid missed
>optimization. I prefer to keep them in constexpr if blocks, as otherwise the
>boilerplate for extra functions just explodes. Is that acceptable?

I'll try to look more closely tomorrow and answer these questions.