A tone equalizer in darktable ?

I googled around and it seems that Function Multi Versioning (FMV) is only supported in Linux. Not easy to find detailed info, though, so I might not be 100% correct.
In case, using FMV would break compatibility with Windows and OSX.
Does anyone know more on the issue ? Are there alternative ways to optimize the code ?
Marco

ok thanks, I can just add a compiler check in the macro and disable it in MS.

Edit: there is already a check :

#if __has_attribute(target_clones)
#define __DT_CLONE_TARGETS__ __attribute__((target_clones("default", "sse2", "sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4")))
#else
#define __DT_CLONE_TARGETS__
#endif

so it should be enabled only if the compiler supports it.

Nope.
Here is the compilator output

[ 56%] Building C object src/iop/CMakeFiles/toneequal.dir/introspection_toneequal.c.obj
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:413:20: error: the call requires 'ifunc', which is not supported by this target
  413 | static inline void fast_guided_filter(float *const restrict image,
      |                    ^~~~~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:613:9: error: the call requires 'ifunc', which is not supported by this target
  613 | #pragma omp parallel for simd schedule(static) default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:725:9: error: the call requires 'ifunc', which is not supported by this target
  725 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:698:9: error: the call requires 'ifunc', which is not supported by this target
  698 | #pragma omp parallel for default(none) schedule(simd:static) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:1252:9: error: the call requires 'ifunc', which is not supported by this target
 1252 | #pragma omp parallel sections
      |         ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:27,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/sse.h:30:9: error: the call requires 'ifunc', which is not supported by this target
   30 | #pragma omp parallel for simd default(none) \
      |         ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:99,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:401:11: error: the call requires 'ifunc', which is not supported by this target
  401 |   #pragma omp parallel sections
      |           ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:880:9: error: the call requires 'ifunc', which is not supported by this target
  880 | #pragma omp parallel for simd default(none) schedule(static) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:559:9: error: the call requires 'ifunc', which is not supported by this target
  559 | #pragma omp parallel for default(none) schedule(static) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:852:9: error: the call requires 'ifunc', which is not supported by this target
  852 | #pragma omp parallel for simd default(none) \
      |         ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:85,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:308:1: error: the call requires 'ifunc', which is not supported by this target
  308 |       LOOP(pixel_rgb_geomean);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:305:1: error: the call requires 'ifunc', which is not supported by this target
  305 |       LOOP(pixel_rgb_norm_power);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:302:1: error: the call requires 'ifunc', which is not supported by this target
  302 |       LOOP(pixel_rgb_norm_2);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:299:1: error: the call requires 'ifunc', which is not supported by this target
  299 |       LOOP(pixel_rgb_norm_1);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:296:1: error: the call requires 'ifunc', which is not supported by this target
  296 |       LOOP(pixel_rgb_value);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:293:1: error: the call requires 'ifunc', which is not supported by this target
  293 |       LOOP(pixel_rgb_lightness);
      | ^
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:85,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:290:1: error: the call requires 'ifunc', which is not supported by this target
  290 |       LOOP(pixel_rgb_mean);
      | ^
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:355:9: error: the call requires 'ifunc', which is not supported by this target
  355 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:336:9: error: the call requires 'ifunc', which is not supported by this target
  336 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:98:9: error: the call requires 'ifunc', which is not supported by this target
   98 | #pragma omp parallel for simd collapse(2) default(none) schedule(static) aligned(in, out:64) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:298:9: error: the call requires 'ifunc', which is not supported by this target
  298 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:269:9: error: the call requires 'ifunc', which is not supported by this target
  269 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:207:9: error: the call requires 'ifunc', which is not supported by this target
  207 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:169:9: error: the call requires 'ifunc', which is not supported by this target
  169 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:402:9: error: the call requires 'ifunc', which is not supported by this target
  402 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:390:9: error: the call requires 'ifunc', which is not supported by this target
  390 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:379:9: error: the call requires 'ifunc', which is not supported by this target
  379 | #pragma omp parallel for simd default(none) \
      |         ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:1236:19: error: the call requires 'ifunc', which is not supported by this target
 1236 | static inline int radial_approximation(float A[(CHANNELS + 1) * PIXEL_CHAN],
      |                   ^~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:918:6: error: the call requires 'ifunc', which is not supported by this target
  918 | void process(struct dt_iop_module_t *self, dt_dev_pixelpipe_iop_t *piece, const void *const ivoid,
      |      ^~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:893:20: error: the call requires 'ifunc', which is not supported by this target
  893 | static inline void apply_toneequalizer(const float *const restrict in,
      |                    ^~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:864:20: error: the call requires 'ifunc', which is not supported by this target
  864 | static inline void apply_exposure(const float *const restrict in, float *const restrict out,
      |                    ^~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:836:20: error: the call requires 'ifunc', which is not supported by this target
  836 | static inline void display_luminance_mask(const float *const restrict luminance,
      |                    ^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:716:21: error: the call requires 'ifunc', which is not supported by this target
  716 | static inline float flat_pseudo_norm(const float *const restrict image, const size_t num_elem)
      |                     ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:681:20: error: the call requires 'ifunc', which is not supported by this target
  681 | static inline void compute_log_histogram(const float *const restrict luminance,
      |                    ^~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:628:20: error: the call requires 'ifunc', which is not supported by this target
  628 | static inline void compute_luminance_mask(const float *const restrict in, float *const restrict luminance,
      |                    ^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:601:13: error: the call requires 'ifunc', which is not supported by this target
  601 | static void compute_lut_correction(struct dt_iop_toneequalizer_gui_data_t *g,
      |             ^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:581:14: error: the call requires 'ifunc', which is not supported by this target
  581 | static float pixel_correction(const float exposure,
      |              ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:550:20: error: the call requires 'ifunc', which is not supported by this target
  550 | static inline void compute_correction(const float *const restrict luminance,
      |                    ^~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:540:14: error: the call requires 'ifunc', which is not supported by this target
  540 | static float gaussian_func(const float radius, const float denominator)
      |              ^~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:527:14: error: the call requires 'ifunc', which is not supported by this target
  527 | static float gaussian_denom(const float sigma)
      |              ^~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:481:14: error: the call requires 'ifunc', which is not supported by this target
  481 | static float get_luminance_from_buffer(const float *const buffer,
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:99,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:374:19: error: the call requires 'ifunc', which is not supported by this target
  374 | static inline int pseudo_solve(float *const restrict A,
      |                   ^~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:355:19: error: the call requires 'ifunc', which is not supported by this target
  355 | static inline int transpose_dot_vector(float *const restrict A, // input
      |                   ^~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:335:19: error: the call requires 'ifunc', which is not supported by this target
  335 | static inline int transpose_dot_matrix(float *const restrict A, // input
      |                   ^~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:268:19: error: the call requires 'ifunc', which is not supported by this target
  268 | static inline int solve_hermitian(const float *const restrict A,
      |                   ^~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:239:19: error: the call requires 'ifunc', which is not supported by this target
  239 | static inline int triangular_ascent_safe(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:220:19: error: the call requires 'ifunc', which is not supported by this target
  220 | static inline int triangular_ascent_fast(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:191:19: error: the call requires 'ifunc', which is not supported by this target
  191 | static inline int triangular_descent_safe(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:172:19: error: the call requires 'ifunc', which is not supported by this target
  172 | static inline int triangular_descent_fast(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:124:19: error: the call requires 'ifunc', which is not supported by this target
  124 | static inline int choleski_decompose_safe(const float *const restrict A,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:99:19: error: the call requires 'ifunc', which is not supported by this target
   99 | static inline int choleski_decompose_fast(const float *const restrict A,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:85,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:280:20: error: the call requires 'ifunc', which is not supported by this target
  280 | static inline void luminance_mask(const float *const restrict in, float *const restrict out,
      |                    ^~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:230:13: error: the call requires 'ifunc', which is not supported by this target
  230 | static void pixel_rgb_geomean(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:200:13: error: the call requires 'ifunc', which is not supported by this target
  200 | static void pixel_rgb_norm_power(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:177:13: error: the call requires 'ifunc', which is not supported by this target
  177 | static void pixel_rgb_norm_2(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:153:13: error: the call requires 'ifunc', which is not supported by this target
  153 | static void pixel_rgb_norm_1(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:136:13: error: the call requires 'ifunc', which is not supported by this target
  136 | static void pixel_rgb_lightness(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:119:13: error: the call requires 'ifunc', which is not supported by this target
  119 | static void pixel_rgb_value(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:95:13: error: the call requires 'ifunc', which is not supported by this target
   95 | static void pixel_rgb_mean(const float *const restrict image,
      |             ^~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:84:14: error: the call requires 'ifunc', which is not supported by this target
   84 | static float linear_contrast(const float pixel, const float fulcrum, const float contrast)
      |              ^~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:368:20: error: the call requires 'ifunc', which is not supported by this target
  368 | static inline void quantize(const float *const restrict image,
      |                    ^~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:349:20: error: the call requires 'ifunc', which is not supported by this target
  349 | static inline void apply_linear_blending_w_geomean(float *const restrict image,
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:330:20: error: the call requires 'ifunc', which is not supported by this target
  330 | static inline void apply_linear_blending(float *const restrict image,
      |                    ^~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:257:20: error: the call requires 'ifunc', which is not supported by this target
  257 | static inline void box_average(float *const restrict in,
      |                    ^~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:151:20: error: the call requires 'ifunc', which is not supported by this target
  151 | static inline void variance_analyse(const float *const restrict guide, // I
      |                    ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:92:20: error: the call requires 'ifunc', which is not supported by this target
   92 | static inline void interpolate_bilinear(const float *const restrict in, const size_t width_in, const size_t height_in,
      |                    ^~~~~~~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:27,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/sse.h:22:20: error: the call requires 'ifunc', which is not supported by this target
   22 | static inline void dt_simd_memcpy(const float *const restrict in,
      |                    ^~~~~~~~~~~~~~
make[2]: *** [src/iop/CMakeFiles/toneequal.dir/build.make:68: src/iop/CMakeFiles/toneequal.dir/introspection_toneequal.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:3455: src/iop/CMakeFiles/toneequal.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

If you remove the __DT_CLONE_TARGETS__ decorator in these functions, does that solve the issue ?

what os/distro/compiler is that?

I commented __DT_CLONE_TARGETS__ in the toneequal.c, but I still get errors in the .h files included:

[ 56%] Building C object src/iop/CMakeFiles/toneequal.dir/introspection_toneequal.c.obj
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:413:20: error: the call requires 'ifunc', which is not supported by this target
  413 | static inline void fast_guided_filter(float *const restrict image,
      |                    ^~~~~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:27,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/sse.h:30:9: error: the call requires 'ifunc', which is not supported by this target
   30 | #pragma omp parallel for simd default(none) \
      |         ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:99,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:401:11: error: the call requires 'ifunc', which is not supported by this target
  401 |   #pragma omp parallel sections
      |           ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:85,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:308:1: error: the call requires 'ifunc', which is not supported by this target
  308 |       LOOP(pixel_rgb_geomean);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:305:1: error: the call requires 'ifunc', which is not supported by this target
  305 |       LOOP(pixel_rgb_norm_power);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:302:1: error: the call requires 'ifunc', which is not supported by this target
  302 |       LOOP(pixel_rgb_norm_2);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:299:1: error: the call requires 'ifunc', which is not supported by this target
  299 |       LOOP(pixel_rgb_norm_1);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:296:1: error: the call requires 'ifunc', which is not supported by this target
  296 |       LOOP(pixel_rgb_value);
      | ^
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:293:1: error: the call requires 'ifunc', which is not supported by this target
  293 |       LOOP(pixel_rgb_lightness);
      | ^
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:85,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:290:1: error: the call requires 'ifunc', which is not supported by this target
  290 |       LOOP(pixel_rgb_mean);
      | ^
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:355:9: error: the call requires 'ifunc', which is not supported by this target
  355 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:336:9: error: the call requires 'ifunc', which is not supported by this target
  336 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:98:9: error: the call requires 'ifunc', which is not supported by this target
   98 | #pragma omp parallel for simd collapse(2) default(none) schedule(static) aligned(in, out:64) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:298:9: error: the call requires 'ifunc', which is not supported by this target
  298 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:269:9: error: the call requires 'ifunc', which is not supported by this target
  269 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:207:9: error: the call requires 'ifunc', which is not supported by this target
  207 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:169:9: error: the call requires 'ifunc', which is not supported by this target
  169 | #pragma omp parallel for default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:402:9: error: the call requires 'ifunc', which is not supported by this target
  402 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:390:9: error: the call requires 'ifunc', which is not supported by this target
  390 | #pragma omp parallel for simd default(none) \
      |         ^~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:379:9: error: the call requires 'ifunc', which is not supported by this target
  379 | #pragma omp parallel for simd default(none) \
      |         ^~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:99,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:374:19: error: the call requires 'ifunc', which is not supported by this target
  374 | static inline int pseudo_solve(float *const restrict A,
      |                   ^~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:355:19: error: the call requires 'ifunc', which is not supported by this target
  355 | static inline int transpose_dot_vector(float *const restrict A, // input
      |                   ^~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:335:19: error: the call requires 'ifunc', which is not supported by this target
  335 | static inline int transpose_dot_matrix(float *const restrict A, // input
      |                   ^~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:268:19: error: the call requires 'ifunc', which is not supported by this target
  268 | static inline int solve_hermitian(const float *const restrict A,
      |                   ^~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:239:19: error: the call requires 'ifunc', which is not supported by this target
  239 | static inline int triangular_ascent_safe(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:220:19: error: the call requires 'ifunc', which is not supported by this target
  220 | static inline int triangular_ascent_fast(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:191:19: error: the call requires 'ifunc', which is not supported by this target
  191 | static inline int triangular_descent_safe(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:172:19: error: the call requires 'ifunc', which is not supported by this target
  172 | static inline int triangular_descent_fast(const float *const restrict L,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:124:19: error: the call requires 'ifunc', which is not supported by this target
  124 | static inline int choleski_decompose_safe(const float *const restrict A,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/choleski.h:99:19: error: the call requires 'ifunc', which is not supported by this target
   99 | static inline int choleski_decompose_fast(const float *const restrict A,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:85,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:280:20: error: the call requires 'ifunc', which is not supported by this target
  280 | static inline void luminance_mask(const float *const restrict in, float *const restrict out,
      |                    ^~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:230:13: error: the call requires 'ifunc', which is not supported by this target
  230 | static void pixel_rgb_geomean(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:200:13: error: the call requires 'ifunc', which is not supported by this target
  200 | static void pixel_rgb_norm_power(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:177:13: error: the call requires 'ifunc', which is not supported by this target
  177 | static void pixel_rgb_norm_2(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:153:13: error: the call requires 'ifunc', which is not supported by this target
  153 | static void pixel_rgb_norm_1(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:136:13: error: the call requires 'ifunc', which is not supported by this target
  136 | static void pixel_rgb_lightness(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:119:13: error: the call requires 'ifunc', which is not supported by this target
  119 | static void pixel_rgb_value(const float *const restrict image,
      |             ^~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:95:13: error: the call requires 'ifunc', which is not supported by this target
   95 | static void pixel_rgb_mean(const float *const restrict image,
      |             ^~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/luminance_mask.h:84:14: error: the call requires 'ifunc', which is not supported by this target
   84 | static float linear_contrast(const float pixel, const float fulcrum, const float contrast)
      |              ^~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:368:20: error: the call requires 'ifunc', which is not supported by this target
  368 | static inline void quantize(const float *const restrict image,
      |                    ^~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:349:20: error: the call requires 'ifunc', which is not supported by this target
  349 | static inline void apply_linear_blending_w_geomean(float *const restrict image,
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:330:20: error: the call requires 'ifunc', which is not supported by this target
  330 | static inline void apply_linear_blending(float *const restrict image,
      |                    ^~~~~~~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:257:20: error: the call requires 'ifunc', which is not supported by this target
  257 | static inline void box_average(float *const restrict in,
      |                    ^~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:151:20: error: the call requires 'ifunc', which is not supported by this target
  151 | static inline void variance_analyse(const float *const restrict guide, // I
      |                    ^~~~~~~~~~~~~~~~
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:92:20: error: the call requires 'ifunc', which is not supported by this target
   92 | static inline void interpolate_bilinear(const float *const restrict in, const size_t width_in, const size_t height_in,
      |                    ^~~~~~~~~~~~~~~~~~~~
In file included from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/fast_guided_filter.h:27,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/iop/toneequal.c:83,
                 from C:/msys64/home/marco/darktable-2.7-equalizer/darktable/build/src/iop/introspection_toneequal.c:77:
C:/msys64/home/marco/darktable-2.7-equalizer/darktable/src/common/sse.h:22:20: error: the call requires 'ifunc', which is not supported by this target
   22 | static inline void dt_simd_memcpy(const float *const restrict in,
      |                    ^~~~~~~~~~~~~~
make[2]: *** [src/iop/CMakeFiles/toneequal.dir/build.make:68: src/iop/CMakeFiles/toneequal.dir/introspection_toneequal.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:3455: src/iop/CMakeFiles/toneequal.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

__DT_CLONE_TARGETS__ is contained in the following files

./src/common/darktable.h
./src/common/fast_guided_filter.h
./src/common/luminance_mask.h
./src/common/sse.h
./src/iop/choleski.h
./src/iop/toneequal.c

Should I try to remove it from all files ?

Windows 10 / MinGW64 / gcc 9.2.0

I can compile Tone Equalizer under Ubuntu just fine

could also be that gcc 9.2.0 is more strict again.

I build on GCC9 with no issue.

It’s either the OpenMP #pragma omp declare simd or the __attribute__((target_clones())) decorators that fails on Win.

or just replace

#if __has_attribute(target_clones)
#define __DT_CLONE_TARGETS__ __attribute__((target_clones("default", "sse2", "sse3", "sse4.1", "sse4.2", "popcnt", "avx", "avx2", "avx512f", "fma4")))
#else
#define __DT_CLONE_TARGETS__
#endif

by

#define __DT_CLONE_TARGETS__

in darktable.h, line 99.

with this replacement tonequalizer compiles on win10/mingw

Yes, confirmed.
However, when activating the module I get the message: “tone equalizer buffers are ill-aligned, please report the bug to the developers”

Marco

I have added an extra check in the latest commit so the target clones are disabled if Win32 is detected. It’s a shame for Windows users though, because they won’t get the best optimization for their CPU, but… they choose the wrong OS, they should live with it.

The non-alignment of buffers is more concerning though. I have to track which buffer allocation does not align properly.

Aurelien, Thanks for all your work on this module and your explanations thus far. I have built and installed it and I am planning to test it out tonight. I had two quick questions and forgive my ignorance on any of the points but #1 when I complied your toneequalizer branch it noted that you are a good number of commits ahead of the master branch but the version shows as 2.5 and not 2.7 or higher. Does using this with any files the have been edited on a 2.7 dev build create any issues with previous edits…of course i will back things up before trying but just curious and secondly other than this post are there any other examples or documentation that you have created or are aware of for the use of this module. I will just have a go at it but if my testing could be more informed that would be gravy…thanks again.

#1 when I complied your toneequalizer branch it noted that you are a good number of commits ahead of the master branch but the version shows as 2.5 and not 2.7 or highe

The 2.5 tag is purely a git stuff, I never updated the tags. It means nothing for the actual program.

Does using this with any files the have been edited on a 2.7 dev build create any issues with previous edits…of course i will back things up before trying but just curious

It should not create issues per se, apart from the usual “this is still unstable stuff until proved stable” I guess.

secondly other than this post are there any other examples or documentation that you have created or are aware of for the use of this module.

Not yet.

Thanks for clarifying…

Module merged in darktable master today.

12 Likes

Superb! Merci!

Claes en Lund, La Suède

Excellent! I am happy to test it!

Excellent … I have been so looking forward to this!