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?

Binance-hacker-1029 – $5.6B stolen from Binance

https://arkm.com/explorer/entity/21a94755-f604-45e5-9501-6542e23005e8
700•Tiberium•3h ago•423 comments

We're releasing the weights of Mistral Large 4

https://mistral.ai/news/mistral-large-4-oss/
1195•kuberwastaken•11h ago•338 comments

We ran AI agent swarms in Minecraft and Mindustry

https://labs.ycombinator.com/projects/games/index.html
151•sandslash•3h ago•58 comments

El Niño Is Flooding California's Coasts with the Highest Tides to Come

https://gizmodo.com/el-nino-is-already-flooding-californias-coasts-and-the-years-highest-tides-ha...
80•gumby•3h ago•23 comments

A tiny world model running games on a Raspberry Pi Pico 2 W

https://github.com/SheepSeb/tinyworldformer
123•airinei•5h ago•8 comments

A Pig, the State, and War: Porco Rosso (Kurenai No Buta) (2014)

https://journal.animationstudies.org/article/id/66/
43•simonebrunozzi•3h ago•7 comments

Show HN: I Turned DOOM into a Transformer

https://github.com/mottopanikeiku/doomformer
31•falperc•2h ago•8 comments

H.264 Is Magic (2016)

https://sidbala.com/h-264-is-magic/
330•ea016•9h ago•124 comments

The Great American Rascal: Tom Sawyer at 150

https://claremontreviewofbooks.com/the-great-american-rascal/
39•beatstop•3h ago•10 comments

Patrick Stewart has died

https://www.nytimes.com/2026/10/29/arts/television/patrick-stewart-dead.html
2385•j4mie•5h ago•494 comments

Cormac McCarthy's Library

https://cormacmccarthy.lib.utk.edu/
8•maitland•1h ago•1 comments

DoorDash to acquire Instacart

https://about.doordash.com/en-us/news/doordash-to-acquire-instacart
419•WalterSobchak•13h ago•598 comments

LLM Voice

https://martinfowler.com/bliki/LLM-Voice.html
339•ibobev•10h ago•179 comments

ElementaryUI – Swift, in the Browser

https://elementary.codes
56•frizlab•4h ago•12 comments

Sylphide OS: a general-purpose OS for microcontroller-based computers

https://projects.freehackers.org/sylphide-os/
38•iamnothere•4h ago•11 comments

Show HN: Auto Dismiss Mac OS "Allow <app> to find devices on local networks?"

https://github.com/johncassil/dontallow
100•johncassil•6h ago•76 comments

Iterating Backwards in C

https://www.davidpriver.com/Iterating-backwards-in-C.html
12•cremno•3d ago•6 comments

Chained PHP2Shell exploit roots 25 servers, including US Government servers

https://dreamgroup.com/blog/chained-php2shell-exploit-roots-25-servers
286•882542F3884314B•14h ago•139 comments

Historical Scientific Instruments

https://nealstephenson.substack.com/p/historical-scientific-instruments
14•peteforde•2d ago•0 comments

If IPv4 were land

https://iptrust.co/blog/if-ipv4-were-land
230•rokostik•13h ago•315 comments

IgE disruptor for food allergy with Claude-enabled antibody design [pdf]

https://divergencelabs.com/publications/ige-preprint.pdf
38•matco11•6h ago•28 comments

Partitioning my digital life into security domains (2011)

https://blog.invisiblethings.org/2011/03/13/partitioning-my-digital-life-into.html
27•mashally•2d ago•0 comments

Launch HN: Simantic (YC F26) – Firmware Simulation for AI Agents

50•shong0504•9h ago•14 comments

What we know so far about Spain train crash

https://www.bbc.com/news/articles/cm8xz7pkd0jjo
155•ZeljkoS•16h ago•309 comments

Grace Blackwell needs a new scheduler: 27% more usable GPUs from the same racks

https://skypilot.ai/blog/grace-blackwell-needs-a-new-scheduler
129•wondersky•9h ago•21 comments

16colo.rs – ANSI/ASCII art archive

https://16colo.rs/
84•memalign•9h ago•8 comments

Zombie stats: Where the numbers AI quotes come from

https://trakkr.ai/trakkr-research/zombie-stats
141•mektrik•10h ago•62 comments

NetBSD adds a new text editor called atto

https://mastodon.sdf.org/@netbsd/117518160563539748
164•luke8086•13h ago•135 comments

Alleged Chinese spy had 'close relationship' with Nvidia boss Jensen Huang

https://nypost.com/2026/10/29/business/alleged-chinese-spy-had-close-relationship-with-nvidia-bos...
284•mgh2•7h ago•197 comments

Show HN: Overtone – Transcribe, correct and cut captions for any screen shape

https://github.com/lonthq/overtone-captions
35•rvanderlinden•7h ago•2 comments