MIPP icon indicating copy to clipboard operation
MIPP copied to clipboard

mipp::mul<int64_t> (AVX512) is undefined!

Open guignont opened this issue 2 years ago • 1 comments

Hello,

the following code:

#include <iostream>
#include "mipp.h"

int main(int argc,char **argv)
{
  mipp::Reg<int64_t> b = 3;
  mipp::Reg<int64_t> c = 9;

  auto d = b*c;

  std::cout << b << std::endl;
  std::cout << c << std::endl;
  std::cout << d << std::endl;

  return 1;
}

terminate called after throwing an instance of 'std::runtime_error' what(): mipp::mul<int64_t> (AVX512) is undefined!

fix proposal in mipp_impl_AVX512.hxx :

#if defined(__AVX512DQ__)
        template <>
	inline reg mul<int64_t>(const reg v1, const reg v2) {
		return _mm512_castsi512_ps(_mm512_mullo_epi64(_mm512_castps_si512(v1), _mm512_castps_si512(v2)));
	}
#else
        template <>
	inline reg mul<int64_t>(const reg v1, const reg v2) {
		return _mm512_castsi512_ps(_mm512_mullox_epi64(_mm512_castps_si512(v1), _mm512_castps_si512(v2)));
	}    
#endif

guignont avatar Nov 24 '23 15:11 guignont

Hi @guignont !

Yes, it sounds like a good improvement. Can you enable the tests for int64_t AVX512 mul and send me a PR?

If not I will do it when I will have some time ;-).

Cheers.

kouchy avatar Nov 24 '23 16:11 kouchy