frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Faster sorting with SIMD CUDA intrinsics (2024)

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

Comments

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

GPU World

https://www.gpuworld.org/
211•simonpure•5h ago•95 comments

Fastpotify

https://fastpotify.rocks/
356•nreece•6h ago•177 comments

Tmp.0ut Volume 5

https://tmpout.sh/5/
51•ghuntley•9h ago•19 comments

Restroom Archive

https://restroomarchive.com
116•jcalx•5h ago•34 comments

Playa Phone

https://playaphone.com/
622•cutoff•18h ago•210 comments

I turned my security cameras into an automatic bird identification system

https://jasontucker.blog/how-i-turned-my-security-cameras-into-an-automatic-bird-identification-s...
494•speckx•16h ago•118 comments

A walkable ASCII cyberpunk city in one HTML file [video]

https://www.youtube.com/watch?v=3YtygAx_C6A
325•keithcarolus•14h ago•38 comments

Terence Tao explains 6 essential mathematical concepts [video]

https://www.youtube.com/watch?v=OOMx2BHHWtE
413•matthewsinclair•1d ago•60 comments

Polishing Cloth Updated

https://512pixels.net/2026/08/polishing-cloth-updated/
13•zdw•6d ago•5 comments

CollectWise (YC F24) Is Hiring

https://www.ycombinator.com/companies/collectwise/jobs/7U500pP-founding-customer-success-engineer
1•OBrien_1107•2h ago

Dwarf Fortress is getting the mother of all magic updates

https://www.rockpapershotgun.com/dwarf-fortress-is-getting-the-mother-of-all-magic-updates-extend...
409•Tomte•4d ago•168 comments

RotaryCell: Making an unmodified rotary phone work over LTE with an ESP32-S3

https://github.com/fregacmols/RotaryCell
57•jombib•6h ago•8 comments

Evidence of Fraud in an Influential Study About Procrastination

https://datacolada.org/138
232•Anon84•9h ago•158 comments

American Airlines' Legendary Mechanic Passes Away at 100 After 80-Year Career

https://simpleflying.com/american-airlines-mechanic-passes-away-100-record-80-years/
8•NaOH•2d ago•3 comments

Borges Labyrinth in Venice reopens to the public

https://www.wallpaper.com/design-interiors/labirinto-borges-venice-reopening
68•gone35•3d ago•26 comments

Apple caught off guard by AI demand for Mac Mini and Mac Studio

https://www.macrumors.com/2026/08/30/apple-unexpected-mac-mini-and-studio-demand/
402•thm•20h ago•448 comments

Show HN: Laser Graffiti

https://laser.consti.de
190•con•2d ago•39 comments

Roget's Thesaurus

https://artflsrv04.uchicago.edu/roget-thesaurus/
14•gregsadetsky•1d ago•1 comments

2004 RuneScape fit a multiplayer RPG into 56k dial-up

https://jkm.dev/posts/how-2004-runescape-fit-a-multiplayer-rpg-into-56k-dialup/
110•fagnerbrack•8h ago•57 comments

Flat vs. segmented memory – it's recursive

https://www.humprog.org/~stephen/blog/2026/08/25/#flat-vs-segmented
21•signa11•5d ago•0 comments

I think the military commissary's freezers were hacked

https://signalandsilence.substack.com/p/i-think-someone-hacked-the-commissary
339•jcurbo•21h ago•195 comments

Cheap GPS jammers are filling the world with navigation dead zones

https://www.wsj.com/tech/gps-jammers-dead-zones-e76f3261
137•vinnyglennon•1d ago•133 comments

Smartphone LED detects hidden cameras with AI

https://www.chosun.com/english/industry-en/2026/08/30/SBFXUIJQYZEARKP5T4FBAY25HQ/
210•geox•2d ago•60 comments

DoltLite: A SQLite fork with Git-style version control, built with 2k agent PRs

https://www.dolthub.com/blog/2026-08-31-doltlite-beta/
40•lbw1215•7h ago•24 comments

Lion-man

https://en.wikipedia.org/wiki/Lion-man
108•gurjeet•2d ago•54 comments

Reverse engineering my ADHD test

https://nullpt.rs/reverse-engineering-adhd-test
217•hazebooth•4d ago•126 comments

RavynOS: Pre-alpha open-source OS based on Darwin, FreeBSD, Apple open-source

https://ravynos.com/
198•Bluestein•16h ago•114 comments

Interactive pattern discovery in binaries (FF-16-TUI)

https://github.com/HexLasso/FF-16-TUI
32•HexLasso•3d ago•3 comments

Vermell – Minimal, dependency-free C++ web framework using epoll

https://github.com/vermellcc/vermell
19•standar-donkey•4h ago•9 comments

ChatGPT Work Tool and Skill Reference

https://codex-tool-reference.simonw.chatgpt.site/
216•ijidak•19h ago•52 comments