core.simd woes
Manu
turkeyman at gmail.com
Tue Oct 2 14:00:13 PDT 2012
On 2 October 2012 23:52, jerro <a at a.com> wrote:
> On Tuesday, 2 October 2012 at 13:36:37 UTC, Manu wrote:
>
>> On 2 October 2012 13:49, jerro <a at a.com> wrote:
>>
>>
>>> I don't think it is possible to think of all usages of this, but for
>>> every
>>> simd instruction there are valid usages. At least for writing pfft, I
>>> found
>>> shuffling two vectors very useful. For, example, I needed a function that
>>> takes a small, square, power of two number of elements stored in vectors
>>> and bit-reverses them - it rearanges them so that you can calculate the
>>> new
>>> index of each element by reversing bits of the old index (for 16 elements
>>> using 4 element vectors this can actually be done using
>>> std.simd.transpose,
>>> but for AVX it was more efficient to make this function work on 64
>>> elements). There are other places in pfft where I need to select elements
>>> from two vectors (for example, here https://github.com/jerro/pfft/****<https://github.com/jerro/pfft/**>
>>> blob/sine-transform/pfft/avx_****float.d#L141<https://github.**
>>> com/jerro/pfft/blob/sine-**transform/pfft/avx_float.d#**L141<https://github.com/jerro/pfft/blob/sine-transform/pfft/avx_float.d#L141>>is
>>> the platform specific code for AVX).
>>>
>>>
>>> I don't think this are the kind of things that should be implemented in
>>> std.simd. If you wanted to implement all such operations (for example bit
>>> reversing a small array) that somebody may find useful at some time,
>>> std.simd would need to be huge, and most of it would never be used.
>>>
>>
>>
>> I was referring purely to your 2-vector swizzle idea (or useful high-level
>> ideas in general). Not to hyper-context-specific functions :P
>>
>
> My point was that those context specific functions can be implemented
> using a 2 vector swizzle. LLVM, for example, actually provides access to
> most vector shuffling instruction through "shufflevector", which is
> basically a 2 vector swizzle.
>
Yeah, I understand. And it's a good suggestion. I'll add support for
2-vector swizzling next time I'm working on it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121003/dbcc6d4b/attachment.html>
More information about the Digitalmars-d
mailing list