Hi all again, Apologies for sending another email but I forgot to mention in my original email that Jax has jumped in on this too and started adding minmax to their jax.numpy module in https://github.com/jax-ml/jax/pull/40089 waiting on NumPy to test the API contract. Jake also states in the PR that they are interested in extending lax.reduce to do multiple reductions in a single pass while now their compiler does not fuse reductions but can do them in parallel on hardware if resources allow it.
I'm just mentioning this to say that it's nice to see improvements in NumPy leading to improvements in Jax. Best, Iason. > On Aug 25, 2026, at 12:32, Iason Krommydas <[email protected]> wrote: > > Hi all, > > I would like to let you know that in > https://github.com/numpy/numpy/pull/32231, we are implementing a fused > np.minmax implementation that uses the mechanism to register reduction loops > to ufuncs added in https://github.com/numpy/numpy/pull/31816. The > implementation includes optimizations such as loop unrolling and SIMD > (similar to the ones np.min/max were already using). This obviously does not > remove any actual computation as both min and max need to be computed but it > does them in a single pass over the input array. We saw a 1.25x to a 2x > improvement over consecutive min/max calls depending on the axis being > reduced and the dtype (the 2x comes in the cases where the computation is > mostly limited by reading from memory). > > This is a long requested feature for NumPy (see > https://github.com/numpy/numpy/issues/9836 and > https://stackoverflow.com/questions/12200580/numpy-function-for-simultaneous-max-and-min > for example) > > There are ~15 sites in NumPy and ~70 sites in SciPy where both min and max > are computed consecutively and np.minmax can replace those. > > I'm just sending this email out to inform the community and to also welcome > feedback if people think this is a bad idea or have thoughts to share. > > Cheers, > Iason.
_______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected]
