www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - The state of core.simd

reply Benjamin Thaut <code benjamin-thaut.de> writes:
I've taken a look at core.simd and I have to say is unuseable. In a very 
small test program I already found 3 bugs

1) Using debug symbols together with core.simd will cause a ICE 
http://d.puremagic.com/issues/show_bug.cgi?id=10224
2) The STOUPS instruction is not correctly implemented: 
http://d.puremagic.com/issues/show_bug.cgi?id=10225
3) The XMM register allocation is catastrophic: 
http://d.puremagic.com/issues/show_bug.cgi?id=10226

Whats the current state of core.simd? Is it still beeing worked on? 
Because it its current state its pretty much unuseable.

Kind Regards
Benjamin Thaut
Jun 01 2013
next sibling parent reply "Tove" <tove fransson.se> writes:
On Saturday, 1 June 2013 at 10:18:27 UTC, Benjamin Thaut wrote:
 I've taken a look at core.simd and I have to say is unuseable. 
 In a very small test program I already found 3 bugs

 1) Using debug symbols together with core.simd will cause a ICE 
 http://d.puremagic.com/issues/show_bug.cgi?id=10224
 2) The STOUPS instruction is not correctly implemented: 
 http://d.puremagic.com/issues/show_bug.cgi?id=10225
 3) The XMM register allocation is catastrophic: 
 http://d.puremagic.com/issues/show_bug.cgi?id=10226

 Whats the current state of core.simd? Is it still beeing worked 
 on? Because it its current state its pretty much unuseable.

 Kind Regards
 Benjamin Thaut
does this generate better code? float4 v = __vector([1.0f, 2.0f, 3.0f, 4.0f]);
Jun 01 2013
parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 01.06.2013 12:52, schrieb Tove:
 does this generate better code?
 float4 v = __vector([1.0f, 2.0f, 3.0f, 4.0f]);
That doesn't even compile. You can try it out yourself using: http://dpaste.dzfl.pl/ Kind Regards Benjamin Thaut
Jun 01 2013
parent reply "Tove" <tove fransson.se> writes:
On Saturday, 1 June 2013 at 10:57:03 UTC, Benjamin Thaut wrote:
 Am 01.06.2013 12:52, schrieb Tove:
 does this generate better code?
 float4 v = __vector([1.0f, 2.0f, 3.0f, 4.0f]);
That doesn't even compile. You can try it out yourself using: http://dpaste.dzfl.pl/ Kind Regards Benjamin Thaut
OK, sorry about that... this compiles, but the 'Disassembly' button is not functional for me... http://dpaste.dzfl.pl/1e0407c3
Jun 01 2013
parent Benjamin Thaut <code benjamin-thaut.de> writes:
Am 01.06.2013 13:37, schrieb Tove:
 On Saturday, 1 June 2013 at 10:57:03 UTC, Benjamin Thaut wrote:
 Am 01.06.2013 12:52, schrieb Tove:
 does this generate better code?
 float4 v = __vector([1.0f, 2.0f, 3.0f, 4.0f]);
That doesn't even compile. You can try it out yourself using: http://dpaste.dzfl.pl/ Kind Regards Benjamin Thaut
OK, sorry about that... this compiles, but the 'Disassembly' button is not functional for me... http://dpaste.dzfl.pl/1e0407c3
The preoduces assembly is exactly as bad: mov qword ptr [rbp+10h],rcx movaps xmm0,xmmword ptr [13F154020h] movaps xmmword ptr [rbp-60h],xmm0 movaps xmm0,xmmword ptr [rbp-60h] movaps xmmword ptr [rbp-50h],xmm0 movdqa xmm0,xmmword ptr [rbp-50h] addps xmm0,xmmword ptr [rbp-50h] movaps xmmword ptr [rbp-50h],xmm0 movdqa xmm0,xmmword ptr [rbp-50h] movaps xmmword ptr [rbp-60h],xmm0
Jun 01 2013
prev sibling next sibling parent reply David <d dav1d.de> writes:
Am 01.06.2013 12:18, schrieb Benjamin Thaut:
 I've taken a look at core.simd and I have to say is unuseable. In a very
 small test program I already found 3 bugs
 
 1) Using debug symbols together with core.simd will cause a ICE
 http://d.puremagic.com/issues/show_bug.cgi?id=10224
 2) The STOUPS instruction is not correctly implemented:
 http://d.puremagic.com/issues/show_bug.cgi?id=10225
 3) The XMM register allocation is catastrophic:
 http://d.puremagic.com/issues/show_bug.cgi?id=10226
 
 Whats the current state of core.simd? Is it still beeing worked on?
 Because it its current state its pretty much unuseable.
 
 Kind Regards
 Benjamin Thaut
