Multidimensional Arrays
Matthias Kretz
[please enable javascript to see the address]
Thu Feb 18 14:58:49 CET 2016
Hi Friedrich,
getting this stuff right with a completely general interface is hard work. I'd
like to see this problem solved, though. However, currently my priorities are
in other areas.
Anyway, consider Vc::Memory more of a proof of concept than a complete
container. I'd rather see a real STL solution to this thing. There's effort
going into a complete proposal to the C++ committee for multi-dimensional
arrays in the STL. I have not been able to review it wrt. its usefulness for
Vc types. I think we'll have to find a good separation of concerns there:
1. The container class hides memory allocation and element addressing.
2. Iterators, iterator adapters, and standard algorithms enable SIMD access
and thus hide SIMD loads and stores (and possibly necessary (de)interleaves).
See Vc::simd_for_each in Vc (sorry, not documented, it's an experiment at this
point)
3. Allocators abstract alignment optimizations.
4. Who handles padding? Maybe drop this altogether and abstract it in (2).
I'm not 100% happy with any of the solutions/approaches I've seen/developed.
But I'm sure there is a good solution waiting for us... ;)
Cheers,
Matthias
On Wednesday, February 10, 2016 04:32:53 PM GRABNER Friedrich wrote:
> Dear Matthias,
>
> I am trying to implement a little stencil operation, which requires a 3D
> array.
>
> With this in mind I have tested the Memory<float_v, 8, 3, true> which I
> understand should initialise an array of 8x3 with padding...
>
> This works well, but is there any momentum for expanding this functionality
> to 3+ dimension vectors, well I only ideally wish to use 3D but whilst we
> are thinking about it.
>
> Moreover, how can I have truly dynamic arrays?
>
> The example given does not really have a dynamic array:
>
> size_t size = 11;
> Vc::Memory<int_v> array(size);
> // scalar access:
> for (size_t i = 0; i < array.entriesCount(); ++i) {
> array[i] = i;
> }
> // vector access:
> for (size_t i = 0; i < array.vectorsCount(); ++i) {
> array.vector(i) = int_v::IndexesFromZero() + i * int_v::Size;
> }
>
> It is not critical to my work but I think it is definitely a useful function
> especially for loop unrolling etc. by the compiler...
>
> Anyhow I will have a look at the implementation of the 2D arrays, maybe it
> is simple and I can save you the work, but I feel this is unlikely ;)
>
> Thanks for your time and looking forward to hearing from you,
> Friedrich M. Grabner
>
>
>
>
> _______________________________________________
> Vc mailing list
>[please enable javascript to see the address]
> https://compeng.uni-frankfurt.de/mailman/listinfo/vc
--
Dr. Matthias Kretz
Senior Software Engineer
Experiment Systems
phone: +49 6159 713084
[please enable javascript to see the address]
web: kretzfamily.de
GSI Helmholtzzentrum für Schwerionenforschung GmbH
Planckstraße 1
64291 Darmstadt
www.gsi.de
Gesellschaft mit beschränkter Haftung
Sitz der Gesellschaft: Darmstadt
Handelsregister: Amtsgericht Darmstadt, HRB 1528
Geschäftsführung:
Ursula Weyrich, Prof. Dr. Karlheinz Langanke, Jörg Blaurock
Vorsitzender des Aufsichtsrates: Staatssekretär Dr. Georg Schütte
Stellvertreter: Ministerialdirigent Dr. Rolf Bernhardt
More information about the Vc
mailing list