Skip to content

Conversation

TurkeyMan
Copy link
Contributor

I'll leave this here for visibility and commentary.

TurkeyMan and others added 23 commits January 10, 2015 12:18
…ufMask had inverse order of arguments compared to the current one).
Adding LDC support.

Added LDC support to more functions.

More LDC support.

More LDC support.

Added a shitload of LLVM intrinsic declaration and changed most of version(GNU) to version(GNU_OR_LDC).

More LDC support.

Use ldc.gccbuiltins.

Fixed a few bugs.

Fixed a bug in swizzle in parseElements.

Made toFloat, toInt and toDouble work when the argument and the result have the same type.

Moved std.simd.numElements definition to a separate template, which stops LDC from allocating an array at run time.

Made a few things work with GDC.

Added support for byte, ubyte, short and ushort vectors to GDC version of swizzle

Added void16 to isVector.

Replaced spaces with tabs and removed trailing whitespace

Uncomented safe, pure, @nothrow.
…nline_ir.

Implemented maskEqual and others for all types.

Made more function instances work

Made abs() work with unsigned numbers. I think just returning the
parameter is more useful here than causing an error.

Made abs() work with long2 (using the same implementation as for
byte16).

Made min() and max() work with long2 and ulong2.

Use inline llvm ir in loadUnaligned

Also made the naming of variables inside shufflevector,
insertelement, etc. more consistent.

Use ldc.simd.
Supports const/immutable/shared.
Fixed some bugs.
@andralex
Copy link
Member

Noice! ETA for getting this to reviewable state?

@TurkeyMan
Copy link
Contributor Author

I really don't know, there are hurdles...
I don't know what SIMD level was supplied to any compiler on the command line (ie, '-msse2' needs to be reflected in a version or something), and DMD doesn't have such a command line option. The 'target' attribute has problems in GCC. unittests are being a problem; CTFE doesn't work for loads of maths stuff (for unittesting).

There's a bunch of things, I'll attempt to recall the complete set and perhaps bug them individually or something?

@bearophile
Copy link

Yes, "bug" them individually in Bugzilla sounds like a good idea.

@quickfur
Copy link
Member

ping
Any updates on this? It's been a year...

@wilzbach
Copy link
Contributor

I saw that @lakh has done his own implementation - maybe he might be able to tell us his reasons.
Btw DAutoTest is failing ...

@TurkeyMan
Copy link
Contributor Author

It's still blocked on the compilers. I still have no way to detect what simd version was supplied to the compiler on the command line on GCC/Clang, and DMD has no such concept. The library can't emit opcodes that violate the simd level request made to the compiler; I need to know the level requested and then I can produce the best code for that level using static if.

@greenify His implementation comes at it from a totally different angle. His focuses on just wrapping up the arch-specific intrinsics rather than making a usable portable library, it's lower level than mine. It has its place, but I obviously don't agree that's the right approach or I would have written mine that way. Anyone who wants to hit the intrinsics directly will do just that. I tried very hard to strike a practical balance between low-level-ness, efficiency, high-level-usability, and portability.
I'm more-or-less happy with my API, but it doesn't work unless the compilers can provide the information I need at compile-time.

@JackStouffer
Copy link
Contributor

@TurkeyMan Are there bugs for these problems?

@WalterBright
Copy link
Member

@WalterBright
Copy link
Member

DMD has no such concept

See the D_SIMD predefined version:
https://dlang.org/spec/version.html

@wilzbach
Copy link
Contributor

ping @TurkeyMan - did the SIMD discussion solve your problems?

@TurkeyMan
Copy link
Contributor Author

Not really.
Honestly, I've been trying to identify the key thing that keeps me from pushing this task to my foreground, and possibly the biggest thing that's holding me back here is writing the literally zillions of unit tests required to get this across the line, and spending god-knows-how-many hours scrutinising code generation across the suite of architectures I care about. I just haven't had the time :/ .. The other problems I have discussed are indeed awkward and produce a decent friction to getting back on track, but I could find the motivation to push through them if not for the much larger load of grunt work waiting for me on the other side.
The color module is more critical to my current work, and I think it's significantly smaller in scope too... if I can't even get that in good shape to everyone's satisfaction, this feels even more daunting.

Anyway, I am keen to see this done, but it's a particularly hard module to get right. I think it might be best to approach broken into small sets of related functions?
Or if someone wants to help me with the unittesting the thing, I can then take that time to scrutinise codegen properly for all the target arch's.

@wilzbach
Copy link
Contributor

Anyway, I am keen to see this done, but it's a particularly hard module to get right. I think it might be best to approach broken into small sets of related functions?
Or if someone wants to help me with the unittesting the thing, I can then take that time to scrutinise codegen properly for all the target arch's.

Yep I would recommend to put it on dub, it's more visible to other people, easier to test and submit PRs ;-)

@TurkeyMan
Copy link
Contributor Author

It's been there for like, a long time: https://code.dlang.org/packages/simd

@JackStouffer
Copy link
Contributor

Why not make it work on one architecture just to start? Because it's experimental your proposal doesn't have to be feature complete.

@MetaLang
Copy link
Member

MetaLang commented Aug 6, 2017

I'm going to close this as it'll have to go through the Phobos review process regardless, and it's on dub so there's not a huge rush to get it into Phobos.

@bioinfornatics
Copy link

is it a dead feature request with any interest ?

@wilzbach wilzbach added Review:Orphaned The author of the PR is no longer available and this PR can be adopted by anyone. Review:Phantom Zone Has value/information for future work, but closed for now labels Jan 10, 2019
@wilzbach
Copy link
Contributor

is it a dead feature request with any interest ?

Well, the package is on dub (https://code.dlang.org/packages/simd) and so far there hasn't been much interest in pushing this into phobos.

That being said, this is up for take for anyone who's willing to push for this and open a PR to std.experimental.simd. Though I recommend starting a NG discussion before investing serious work.

@PetarKirov
Copy link
Member

@bioinfornatics I recommend checking out https://github.com/AuburnSounds/intel-intrinsics

@TurkeyMan
Copy link
Contributor Author

I'm still interested in this, but it needs to be done in a more incremental manner. It's impossible to get any major development through here without doing it in small steps.

@wilzbach
Copy link
Contributor

FWIW we could start with a very small std.experimental.simd (?) and slowly grow it over time as I agree that anything with a big diff just won't get reviews...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Review:Needs Review Review:Orphaned The author of the PR is no longer available and this PR can be adopted by anyone. Review:Phantom Zone Has value/information for future work, but closed for now
Projects
None yet
Development

Successfully merging this pull request may close these issues.