www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Please help to move forward with ndslice

reply Ilya Yaroshenko <ilyayaroshenko gmail.com> writes:
Hello,

I found a way how to correctly implement multidimensional 
functional map for ndslices and for packed ndslices (tensors 
composed of tensors). It allows
  1. a compiler to use vectorisation with SIMD instructions like 
`fabs` or `sqrt` for example. But first [1] should be merged
  2. to manage mapped ndslices as common ndslices.
In additional the future ndmap abstraction has zero computational 
cost.

The are 6 ndslice PRs, which should be merged first [1]. Please 
help to review and merge this. They does not contain any new API 
names, but optimizations and small API enhancements, which was 
delayed before because I wanted to get enough experience with 
ndslice first.

ndslice is in experimental and it is the most generic package in 
Phobos along with new regex. Regex has a lot CTFE-able magic, 
ndslice operates with abstract entities. Feel free to ask 
questions if you want to have more detailed imagination about 
implementation.

[1] 
https://github.com/dlang/phobos/pulls?q=is%3Aopen+is%3Apr+author%3A9il+label%3Andslice

Thank you and best regards,
Ilya
Jul 24 2016
parent reply jmh530 <john.michael.hall gmail.com> writes:
On Sunday, 24 July 2016 at 17:30:24 UTC, Ilya Yaroshenko wrote:
 Hello,

 I found a way how to correctly implement multidimensional 
 functional map for ndslices and for packed ndslices (tensors 
 composed of tensors). It allows
  1. a compiler to use vectorisation with SIMD instructions like 
 `fabs` or `sqrt` for example. But first [1] should be merged
  2. to manage mapped ndslices as common ndslices.
 In additional the future ndmap abstraction has zero 
 computational cost.
I'm a little confused. Why not just use slice.byElement.map!f? Anyway, I hope this work is related to multi-dimensional folding, as mentioned here https://github.com/libmir/mir/issues/209
Jul 25 2016
parent Ilya Yaroshenko <ilyayaroshenko gmail.com> writes:
On Monday, 25 July 2016 at 17:12:08 UTC, jmh530 wrote:
 On Sunday, 24 July 2016 at 17:30:24 UTC, Ilya Yaroshenko wrote:
 Hello,

 I found a way how to correctly implement multidimensional 
 functional map for ndslices and for packed ndslices (tensors 
 composed of tensors). It allows
  1. a compiler to use vectorisation with SIMD instructions 
 like `fabs` or `sqrt` for example. But first [1] should be 
 merged
  2. to manage mapped ndslices as common ndslices.
 In additional the future ndmap abstraction has zero 
 computational cost.
I'm a little confused. Why not just use slice.byElement.map!f? Anyway, I hope this work is related to multi-dimensional folding, as mentioned here https://github.com/libmir/mir/issues/209
1. ndmap is N-Dimensional Slice composed of lazy elements. a user can use all nslice package to manage it. 2. byElement can not be vectorized 3. byElement adds few additional operations for each element, it is slower than direct index access. Just opened PR for ndmap : https://github.com/dlang/phobos/pull/4652 [1] https://github.com/dlang/phobos/pull/4652
Jul 25 2016