Source
- URL: https://x.com/Lotsoffoodinme/status/2058454499828904170
- Author: el jack (@Lotsoffoodinme)
- Posted: 2026-05-24 07:46:11
Branch
1/ @Lotsoffoodinme
@AgileJebrim
many people don’t write code that touches the gpu
2/ @AgileJebrim
@Lotsoffoodinme
We’re changing that.
3/ @Lotsoffoodinme
@AgileJebrim
Out of interest, is it something drastically different to dividing it up into many slices and summing from there? I’m envisioning something like a map reduce
4/ @AgileJebrim
@Lotsoffoodinme
It’s in that direction but I need greater details.
5/ @Lotsoffoodinme
@AgileJebrim
As I don’t write code that targets the gpu I can’t. Is this a particularly complicated question? It seems to a complete lay person that it shouldn’t be too complicated.
6/ @AgileJebrim
@Lotsoffoodinme
How would you answer this for a multicore CPU?
7/ @Lotsoffoodinme
Im assuming it’s a big enough set of numbers that chunking it makes sense. Maybe it’s hand wavy, but I’m also going to assume it fits in a 64bit number.
Gameplan would be to chunk by core count, then have each core iterate over its slice. I rarely explicitly write vectorised code, but I’m reasonably confident I’d want more than one accumulator. By that I mean each iteration of the loop might do 4 additions at once and then increment by 32 or whatever the cpu supports.
At the end reduce the accumulators and then reduce the threads.
I hope that’s not a terrible answer.
8/ @AgileJebrim
@Lotsoffoodinme
You can scale a lot more than just 4-wide SIMD.