Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVX2 vectorization seems to cause to errors in tests #11

Open
Harry-Chen opened this issue May 8, 2019 · 2 comments
Open

AVX2 vectorization seems to cause to errors in tests #11

Harry-Chen opened this issue May 8, 2019 · 2 comments

Comments

@Harry-Chen
Copy link

I tried to compile swift with icc 18 successfully, but encountered some errors when running make check.

If I do not provide any specific CFLAGS when running configuration script, it will automatically use -O3 -ansi-alias -xCORE-AVX2, which leads to:

  • FAIL: testMaths
  • FAIL: testVoronoi2D
  • FAIL: test27cellsStarsPerturbed.sh
  • FAIL: test27cellsPerturbed.sh
  • FAIL: test27cells.sh

If I use --no-vec, the script will use -O3 -xCORE-AVX2 -ansi-alias -no-simd -no-vec (weird that -xCORE-AVX2 still exists), which leads to:

  • FAIL: testMaths
  • FAIL: testVoronoi2D
  • FAIL: test27cellsStarsPerturbed.sh

If I disable AVX2 by manually specifying --no-optimization and CFLAGS="-O3 -mavx", all tests will pass.

By trying more compiling options I believe that enabling AVX2 does cause these tests to fail. I also read your jenkins build output and found that your CI server does not support AVX2 so that no errors were reported.

@MatthieuSchaller
Copy link
Member

Hi! Thanks. We'll look into it.

Indeed our testing platform uses only AVX. Most likely a tolerance issue as we made sure our tests get for numerical accuracy get within a very narrow window. Some vectorized functions may push you out of that window depending on the compiler and level of instructions.
What compiler are you using for these tests?

Note that -xCORE-AVX2 activates more instructions than just the AVX2 set (despite what the name indicates) and it does hence make sense to have --no-vec -xCORE-AVX2 if you want all the benefits of the other instructions but want to prevent just SIMD.

@Harry-Chen
Copy link
Author

The compiler I use is Intel ICC 18.0.3.

Most likely a tolerance issue as we made sure our tests get for numerical accuracy get within a very narrow window. Some vectorized functions may push you out of that window depending on the compiler and level of instructions.

This may be the case, as I noticed that some test cases have strict conditions. For example, testMaths only allows a relative error less than 4e-8, and enabling AVX2 gives one of 6e-8, which made it fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants