You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is ugly that the execution strategies are encoded in one-letter prefixes like t and d. It is also hard to express other useful strategies:
single-threaded version of reduce to get pair-wise summation even in single-thread
simd = true can be set by default in this case.
single-threaded version of reduce_commutative when there is non-canonical iteration order (e.g., block matrix, ndreducible)
It is also impossible to let Transducers.jl choose the best strategy even though relevant information is already/can be encoded in the transducer/reducing function types.
Wants
Orthogonalize the algebraic properties and execution mechanisms.
An entry point that automatically chooses execution strategy.
Idea
Specifying strategy
One solution may be to introduce a new function fold (no l)
Would it make sense to offer the strategy as an optional first positional argument like foldl([strategy,] rf, xf, coll) so the user can have more control over dispatch?
Transducers.jl now has different kinds of fold that are usable with different algebraic properties of the reducing function:
foldl
/transduce
reduce
/transduce_assoc
reduce_commutative
/transduce_commutative!
(related:foreach(ndreducible(...))
;foldl
-based API to implement GEMM https://tkf.github.io/NDReducibles.jl/dev/)Some of those functions are not exposed, as it was hard to come up with a consistent and composable interface.
This is not the only way to categorize the folds. Another axis is based on the execution mechanism:
foldl
/collect
/copy
reduce
/tcollect
/tcopy
dreduce
/dcollect
/dcopy
Problems
It is ugly that the execution strategies are encoded in one-letter prefixes like
t
andd
. It is also hard to express other useful strategies:reduce
to get pair-wise summation even in single-threadsimd = true
can be set by default in this case.reduce_commutative
when there is non-canonical iteration order (e.g., block matrix,ndreducible
)It is also impossible to let Transducers.jl choose the best strategy even though relevant information is already/can be encoded in the transducer/reducing function types.
Wants
Idea
Specifying strategy
One solution may be to introduce a new function
fold
(nol
)where
strategy
can be something likes.t
Asserting algebraic properties
Use some wrapper factory to declare the algebraic properties of reducing functions and transducers:
For example:
The text was updated successfully, but these errors were encountered: