On 9 October 2016 at 15:34, Ilya Yaroshenko via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
> On Sunday, 9 October 2016 at 05:21:32 UTC, Manu wrote:
>>
>> On 9 October 2016 at 14:03, Nicholas Wilson via Digitalmars-d
>> <digitalmars-d@puremagic.com> wrote:
>>>
>>> [...]
>>
>>
>> Well the trouble is the lambda that you might give to 'map' won't work
>> anymore. Operators don't work on batches, you need to use a completely
>> different API, and I think that's unfortunate.
>
>
> Could you please give an example what type of operation should be
> vectorized?

Even operations that don't require shuffling, eg:
  RGBA8[] a, b;
  zip(a, b).map!(e => e[0] + e[1]).copy(output);

Which I've suggested before (and Walter liked the idea), could be
sugared up by making use of the languages largely under-used array
operation syntax:
  output[] = a[] + b[]; // ie, types have overloaded addition
operators, so this array expression would be lowered to the pipeline
expression above. This would be super-useful for HEAPS of things!

Even these still need to be done in batches since colour adds are
saturating operations, and there are SIMD instructions for saturating
arithmetic, so we basically always have to do colour work in SIMD,
which means batching, and that basically ruins any chance for natural,
readable, expressions in your code. I want to find a way that we can
express these operations naturally, without having to always manually
handle the batching.

If we can get there, then I will say D is a good language for
stream-data processing.

Reply via email to