#136557 – Fix #136310: Make FFTW thread safety required – blender

Most FFTW functions are not thread-safe by default. This caused crashes
when planning functions were called in parallel by the viewport and the
normal compositor.

The compositor already tried to enable FFTW planning thread safety, but
this was only done when the FFTW thread support library was found. Said
library was not detected correctly on Windows because of a typo, causing
the issue.

To fix this, make the thread support library no longer an optional
component when using FFTW. Also move the FFTW thread initialization call
to the main function, as it itself is not thread safe.


I tried to see if the issue could be solved without requiring the FFTW thread support library by using explicit locking like the ocean modifier. But because FFTW is also used by Audaspace that might still cause issues since it won’t use the Blender specific lock.

Currently, threading support is only enabled for the float version of FFTW. As far as I can tell, the double version is only used by the ocean modifier currently, which already uses its own locking. Enabling thread support for it might improve performance of the ocean modifier, but I haven’t checked.

Most FFTW functions are not thread-safe by default. This caused crashes
when planning functions were called in parallel by the viewport and the
normal compositor.

The compositor already tried to enable FFTW planning thread safety, but
this was only done when the FFTW thread support library was found. Said
library was not detected correctly on Windows because of a typo, causing
the issue.

To fix this, make the thread support library no longer an optional
component when using FFTW. Also move the FFTW thread initialization call
to the main function, as it itself is not thread safe.



I tried to see if the issue could be solved without requiring the FFTW thread support library by using explicit locking like the ocean modifier. But because FFTW is also used by Audaspace that might still cause issues since it won’t use the Blender specific lock.

Currently, threading support is only enabled for the float version of FFTW. As far as I can tell, the double version is only used by the ocean modifier currently, which already uses its own locking. Enabling thread support for it might improve performance of the ocean modifier, but I haven’t checked.

Read more here: Source link