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

SSE functions behave as if AVX instructions #4

Open
marshallward opened this issue Jan 19, 2022 · 0 comments
Open

SSE functions behave as if AVX instructions #4

marshallward opened this issue Jan 19, 2022 · 0 comments

Comments

@marshallward
Copy link
Owner

marshallward commented Jan 19, 2022

There are two problems with the SSE tests, one is fixable but the other is problematic:

  1. GCC will replace the SSE (128-bit) intrinsics in the sse_* tests with AVX instructions, presumably because there is no added benefit to using AVX over SSE. (Why they would do this I have no idea...).

    This is annoying, but could be solved by replacing any -mavx build flags with -msse in the sse*.c builds.

  2. Even when explicit SSE instructions are used, the performance behaves as if they are AVX instructions! If (the misnamed) VADDPS_LATENCY is set to the SSE latency, then it will produce the expected SSE performance (FLOP/s = 4 x freq). But increasing this "latency" (which is actually the loop unrolling) will only increase the flop rate up to the AVX rate (8 x freq). When registers are depleted, it will start to drop (as expected).

    I have counted the numbers of FLOPs via perf, and it is reporting the correct number. (If r_max is hard-coded to 100 million with a latency of 5, then it produces ~2 billion FLOPs (4 x 5 x 0.1e9 = 2e9).

    I cannot find any error in the sse.c timings, so I am worried that it may be an optimization happening inside of the CPU. I am very reluctant to pursue this possibility, so I am just noting it here and moving on.

If these problems are not resolved, then it may be better to just disable the SSE timing test for now.

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

1 participant