Atomic vector reductions with predication
This isn't ready since there are still some tests breaking, but I thought I'd sketch this out while on the flight.
Fixes #8844
I'm unsure how to properly debug this without convenient access to that arch. :/
I've tried reproducing the build from https://github.com/scikit-image/scikit-image/actions/runs/19970158590/job/57272587215. I have the same version of Python (3.13.9) and the same Pip packages, and am using the same commit of Scikit-image, running on MacOS Tahoe (26.1), on an M2 chip. The CI run was on the macos-15-arm64 image, giving MacOS 15.7.2.
I've run pytest tests/skimage/restoration/test_unwrap.py over 2500 times without error.
However, I have run the full test suite, and generated the error twice, once after a few iterations, and once after 510 iterations. So it looks like a rare (say 1 time in 300 or so) error, from the full test suite only - the worst kind!
I suspect the exact environment is not important, but the platform is. I'll revert to my usual environment, and try repeated test runs on that. I'll do the same for Intel, expecting that won't generate the error.
Thank you so much for investigating and reproducing this! 🙏
Perhaps there are differences between Python versions. I did replicate the error with Python 3.12, but after 1164 iterations, again, with the full test suite.
Trying on Intel.
Yup, replicates quickly (3 iterations) on Mac Intel, with Python 3.13.
I'll investigate further.
In the meantime - I think it's reasonable to release - it's a very rare failure that may not occur in the wild. We have this issue to track it - I will try hard to get to the bottom of it.
Replicated after 11 runs again on Intel.
No replication after 64K runs of just the individual test file on Intel, and after 120K runs on M1.
So, definitively only replicates as part of full test run.
See https://github.com/scikit-image/scikit-image/issues/3079 for earlier similar issues with this test on Python 3.4. 🤷