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?

Small models also found the vulnerabilities that Mythos found

https://aisle.com/blog/ai-cybersecurity-after-mythos-the-jagged-frontier
742•dominicq•7h ago•203 comments

Apple Silicon and Virtual Machines: Beating the 2 VM Limit (2023)

https://khronokernel.com/macos/2023/08/08/AS-VM.html
106•krackers•3h ago•50 comments

447 TB/cm² at zero retention energy – atomic-scale memory on fluorographane

https://zenodo.org/records/19513269
109•iliatoli•3h ago•58 comments

How We Broke Top AI Agent Benchmarks: And What Comes Next

https://rdi.berkeley.edu/blog/trustworthy-benchmarks-cont/
170•Anon84•4h ago•44 comments

Dark Castle

https://darkcastle.co.uk/
90•evo_9•3h ago•11 comments

Pijul a FOSS distributed version control system

https://pijul.org/
52•kouosi•4d ago•7 comments

Advanced Mac Substitute is an API-level reimplementation of 1980s-era Mac OS

https://www.v68k.org/advanced-mac-substitute/
178•zdw•8h ago•49 comments

How to build a `Git diff` driver

https://www.jvt.me/posts/2026/04/11/how-git-diff-driver/
65•zdw•5h ago•4 comments

Cirrus Labs to join OpenAI

https://cirruslabs.org/
224•seekdeep•10h ago•111 comments

What Is a Property?

https://alperenkeles.com/posts/what-is-a-property/
40•alpaylan•4d ago•14 comments

The Life and Death of the Book Review

https://libertiesjournal.com/articles/the-life-and-death-of-the-book-review/
6•lermontov•2d ago•0 comments

Surelock: Deadlock-Free Mutexes for Rust

https://notes.brooklynzelenka.com/Blog/Surelock
154•codetheweb•3d ago•50 comments

Show HN: Pardonned.com – A searchable database of US Pardons

349•vidluther•17h ago•185 comments

Keeping a Postgres Queue Healthy

https://planetscale.com/blog/keeping-a-postgres-queue-healthy
71•tanelpoder•7h ago•21 comments

Starfling: A one-tap endless orbital slingshot game in a single HTML file

https://playstarfling.com
548•iceberger2001•2d ago•137 comments

Every plane you see in the sky – you can now follow it from the cockpit in 3D

https://flight-viz.com/cockpit.html?lat=40.64&lon=-73.78&alt=3000&hdg=220&spd=130&cs=DAL123
202•coolwulf•3d ago•44 comments

Volunteers turn a fan's recordings of 10K concerts into an online treasure trove

https://apnews.com/article/aadam-jacobs-collection-concerts-internet-archive-chicago-b1c9c4466a2d...
341•geox•3d ago•66 comments

Optimal Strategy for Connect 4

https://2swap.github.io/WeakC4/explanation/
243•marvinborner•3d ago•30 comments

The Problem That Built an Industry

https://ajitem.com/blog/iron-core-part-1-the-problem-that-built-an-industry/
95•ShaggyHotDog•9h ago•35 comments

The APL programming language source code (2012)

https://computerhistory.org/blog/the-apl-programming-language-source-code/
35•tosh•6h ago•8 comments

The Soul of an Old Machine

https://skalski.dev/the-soul-of-an-old-machine/
4•mskalski•4d ago•1 comments

Metrics SQL: A SQL-based semantic layer for humans and agents

https://www.rilldata.com/blog/introducing-metrics-sql-a-sql-based-semantic-layer-for-humans-and-a...
8•sebg•2d ago•0 comments

The future of everything is lies, I guess – Part 5: Annoyances

https://aphyr.com/posts/415-the-future-of-everything-is-lies-i-guess-annoyances
198•aphyr•9h ago•124 comments

Phone Trips

http://www.wideweb.com/phonetrips/
54•bookofjoe•7h ago•5 comments

South Korea introduces universal basic mobile data access

https://www.theregister.com/2026/04/10/south_korea_data_access_universal/
296•saikatsg•10h ago•83 comments

Installing every* Firefox extension

https://jack.cab/blog/every-firefox-extension
627•RohanAdwankar•1d ago•76 comments

Chimpanzees in Uganda locked in eight-year 'civil war', say researchers

https://www.bbc.com/news/articles/cr71lkzv49po
416•neversaydie•1d ago•253 comments

Filing the corners off my MacBooks

https://kentwalters.com/posts/corners/
1291•normanvalentine•1d ago•607 comments

New synthesis of astronomical measurements shows Hubble tension is real

https://noirlab.edu/public/news/noirlab2611/?nocache=true&lang=en
19•anigbrowl•5h ago•3 comments

Artemis II safely splashes down

https://www.cbsnews.com/live-updates/artemis-ii-splashdown-return/
1231•areoform•23h ago•397 comments