by sitkack · 12y ago · 0 comments
Author should have supplied test code and a benchmark suite.
But choosing which of the vectors to update (vecX where X = input / 32) doesn't have a good answer without requiring unpredictable branching. There's a thread elsewhere on this page where we muse about the possibility of using self-modifying code, but otherwise I don't know of any answer.
R8 <- load 64 bits from ram
JUMP A1
@A0
SHIFT R8
@A1
R9 load low 8 bits to register
pc += R9 * SIZEOF_AVX_INCR_ROUTINE
Each AVX_INCR_ROUTINE would be the same size and have an absolute jump back to A0. There would need to be a DEC counter so the whole thing was only done 8 times. Also memory reads could be interleaved during the count or use the AVX register for a destination directly from memory. But it seems like a waste if there are already 64 bit registers sitting there.If one used U16 counters, every 65k elements read would need to sweep through and write the high buckets out to 32 bit counters to prevent overflow.
I don't yet have any solid evidence but I think using the AVX registers for histogram storage could enable histogramming at the read bandwidth of main memory.
https://software.intel.com/sites/landingpage/IntrinsicsGuide...