r/simd • u/AndrewOfC • 6d ago
For SIMD Reduction,
In a previous post I demonstrated a method of using SIMD for reduction with AVX, NEON, and SVE. One suggestion was to change the accumulation that was being done to a vector register, instead of a scalar. The improvement was not spectacular but definately impactful.

9
Upvotes
1
u/TQ_GPU 5d ago
Now you can try this: for 1 core, it has 2 threads right? 1 thread can work on data movement while 1 thread can work on computations. This should utilize memory bandwidth better. Because this dedicates all registers of thread for 1 job instead of distributing on 2 jobs.
1
u/TQ_GPU 5d ago
SIMD reduction can go beyond RAM bandwidth if the data was compressed. Some cores decompress, some cores do reduction. Is the data constant / compressible?
0
u/DiscombobulatedAir63 2d ago
On AVX2 I did this simple loop but with if guard over whole loop so prefetches don't hit wrong cache lines
Doing more than 2 cache lines didn't yield better results with SW prefetching (usually can load 2-3 cache lines at the same time and with SW prefetches unrolling is not needed) but helped HW prefetch only version
Argued on the internet to prove that SW prefetches are superior to HW ones
This one is not the best prefetch placement but I downloaded freaking Rust to prove to Rust'y that he is John Snow of programming on that question and obviously deleted that abomination from my system
Better version was to use SW-HW prefetch - SW prefetch 1st cache line for I+X iteration and HW would prefetch 2nd cache line for that iteration - essentially hiding only iteration advance that HW can't predict
0
u/[deleted] 5d ago
[deleted] — view deleted comment