MinGW64 not capable of 32 byte stack alignment (required for AVX on Windows x64), simple worker or switch?

I am trying to work with AVX and Windows 64bit instructions. I am comfortable with the g ++ compiler, so I used that, however there is a big bug described here and very rough solutions were presented here .

Basically, the variable m256 cannot be stack-aligned to work properly with avx instructions, it requires 32-byte alignment.

The solutions presented in the other stack I linked are really terrible, especially if you have performance. The python program that you have to run every time you want to debug this is replacing the instructions with its suboptimal mismatched instructions, or reallocating and doing a bunch of expensive pointer hacky math to get the alignment correct. If you are doing the pointer math solution, I think there is still a chance for a seg error, because you cannot control the distribution or r-values ​​/ time series.

I am looking for an easier and cheaper solution. I don't mind switching compilers, would prefer not to, but if this is the best solution I will. However, my very poor understanding of the error is that it is an integral part of 64-bit Windows, so toggle compilers help or do other compilers also have the same problem?

+3


source to share


1 answer


You can fix this problem by switching to Microsoft 64-bit C / C ++ compiler. The problem is not intrinsic to 64 bit Windows. Despite what Kai Tietz said in the bug report you linked, the Microsoft x64 ABI allows the compiler to give variables more than 16 byte stack alignment.



In addition, the 64-bit version of GCC 4.9.2 Cygwin can provide 32-byte variable alignment on the stack.

+4


source







All Articles