Re: Very simple SIMD programming

2012-10-25 Thread bearophile
Walter Bright: Making SIMD code that delivers performance turns out to be a highly quirky and subtle exercise, one that is resistant to formalization. I have written some SIMD code, with mixed results, so I understand part of such problems, despite my total experience on such things is limi

Re: Very simple SIMD programming

2012-10-25 Thread Walter Bright
On 10/25/2012 4:13 AM, bearophile wrote: > Manu: > >> I think this is far more convenient than any crazy 'if' syntax :) .. It's >> also perfectly optimal on all architectures I know aswell! > > You should show more respect for them and their work. Their ideas seem very far > from being crazy. The

Re: Very simple SIMD programming

2012-10-25 Thread Andrei Alexandrescu
On 10/25/12 7:13 AM, bearophile wrote: Manu: I think this is far more convenient than any crazy 'if' syntax :) .. It's also perfectly optimal on all architectures I know aswell! You should show more respect for them and their work. Their ideas seem very far from being crazy. They have also pr

Re: Very simple SIMD programming

2012-10-25 Thread Manu
On 25 October 2012 14:13, bearophile wrote: > Manu: > > > I think this is far more convenient than any crazy 'if' syntax :) .. It's >> also perfectly optimal on all architectures I know aswell! >> > > You should show more respect for them and their work. Their ideas seem > very far from being cr

Re: Very simple SIMD programming

2012-10-25 Thread bearophile
Manu: I think this is far more convenient than any crazy 'if' syntax :) .. It's also perfectly optimal on all architectures I know aswell! You should show more respect for them and their work. Their ideas seem very far from being crazy. They have also proved their type system to be sound. T

Re: Very simple SIMD programming

2012-10-25 Thread Manu
On 25 October 2012 13:38, Iain Buclaw wrote: > On 25 October 2012 09:36, Manu wrote: > > On 25 October 2012 02:18, Iain Buclaw wrote: > >> > >> On 25 October 2012 00:16, Manu wrote: > >> > On 25 October 2012 02:01, Iain Buclaw wrote: > >> >> > >> >> On 24 October 2012 23:46, Manu wrote: > >>

Re: Very simple SIMD programming

2012-10-25 Thread Iain Buclaw
On 25 October 2012 09:36, Manu wrote: > On 25 October 2012 02:18, Iain Buclaw wrote: >> >> On 25 October 2012 00:16, Manu wrote: >> > On 25 October 2012 02:01, Iain Buclaw wrote: >> >> >> >> On 24 October 2012 23:46, Manu wrote: >> >> >> >> > Let's consider your example above for instance, I w

Re: Very simple SIMD programming

2012-10-24 Thread Iain Buclaw
On 25 October 2012 00:16, Manu wrote: > On 25 October 2012 02:01, Iain Buclaw wrote: >> >> On 24 October 2012 23:46, Manu wrote: >> >> > Let's consider your example above for instance, I would rewrite (given >> > existing syntax): >> > >> > // vector length of context = 1; current_mask = T >> >

Re: Very simple SIMD programming

2012-10-24 Thread Iain Buclaw
On 24 October 2012 23:46, Manu wrote: > On 25 October 2012 01:00, bearophile wrote: >> >> Manu: >> >> >>> The compiler would have to do some serious magic to optimise that; >>> flattening both sides of the if into parallel expressions, and then >>> applying the mask to combine... >> >> >> I think

Re: Very simple SIMD programming

2012-10-24 Thread Manu
On 25 October 2012 01:00, bearophile wrote: > Manu: > > > The compiler would have to do some serious magic to optimise that; >> flattening both sides of the if into parallel expressions, and then >> applying the mask to combine... >> > > I think it's a small amount of magic. > > The simple featu

Re: Very simple SIMD programming

2012-10-24 Thread bearophile
Manu: The compiler would have to do some serious magic to optimise that; flattening both sides of the if into parallel expressions, and then applying the mask to combine... I think it's a small amount of magic. The simple features shown in that paper are fully focused on SIMD programming, s

Re: Very simple SIMD programming

2012-10-24 Thread Manu
On 24 October 2012 18:12, jerro wrote: > Simple example: >> T opCompound(string seq)(T a, T b, T c) if(seq == "* +") { return >> _madd(a, b, c); } >> > > It may be useful to have a way to define compound operators for other > things (although you can already write expression templates), but th

Re: Very simple SIMD programming

2012-10-24 Thread F i L
Manu wrote: One thing I can think of that would really improve simd (and not only simd) would be a way to define compound operators. If the library could detect/hook sequences of operations and implement them more efficiently as a compound, that would make some very powerful optimisations ava

