Skip to content

[backend_cpu] Fix compilation on MacOS

Context

While trying to compile on MacOS, I have the following errors:

1. type errors with fma

This error occurs with GlobalAvgPooling and ReduceMean.

/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1/__math/fma.h:45:18: error: static assertion failed due to requirement '!(integral_constant<bool, true>::value && integral_constant<bool, true>::value && integral_constant<bool, true>::value)': 
   45 |   static_assert((!(_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value &&
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   46 |                    _IsSame<_A3, __result_type>::value)),
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Aidge/aidge/aidge/aidge_backend_cpu/include/aidge/backend/cpu/operator/ReduceMeanImpl_kernels.hpp:37:17: note: in instantiation of function template specialization 'std::__math::fma<float, float, float, 0>' requested here
   37 |     mean = std::fma<T>(vec[i * stride] - mean, static_cast<T>(1.0) / static_cast<T>(i + 1), mean);
      |                 ^
/Aidge/aidge/aidge/aidge_backend_cpu/include/aidge/backend/cpu/operator/ReduceMeanImpl_kernels.hpp:90:51: note: in instantiation of function template specialization 'Aidge::stableMean<float>' requested here
   90 |                 output[idx_o]  = castFromFloat<O>(stableMean(input + idx_i, dim_i, stride_post));
      |                                                   ^
/Aidge/aidge/aidge/aidge_backend_cpu/include/aidge/backend/cpu/operator/ReduceMeanImpl_kernels.hpp:146:38: note: in instantiation of function template specialization 'Aidge::ReduceMeanImpl_cpu_forward_kernel<float, float>' requested here
  146 |     {ProdConso::inPlaceModel, Aidge::ReduceMeanImpl_cpu_forward_kernel<float, float>, nullptr});
      |                                      ^

Versions

  • aidge_core: 0.5.1_dev
  • aidge_backend_cpu: 0.5.1_dev