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 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 "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
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 next sibling parent 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
prev sibling parent Manu <turkeyman gmail.com> writes:
--001a11c1f286334e7a04de3dd95e
Content-Type: text/plain; charset=UTF-8

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


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>


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>


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>


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.


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. --001a11c1f286334e7a04de3dd95e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">On 3 June 2013 06:38, Benjamin Thaut <span dir=3D"ltr">&lt= ;<a href=3D"mailto:code benjamin-thaut.de" target=3D"_blank">code benjamin-= thaut.de</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=3D"= gmail_quote"> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p= adding-left:1ex"><div class=3D"im">Am 01.06.2013 12:18, schrieb Benjamin Th= aut:<br> </div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b= order-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:s= olid;padding-left:1ex"> I&#39;ve taken a look at core.simd and I have to say is unuseable. In a ver= y<div><div class=3D"h5"><br> small test program I already found 3 bugs<br></div></div></blockquote></blo= ckquote><div><br></div><div style>I&#39;ve responded in the bugs, but I&#39= ;ll post here too.</div><div><br></div><blockquote class=3D"gmail_quote" st= yle=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb= (204,204,204);border-left-style:solid;padding-left:1ex"> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p= adding-left:1ex"><div><div class=3D"h5"> 1) Using debug symbols together with core.simd will cause a ICE<br> <a href=3D"http://d.puremagic.com/issues/show_bug.cgi?id=3D10224" target=3D= "_blank">http://d.puremagic.com/issues/<u></u>show_bug.cgi?id=3D10224</a></= div></div></blockquote></blockquote><div><br></div><div style>Yup, this has= bugged me a few times, but I hadn&#39;t pestered Walter yet.</div> <div style><br></div><div style>I usually debug SIMD code with -O -release = though, and I don&#39;t think -g is compatible with those flags anyway in D= MD(?)</div><div style>I just use visual studio&#39;s asm debugging to see w= hat&#39;s going on.</div> <div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p= x 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-lef= t-style:solid;padding-left:1ex"><blockquote class=3D"gmail_quote" style=3D"= margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,20= 4,204);border-left-style:solid;padding-left:1ex"> <div><div class=3D"h5"> 2) The STOUPS instruction is not correctly implemented:<br> <a href=3D"http://d.puremagic.com/issues/show_bug.cgi?id=3D10225" target=3D= "_blank">http://d.puremagic.com/issues/<u></u>show_bug.cgi?id=3D10225</a></= div></div></blockquote></blockquote><div><br></div><div style>True.</div><d= iv style> I never use unaligned vectors ;)</div><div><br></div><blockquote class=3D"g= mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-= left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><bloc= kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-= width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;paddin= g-left:1ex"> <div><div class=3D"h5"> 3) The XMM register allocation is catastrophic:<br> <a href=3D"http://d.puremagic.com/issues/show_bug.cgi?id=3D10226" target=3D= "_blank">http://d.puremagic.com/issues/<u></u>show_bug.cgi?id=3D10226</a></= div></div></blockquote></blockquote><div><br></div><div style>What do you g= et when you remove the explicit mov&#39;s?</div> <div style><pre class=3D"" id=3D"comment_text_2" style=3D"font-size:medium;= white-space:pre-wrap;width:50em;color:rgb(0,0,0)"> float4 result =3D [1,= 2,3,4]; result =3D __simd(XMM.ADDPS, result, result); writefln(&quot;%s&quot;, result.array);</pre></div><div><br></div><bloc= kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-= width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;paddin= g-left:1ex"> <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p= adding-left:1ex"><div><div class=3D"h5"> Whats the current state of core.simd? Is it still beeing worked on?<br> Because it its current state its pretty much unuseable.<br></div></div></bl= ockquote></blockquote><div><br></div><div style>I find it &#39;usable&#39;,= but there are still some holes, and cases where it&#39;s not efficient.</d= iv> <div style>I&#39;ve been working on std.simd (but was afk for the start of = this year) mostly against GDC. Once I&#39;m happy with the API and it&#39;s= producing the correct code in GDC/LDC, then I planned to log a bunch of DM= D bugs to get that up to scratch. But I needed a solid goal-post and units = tests first..</div> <div><br></div><div style>I&#39;m back on std.simd now (although haven&#39;= t had anywhere near as much time as I&#39;d like lately). Hopefully show so= me significant progress soon.</div></div></div></div> --001a11c1f286334e7a04de3dd95e--
Jun 03 2013