Refactor: Eigen: Switch from OpenMP to TBB

Only the parallel sparse matrix code was updated. This is used by e.g.
LSCM and ABF unwrap, and performance seems about the same or better.

Parallel GEMM (dense matrix-matrix multiplication) is used by libmv,
for example in libmv_keyframe_selection_test for a 54 x 54 matrix.
However it appears to harm performance, removing parallelization makes
that test run 5x faster on a Apple M3 Max.

There has been no new Eigen release since 2021, however there is active
development in master and it includes support for a C++ thread pool for
GEMM. So we could upgrade, but the algorithm remains the same and
looking at the implementation it just does not seem designed for modern
many core CPUs. Unless the matrix is much larger, there's too much thread
synchronization overhead. So it does not seem useful to enable that
thread pool for us.

Pull Request: https://projects.blender.org/blender/blender/pulls/136865
This commit is contained in:
Brecht Van Lommel
2025-04-02 00:18:00 +02:00
parent 98b3b36411
commit da9a9093ec
5 changed files with 102 additions and 25 deletions

View File

@@ -27,10 +27,4 @@ set(LIB
PRIVATE bf::dependencies::eigen
)
if(WITH_OPENMP AND WITH_OPENMP_STATIC)
list(APPEND LIB
${OpenMP_LIBRARIES}
)
endif()
blender_add_lib(bf_intern_eigen "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")