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•8mo ago
Code at https://github.com/wiwa/blog-code/

Comments

ashvardanian•8mo 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•8mo 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•8mo 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•8mo 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•8mo ago
Parallel compares: https://graphics.stanford.edu/~seander/bithacks.html#ZeroInW...
DennisL123•8mo 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•8mo 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•8mo 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•8mo 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•8mo ago
As someone who doesn't know very much about graphics (ironically), you're welcome and hope it helps!
fourseventy•8mo ago
What are the biggest use cases of GPU accelerated sorting?

Open-source iCloud Photos Downloader (AKA escape from iCloud)

https://github.com/icloud-photos-downloader/icloud_photos_downloader
32•reconnecting•42m ago•9 comments

Meta announces nuclear energy projects

https://about.fb.com/news/2026/01/meta-nuclear-energy-projects-power-american-ai-leadership/
128•ChrisArchitect•1h ago•128 comments

Gentoo Linux 2025 Review

https://www.gentoo.org/news/2026/01/05/new-year.html
246•akhuettel•8h ago•119 comments

A set of Idiomatic prod-grade katas for experienced devs transitioning to Go

https://github.com/MedUnes/go-kata
40•medunes•4d ago•6 comments

Ask HN: What are you working on? (January 2026)

67•david927•3h ago•261 comments

Poison Fountain

https://rnsaffn.com/poison3/
130•atomic128•3h ago•86 comments

"Scholars Will Call It Nonsense" the Structure of Erich von Däniken's Argument

https://www.penn.museum/sites/expedition/scholars-will-call-it-nonsense/
10•Kaibeezy•40m ago•1 comments

Anthropic: Developing a Claude Code competitor using Claude Code is banned

https://twitter.com/SIGKITTEN/status/2009697031422652461
53•behnamoh•59m ago•22 comments

Sampling at negative temperature

https://cavendishlabs.org/blog/negative-temperature/
3•ag8•5m ago•0 comments

Perfectly Replicating Coca Cola [video]

https://www.youtube.com/watch?v=TDkH3EbWTYc
49•HansVanEijsden•3d ago•14 comments

"Food JPEGs" in Super Smash Bros. & Kirby Air Riders

https://sethmlarson.dev/food-jpegs-in-super-smash-bros-and-kirby-air-riders
225•SethMLarson•5d ago•53 comments

Happy 50th Birthday KIM-1

https://github.com/netzherpes/KIM1-Demo
56•JKCalhoun•6h ago•17 comments

Show HN: Epstein IM – Talk to Epstein clone in iMessage

https://epstein.im/
7•RyanZhuuuu•19h ago•7 comments

I dumped Windows 11 for Linux, and you should too

https://www.notebookcheck.net/I-dumped-Windows-11-for-Linux-and-you-should-too.1190961.0.html
570•smurda•8h ago•576 comments

C++ std::move doesn't move anything: A deep dive into Value Categories

https://0xghost.dev/blog/std-move-deep-dive/
206•signa11•2d ago•157 comments

guys why does armenian completely break Claude

https://twitter.com/dyushag/status/1993143599286886525
4•ag8•3m ago•0 comments

BasiliskII Macintosh 68k Emulator Ported to ESP32-P4 / M5Stack Tab5

https://github.com/amcchord/M5Tab-Macintosh
67•rcarmo•8h ago•9 comments

Show HN: Interactive California Budget (by Claude Code)

https://california-budget.com
3•sberens•2h ago•0 comments

Quake 1 Single-Player Map Design Theories (2001)

https://www.quaddicted.com/webarchive//teamshambler.planetquake.gamespy.com/theories1.html
6•Lammy•14h ago•1 comments

Pigeon's Device (2009)

http://pigeonsnest.co.uk/stuff/pigeons-device.html
3•gaul•1h ago•0 comments

China applies to put 200K satellites in space after calling Starlink crash risk

https://www.scmp.com/news/china/science/article/3339493/china-applies-put-200000-satellites-space...
27•nkurz•5h ago•7 comments

The Concise TypeScript Book

https://github.com/gibbok/typescript-book
195•javatuts•14h ago•43 comments

Instagram data breach reportedly exposed the personal info of 17.5M users

https://www.engadget.com/cybersecurity/an-instagram-data-breach-reportedly-exposed-the-personal-i...
158•IvanAchlaqullah•4h ago•52 comments

My Home Fibre Network Disintegrated

https://alienchow.dev/post/fibre_disintegration/
228•alienchow•15h ago•200 comments

You are not required to close your <p>, <li>, <img>, or <br> tags in HTML

https://blog.novalistic.com/archives/2017/08/optional-end-tags-in-html/
125•jen729w•1d ago•191 comments

HTML-only conditional lazy loading (via preload and media)

https://orga.cat/blog/html-conditional-lazy-loading/
72•netol•8h ago•11 comments

Vojtux – Unofficial Linux Distribution Aimed at Visually Impaired Users

https://github.com/vojtapolasek/vojtux
107•TheWiggles•4d ago•26 comments

KaraDAV – Lightweight Nextcloud compatible WebDAV server

https://github.com/kd2org/karadav
30•indigodaddy•7h ago•1 comments

Finding and fixing Ghostty's largest memory leak

https://mitchellh.com/writing/ghostty-memory-leak-fix
586•thorel•1d ago•122 comments

Are We ... Yet?

https://wiki.mozilla.org/Areweyet
22•mooreds•1h ago•7 comments