sd_fft: AVX512 implementation for some functions - #2715
Conversation
|
https://www.texmacs.org/joris/ntt/ntt.html claims 51.4ns (xeon) and 16.5ns (zen4) for r=64... I guess more room for improvement is possible. |
I believe Joris optimized through SLPs, i.e. no branching at all, in the framework of Mathemagix (i.e. their own compiler). |
|
The |
29a6814 to
acbd4dd
Compare
|
I tested performance through the profile files in I observe a performance penalty on the However when launching other benchs, I do not see much difference and mostly no negative impact, sometimes not changed and sometimes a small improvement. For example, So, I suppose this PR needs further investigation/comments about the performance gains? |
|
Seem pretty problematic, since changes such as this one are obviously architecture-dependent, and I don't have these machines to test on... (any idea?) The benchmark in the original PR was only for these functions and only count clock cycles, so it's possible that a local improvement somehow (?) translate to a global regression. Seem pretty unlikely though. Some hypotheses I can think of:
|
|
Sorry for the long delay.
As written in my comment, the main place where there seems to be a potentially negative impact is precisely the function
Yes, both ways of measuring (in the file above and in FLINT's profile file) should be reliable for this task, at least for non-too-small lengths.
For my measurements I was careful to work on machines under very low load, the zen4 laptop was plugged in and in performance mode and the cascade lake is a server. I just tried again on the zen4, with same observations. If you wish, you could show us what timings you get with and without this PR when using FLINT's profile file directly. And/or augment the benchmark file you provided to make it usable without sudo, to make it also time the inverse |
This PR defines new types
vec8dzandvec16dz, corresponding toAVX512 register types, and use that to speed up some functions in
sd_fft.c.Only a limited number of functions in
sd_fft.care modified.This is mostly to discuss what's the correct interface that we want in
machine_vectors.h.Note that
vec8dis already taken. Changingvec8dfrom twoymmto onezmmregister is not unconditionally profitable, since there would not be enough instruction level parallelism.To limit the amount of code changes, I keep the original transformed element ordering, which in particular mean
sd_fft_store_vec8dz_basecase_orderbecomes very terrible. (it takes only 24 cycles though.)Original:
After first commit:
bits=6 shows 22% improvement and bits=8 shows 17% improvement.
bits=7 is unmodified (will need more work).
After second commit:
bits=8 shows 8% additional improvement.
The temp benchmark file (AI).
Details
Use perf events to count number of CPU cycles.
More reliable than
rdtscpsince clock frequency varies.Might need
sudo sysctl kernel.perf_event_paranoid=-1to run this.