(Using Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x64)
I get a lot of errors like
C:\Users\mike\Documents\CppSPMD_Fast\mandelbrot_imp.h(79): error C2593: 'operator +' is ambiguous
C:\Users\mike\Documents\CppSPMD_Fast\cppspmd_avx2.h(1787): note: could be 'cppspmd_avx2_fma::vfloat cppspmd_avx2_fma::operator +(const cppspmd_avx2_fma::lint &,float)'
C:\Users\mike\Documents\CppSPMD_Fast\cppspmd_avx2.h(1785): note: or 'cppspmd_avx2_fma::lint cppspmd_avx2_fma::operator +(const cppspmd_avx2_fma::lint &,int)'
C:\Users\mike\Documents\CppSPMD_Fast\mandelbrot_imp.h(79): note: while trying to match the argument list '(const cppspmd_avx2_fma::spmd_kernel::lint, uint32_t)'
C:\Users\mike\Documents\CppSPMD_Fast\mandelbrot_imp.h(79): error C2512: 'cppspmd_avx2_fma::spmd_kernel::lint': no appropriate default constructor available
C:\Users\mike\Documents\CppSPMD_Fast\cppspmd_avx2.h(1417): note: see declaration of 'cppspmd_avx2_fma::spmd_kernel::lint'
and
C:\Users\mike\Documents\CppSPMD_Fast\test_kernel_imp.h(274): error C2668: 'cppspmd_avx2_fma::spmd_kernel::vint::vint': ambiguous call to overloaded function
C:\Users\mike\Documents\CppSPMD_Fast\cppspmd_avx2.h(715): note: could be 'cppspmd_avx2_fma::spmd_kernel::vint::vint(float)'
C:\Users\mike\Documents\CppSPMD_Fast\cppspmd_avx2.h(713): note: or 'cppspmd_avx2_fma::spmd_kernel::vint::vint(int)'
C:\Users\mike\Documents\CppSPMD_Fast\test_kernel_imp.h(274): note: while trying to match the argument list '(unsigned int)'
I was able to fix compilation by adding uint overloads like so
diff --git a/cppspmd_avx2.h b/cppspmd_avx2.h
old mode 100644
new mode 100755
index 9e6a78f..8c2f412
--- a/cppspmd_avx2.h
+++ b/cppspmd_avx2.h
@@ -714,6 +714,8 @@ struct spmd_kernel
CPPSPMD_FORCE_INLINE explicit vint(float value) : m_value(_mm256_set1_epi32((int)value)) { }
+ CPPSPMD_FORCE_INLINE explicit vint(unsigned int value) : m_value(_mm256_set1_epi32((int)value)) { }
+
CPPSPMD_FORCE_INLINE explicit vint(const vfloat& other) : m_value(_mm256_cvttps_epi32(other.m_value)) { }
CPPSPMD_FORCE_INLINE explicit operator vbool() const
@@ -1783,6 +1785,8 @@ CPPSPMD_FORCE_INLINE vfloat lerp(const vfloat &x, const vfloat &y, const vfloat
CPPSPMD_FORCE_INLINE lint operator+(int a, const lint& b) { return lint{ add_epi32(_mm256_set1_epi32(a), b.m_value) }; }
CPPSPMD_FORCE_INLINE lint operator+(const lint& a, int b) { return lint{ add_epi32(a.m_value, _mm256_set1_epi32(b)) }; }
+CPPSPMD_FORCE_INLINE lint operator+(unsigned int a, const lint& b) { return lint{ add_epi32(_mm256_set1_epi32(a), b.m_value) }; }
+CPPSPMD_FORCE_INLINE lint operator+(const lint& a, unsigned int b) { return lint{ add_epi32(a.m_value, _mm256_set1_epi32(b)) }; }
CPPSPMD_FORCE_INLINE vfloat operator+(float a, const lint& b) { return vfloat(a) + vfloat(b); }
CPPSPMD_FORCE_INLINE vfloat operator+(const lint& a, float b) { return vfloat(a) + vfloat(b); }
CPPSPMD_FORCE_INLINE vfloat operator*(const lint& a, float b) { return vfloat(a) * vfloat(b); }
but I'm not sure if that's the right way to fix this. I think the other option is to use int in CPPSPMD_FOREACH instead of uint32_t
(Using
Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x64
)I get a lot of errors like
and
I was able to fix compilation by adding uint overloads like so
but I'm not sure if that's the right way to fix this. I think the other option is to use int in CPPSPMD_FOREACH instead of uint32_t