This is a good question, I want to implement "core.simd" in gl3n for a while, I hope we can get a proper implementation and std.simd *wink at Manu*
Jun 01 2013
parent Benjamin Thaut <code benjamin-thaut.de> writes:
Am 01.06.2013 14:18, schrieb David:
 This is a good question, I want to implement "core.simd" in gl3n for a
 while, I hope we can get a proper implementation and std.simd *wink at Manu*
Well std.simd will be using core.simd for the dmd version, so core.simd has to be working first.
Jun 01 2013
prev sibling parent reply Benjamin Thaut <code benjamin-thaut.de> writes:
Am 01.06.2013 12:18, schrieb Benjamin Thaut:
 I've taken a look at core.simd and I have to say is unuseable. In a very
 small test program I already found 3 bugs

 1) Using debug symbols together with core.simd will cause a ICE
 http://d.puremagic.com/issues/show_bug.cgi?id=10224
 2) The STOUPS instruction is not correctly implemented:
 http://d.puremagic.com/issues/show_bug.cgi?id=10225
 3) The XMM register allocation is catastrophic:
 http://d.puremagic.com/issues/show_bug.cgi?id=10226

 Whats the current state of core.simd? Is it still beeing worked on?
 Because it its current state its pretty much unuseable.

 Kind Regards
 Benjamin Thaut
Can someone with some knowdelege on the topic please provide some information about the current plans on core.simd? Manu? Walter?
Jun 02 2013
parent Manu <turkeyman gmail.com> writes:
On 3 June 2013 06:38, Benjamin Thaut <code benjamin-thaut.de> wrote:

 Am 01.06.2013 12:18, schrieb Benjamin Thaut:

 I've taken a look at core.simd and I have to say is unuseable. In a very

 small test program I already found 3 bugs
I've responded in the bugs, but I'll post here too. 1) Using debug symbols together with core.simd will cause a ICE
 http://d.puremagic.com/issues/**show_bug.cgi?id=10224<http://d.puremagic.com/issues/show_bug.cgi?id=10224>
Yup, this has bugged me a few times, but I hadn't pestered Walter yet. I usually debug SIMD code with -O -release though, and I don't think -g is compatible with those flags anyway in DMD(?) I just use visual studio's asm debugging to see what's going on. 2) The STOUPS instruction is not correctly implemented:
 http://d.puremagic.com/issues/**show_bug.cgi?id=10225<http://d.puremagic.com/issues/show_bug.cgi?id=10225>
True. I never use unaligned vectors ;) 3) The XMM register allocation is catastrophic:
 http://d.puremagic.com/issues/**show_bug.cgi?id=10226<http://d.puremagic.com/issues/show_bug.cgi?id=10226>
What do you get when you remove the explicit mov's? float4 result = [1,2,3,4]; result = __simd(XMM.ADDPS, result, result); writefln("%s", result.array); Whats the current state of core.simd? Is it still beeing worked on?
 Because it its current state its pretty much unuseable.
I find it 'usable', but there are still some holes, and cases where it's not efficient. I've been working on std.simd (but was afk for the start of this year) mostly against GDC. Once I'm happy with the API and it's producing the correct code in GDC/LDC, then I planned to log a bunch of DMD bugs to get that up to scratch. But I needed a solid goal-post and units tests first.. I'm back on std.simd now (although haven't had anywhere near as much time as I'd like lately). Hopefully show some significant progress soon.
Jun 03 2013