Re: Very simple SIMD programming

2012-10-24 Thread Paulo Pinto
On Wednesday, 24 October 2012 at 12:47:38 UTC, bearophile wrote: Paulo Pinto: Actually, I am yet to see any language that has SIMD as part of the language standard and not as an extension where each vendor does its own way. D is, or is going to be, one such language :-) Bye, bearophile Is

Re: Very simple SIMD programming

2012-10-24 Thread jerro
Simple example: T opCompound(string seq)(T a, T b, T c) if(seq == "* +") { return _madd(a, b, c); } It may be useful to have a way to define compound operators for other things (although you can already write expression templates), but this is an optimization that the compiler back end ca

Re: Very simple SIMD programming

2012-10-24 Thread Paulo Pinto
On Wednesday, 24 October 2012 at 12:50:44 UTC, Manu wrote: On 24 October 2012 15:39, Paulo Pinto wrote: On Wednesday, 24 October 2012 at 02:41:53 UTC, bearophile wrote: I have found a nice paper, "Extending a C-like Language for Portable SIMD Programming", (2012), by Roland L., Sebastian H

Re: Very simple SIMD programming

2012-10-24 Thread Don Clugston
On 24/10/12 11:33, Timon Gehr wrote: On 10/24/2012 11:24 AM, Don Clugston wrote: On 24/10/12 04:41, bearophile wrote: I have found a nice paper, "Extending a C-like Language for Portable SIMD Programming", (2012), by Roland L., Sebastian Hack and Ingo Wald: http://www.cdl.uni-saarland.de/proje

Re: Very simple SIMD programming

2012-10-24 Thread bearophile
Manu: D already has what's required to do some fairly nice (by comparison) simd stuff with good supporting libraries. After reading that paper I am not sure you are right. See how their language manages masks by itself. This is from page 3: // vector length of context = 1; current_mask = T

Re: Very simple SIMD programming

2012-10-24 Thread Manu
On 24 October 2012 15:39, Paulo Pinto wrote: > On Wednesday, 24 October 2012 at 02:41:53 UTC, bearophile wrote: > >> I have found a nice paper, "Extending a C-like Language for Portable SIMD >> Programming", (2012), by Roland L., Sebastian Hack and Ingo Wald: >> >> http://www.cdl.uni-saarland.**d

Re: Very simple SIMD programming

2012-10-24 Thread bearophile
Paulo Pinto: Actually, I am yet to see any language that has SIMD as part of the language standard and not as an extension where each vendor does its own way. D is, or is going to be, one such language :-) Bye, bearophile

Re: Very simple SIMD programming

2012-10-24 Thread Paulo Pinto
On Wednesday, 24 October 2012 at 02:41:53 UTC, bearophile wrote: I have found a nice paper, "Extending a C-like Language for Portable SIMD Programming", (2012), by Roland L., Sebastian Hack and Ingo Wald: http://www.cdl.uni-saarland.de/projects/vecimp/vecimp_tr.pdf SIMD programming is necessa

Re: Very simple SIMD programming

2012-10-24 Thread bearophile
Don Clugston: Making that an error was such a good idea. There are two other common sources of bugs code that I'd like to see removed from D code: http://d.puremagic.com/issues/show_bug.cgi?id=5409 http://d.puremagic.com/issues/show_bug.cgi?id=8757 Bye, bearophile

Re: Very simple SIMD programming

2012-10-24 Thread Timon Gehr
On 10/24/2012 11:24 AM, Don Clugston wrote: On 24/10/12 04:41, bearophile wrote: I have found a nice paper, "Extending a C-like Language for Portable SIMD Programming", (2012), by Roland L., Sebastian Hack and Ingo Wald: http://www.cdl.uni-saarland.de/projects/vecimp/vecimp_tr.pdf They pres

Re: Very simple SIMD programming

2012-10-24 Thread Don Clugston
On 24/10/12 04:41, bearophile wrote: I have found a nice paper, "Extending a C-like Language for Portable SIMD Programming", (2012), by Roland L., Sebastian Hack and Ingo Wald: http://www.cdl.uni-saarland.de/projects/vecimp/vecimp_tr.pdf They present a simple scalar program in C: struct dat

Very simple SIMD programming

2012-10-23 Thread bearophile
I have found a nice paper, "Extending a C-like Language for Portable SIMD Programming", (2012), by Roland L., Sebastian Hack and Ingo Wald: http://www.cdl.uni-saarland.de/projects/vecimp/vecimp_tr.pdf SIMD programming is necessary in a system language, or in any language that wants to use the