Mir vs. Numpy: Reworked!

9il ilyayaroshenko at gmail.com
Mon Dec 7 02:14:41 UTC 2020


On Sunday, 6 December 2020 at 17:30:13 UTC, data pulverizer wrote:
> On Saturday, 5 December 2020 at 07:44:33 UTC, 9il wrote:
>>
>> sweep_ndslice uses (2*N - 1) arrays to index U, this allows 
>> LDC to unroll the loop.
>>
>> For example, for 2D case, withNeighboursSum [2] will store the 
>> pointer to the result, and the pointer at rows above and below.
>>
>> matrix:
>> --------------
>> ------a------- above iterator
>> ------r------- the result
>> ------b------- below iterator
>> --------------
>>
>> Also, for AVX-512 targets it allows vectorizing the loop [1]. 
>> The benchmark has been run on the AVX2 CPU.
>>
>> [1] https://github.com/typohnebild/numpy-vs-mir/issues/4
>> [2] 
>> http://mir-algorithm.libmir.org/mir_ndslice_topology.html#.withNeighboursSum
>
> Very interesting, thank you for the explanations. Are there 
> journal/book other implementation references for these 
> approaches to implementing tensor-like multidimensional arrays?

I don't know. Tensors aren't so complex. The complex part is a 
design that allows Mir to construct and iterate various kinds of 
lazy tensors of any complexity and have quite a universal API, 
and all of these are boosted by the fact that the user-provided 
kernel(lambda) function is optimized by the compiler without the 
overhead.




More information about the Digitalmars-d-announce mailing list