frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Faster sorting with SIMD CUDA intrinsics (2024)

https://winwang.blog/posts/bitonic-sort/
92•winwang•11mo ago
Code at https://github.com/wiwa/blog-code/

Comments

ashvardanian•11mo ago
The article covers extremely important CUDA warp-level synchronization/exchange primitives, but it's not what is generally called SIMD in the CUDA land .

Most "CUDA SIMD" intrinsics are designed to process a 32-bit data pack containing 2x 16-bit or 4x 8-bit values (<https://docs.nvidia.com/cuda/cuda-math-api/cuda_math_api/gro...>). That significantly shrinks their applicability in most domains outside of video and string processing. I've had pretty high hopes for DPX on Hopper (<https://developer.nvidia.com/blog/boosting-dynamic-programmi...>) instructions and started integrating them in StringZilla last year, but the gains aren't huge.

winwang•11mo ago
Oh wow, TIL, thanks. I usually call stuff like that SWAR, and every now-and-then I try to think of a way to (fruitfully) use it. The "SIMD" in this case was just an allusion to warp-wide functions looking like how one might use SIMD in CPU code, as opposed to typical SIMT CUDA.

Also, StringZilla looks amazing -- I just became your 1000th Github follower :)

ashvardanian•11mo ago
Thanks, appreciate the gesture :)

Traditional SWAR on GPUs is a fascinating topic. I've begun assembling a set of synthetic benchmarks to compare DP4A vs. DPX (<https://github.com/ashvardanian/less_slow.cpp/pull/35>), but it feels incomplete without SWAR. My working hypothesis is that 64-bit SWAR on properly aligned data could be very useful in GPGPU, though FMA/MIN/MAX operations in that PR might not be the clearest showcase of its strengths. Do you have a better example or use case in mind?

winwang•11mo ago
I don't -- unfortunately not too well-versed in this field! But I was a bit fascinated with SWAR after I randomly thought of how to prefix-sum with int multiplication, later finding out that it is indeed an old trick as I suspected (I'm definitely not on this thread btw): https://mastodon.social/@dougall/109913251096277108

As for 64-bit... well, I mostly avoid using high-end GPUs, but I was of the impression that i64 is just simulated. In fact, I was thinking of using the full warp as a "pipeline" to implement u32 division (mostly as a joke), almost like anti-SWAR. There was some old-ish paper detailing arithmetic latencies in GPUs and division was approximately more than 32x multiplication (...or I could be misremembering).

bobmcnamara•11mo ago
Parallel compares: https://graphics.stanford.edu/~seander/bithacks.html#ZeroInW...
DennisL123•11mo ago
Interesting stuff. Not sure if I read this right that it‘s 16 und 32 bit values of integers that get sorted. If yes, I‘d love to see if the GPU implementation can beat a competitive Radix sort implementation on a CPU.
winwang•11mo ago
It's 32 32-bit values which get sorted. I don't think a GPU sort would beat a CPU sort at this scale, even if you don't take kernel launch time into account. CPUs are simply too fast for (super-)small data, especially with AVX-512. But if we're talking about a larger amount of data, that would be a different story, i.e. as part of a normal gpu mergesort.
maeln•11mo ago
It is also useful if your data already lives on the GPU memory. For example, when you need to z-sort a bunch of particles in a 3d renderer particle system.
exDM69•11mo ago
A 32 way GPU sorting algorithm might be just what I need for sorting and deduplicating triangle id's in a visibility buffer renderer I am working on.

Thanks for sharing.

winwang•11mo ago
As someone who doesn't know very much about graphics (ironically), you're welcome and hope it helps!
fourseventy•11mo ago
What are the biggest use cases of GPU accelerated sorting?

Gemma 4 on iPhone

https://apps.apple.com/nl/app/google-ai-edge-gallery/id6749645337
315•janandonly•4h ago•83 comments

LÖVE: 2D Game Framework for Lua

https://github.com/love2d/love
154•cl3misch•1d ago•56 comments

In Japan, the robot isn't coming for your job; it's filling the one nobody wants

https://techcrunch.com/2026/04/05/japan-is-proving-experimental-physical-ai-is-ready-for-the-real...
12•rbanffy•52m ago•5 comments

Artemis II crew see first glimpse of far side of Moon [video]

https://www.bbc.com/news/videos/ce3d5gkd2geo
375•mooreds•9h ago•285 comments

Eight years of wanting, three months of building with AI

https://lalitm.com/post/building-syntaqlite-ai/
556•brilee•10h ago•170 comments

Running Gemma 4 locally with LM Studio's new headless CLI and Claude Code

https://ai.georgeliu.com/p/running-google-gemma-4-locally-with
143•vbtechguy•6h ago•36 comments

Caveman: Why use many token when few token do trick

https://github.com/JuliusBrussee/caveman
659•tosh•14h ago•301 comments

Microsoft hasn't had a coherent GUI strategy since Petzold

https://www.jsnover.com/blog/2026/03/13/microsoft-hasnt-had-a-coherent-gui-strategy-since-petzold/
101•naves•5h ago•59 comments

Music for Programming

https://musicforprogramming.net
64•merusame•5h ago•19 comments

A tail-call interpreter in (nightly) Rust

https://www.mattkeeter.com/blog/2026-04-05-tailcall/
117•g0xA52A2A•8h ago•16 comments

Computational Physics (2nd Edition) (2025)

https://websites.umich.edu/~mejn/cp2/
88•teleforce•7h ago•11 comments

The Mechanics of Steins Gate (2023) [pdf]

https://github.com/Votuko/steins-gate-mechanics/blob/main/The%20Mechanics%20of%20Steins%20Gate%20...
11•Ariarule•1h ago•1 comments

Nanocode: The best Claude Code that $200 can buy in pure JAX on TPUs

https://github.com/salmanmohammadi/nanocode/discussions/1
134•desideratum•9h ago•24 comments

A brief history of instant coffee

https://worksinprogress.co/issue/a-brief-history-of-instant-coffee/
15•admp•1d ago•11 comments

LibreOffice – Let's put an end to the speculation

https://blog.documentfoundation.org/blog/2026/04/05/lets-put-an-end-to-the-speculation/
144•eisa01•5h ago•84 comments

From birds to brains: My path to the fusiform face area (2024)

https://www.kavliprize.org/nancy-kanwisher-autobiography
32•everbody•6h ago•0 comments

Finnish sauna heat exposure induces stronger immune cell than cytokine responses

https://www.tandfonline.com/doi/full/10.1080/23328940.2026.2645467#abstract
303•Growtika•10h ago•199 comments

Friendica – A Decentralized Social Network

https://friendi.ca/
116•janandonly•12h ago•45 comments

OpenJDK: Panama

https://openjdk.org/projects/panama/
15•tosh•4h ago•0 comments

The Free Market Lie: Why Switzerland Has 25 Gbit Internet and America Doesn't

https://sschueller.github.io/posts/the-free-market-lie/
104•sschueller•4h ago•91 comments

Baby's Second Garbage Collector

https://www.matheusmoreira.com/articles/babys-second-garbage-collector
41•matheusmoreira•3d ago•12 comments

Musician says AI company is cloning her music, filing claims against her

https://twitter.com/unlimited_ls/status/2040577536136974444
65•lando2319•3h ago•2 comments

The threat is comfortable drift toward not understanding what you're doing

https://ergosphere.blog/posts/the-machines-are-fine/
791•zaikunzhang•13h ago•526 comments

Qwen-3.6-Plus is the first model to break 1T tokens processed in a day

https://twitter.com/openrouter/status/2040239467865489874
26•Alifatisk•2h ago•14 comments

Perfmon – Consolidate your favorite CLI monitoring tools into a single TUI

https://github.com/sumant1122/Perfmon
43•paperplaneflyr•9h ago•6 comments

Hightouch (YC S19) Is Hiring

https://hightouch.com/careers#open-positions
1•joshwget•11h ago

Tracing Goroutines in Realtime with eBPF

https://sazak.io/articles/tracing-goroutines-in-realtime-with-ebpf-2026-03-31
60•darccio•3d ago•6 comments

Introducing GEN-1 [video]

https://www.youtube.com/watch?v=SY2xyrmV44Y
11•dgellow•48m ago•2 comments

Scientists Figured Out How Eels Reproduce (2022)

https://www.intelligentliving.co/scientists-finally-figured-out-how-eels-reproduce/
112•thunderbong•4d ago•21 comments

Bacteria found in the human intestine capable of improving muscle strength

https://www.ugr.es/en/about/news/bacteria-found-human-intestine-capable-improving-muscle-strength
114•gnabgib•4h ago•63 comments