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?

JVM Options Explorer

https://chriswhocodes.com/vm-options-explorer.html
53•0x54MUR41•2h ago•22 comments

Why weekends are under threat

https://thehustle.co/originals/why-weekends-are-under-threat
13•Anon84•17m ago•1 comments

Happy Map

https://pudding.cool/2026/02/happy-map/
44•surprisetalk•4d ago•7 comments

Phyphox – Physical Experiments Using a Smartphone

https://phyphox.org/
59•_Microft•4h ago•14 comments

An Interview with Pat Gelsinger

https://morethanmoore.substack.com/p/an-interview-with-pat-gelsinger-2026
63•zdw•2d ago•26 comments

The Miller Principle (2007)

https://puredanger.github.io/tech.puredanger.com/2007/07/11/miller-principle/
47•FelipeCortez•4d ago•37 comments

AI Will Be Met with Violence, and Nothing Good Will Come of It

https://www.thealgorithmicbridge.com/p/ai-will-be-met-with-violence-and
86•gHeadphone•3h ago•123 comments

Anthropic downgraded cache TTL on March 6th

https://github.com/anthropics/claude-code/issues/46829
144•lsdmtme•7h ago•122 comments

I run multiple $10K MRR companies on a $20/month tech stack

https://stevehanov.ca/blog/how-i-run-multiple-10k-mrr-companies-on-a-20month-tech-stack
374•tradertef•7h ago•239 comments

What have been the greatest intellectual achievements? (2017)

https://www.thinkingcomplete.com/2017/09/what-have-been-greatest-intellectual.html
26•o4c•2h ago•35 comments

Tofolli gates are all you need

https://www.johndcook.com/blog/2026/04/06/tofolli-gates/
85•ibobev•5d ago•20 comments

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

https://rdi.berkeley.edu/blog/trustworthy-benchmarks-cont/
417•Anon84•17h ago•104 comments

Apple update looks like Czech mate for locked-out iPhone user

https://www.theregister.com/2026/04/12/ios_passcode_bug/
236•OuterVale•4h ago•124 comments

Stewart Brand on how progress happens

https://www.newyorker.com/books/book-currents/stewart-brand-on-how-progress-happens
20•bookofjoe•5d ago•6 comments

Internet outage in Iran reaches 1,008 hours

https://mastodon.social/@netblocks/116384935123261912
16•miadabdi•1h ago•0 comments

Small models also found the vulnerabilities that Mythos found

https://aisle.com/blog/ai-cybersecurity-after-mythos-the-jagged-frontier
1140•dominicq•20h ago•305 comments

No one owes you supply-chain security

https://purplesyringa.moe/blog/no-one-owes-you-supply-chain-security/
10•birdculture•1h ago•1 comments

How Complex is my Code?

https://philodev.one/posts/2026-04-code-complexity/
137•speckx•5d ago•34 comments

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

https://zenodo.org/records/19513269
230•iliatoli•16h ago•127 comments

Dark Castle

https://darkcastle.co.uk/
200•evo_9•16h ago•25 comments

Pijul a FOSS distributed version control system

https://pijul.org/
168•kouosi•5d ago•25 comments

Relics of the Heroic Age of Manned Space Flight

http://heroicrelics.org/index.html
4•zdgeier•1d ago•0 comments

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

https://khronokernel.com/macos/2023/08/08/AS-VM.html
209•krackers•16h ago•145 comments

The End of Eleventy

https://brennan.day/the-end-of-eleventy/
180•ValentineC•11h ago•144 comments

Cirrus Labs to join OpenAI

https://cirruslabs.org/
271•seekdeep•23h ago•132 comments

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

https://www.v68k.org/advanced-mac-substitute/
252•zdw•21h ago•63 comments

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

444•vidluther•1d ago•246 comments

Network Flow Algorithms

https://www.networkflowalgs.com/
31•teleforce•5d ago•0 comments

Surelock: Deadlock-Free Mutexes for Rust

https://notes.brooklynzelenka.com/Blog/Surelock
225•codetheweb•3d ago•72 comments

How to build a `Git diff` driver

https://www.jvt.me/posts/2026/04/11/how-git-diff-driver/
121•zdw•18h ago•13 comments