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?

CRISPR tech selectively shreds cancer cells, including "undruggable" cancers

https://innovativegenomics.org/news/crispr-technique-selectively-shreds-cancer-cells/
457•gmays•5h ago•127 comments

I Am Not a Reverse Centaur

https://blog.miguelgrinberg.com/post/i-am-not-a-reverse-centaur
155•ibobev•2h ago•107 comments

How to setup a local coding agent on macOS

https://ikyle.me/blog/2026/how-to-setup-a-local-coding-agent-on-macos
111•kkm•2h ago•42 comments

Malware developers added nuclear and biological weapons text to to their spyware

https://twitter.com/jsrailton/status/2064661778978533571
162•marc__1•23h ago•104 comments

Pirates, a naval warfare game inspired by Sid Meier's Pirates

https://piwodlaiwo.github.io/pirates/
92•iweczek•3h ago•41 comments

A PDF that changes based on how its read

https://sgaud.com/texts/pdf
86•SarthakGaud•3h ago•46 comments

Law Enforcement's "Warrior" Problem (2015)

https://harvardlawreview.org/forum/vol-128/law-enforcements-warrior-problem/
58•bookofjoe•3h ago•39 comments

Slightly reducing the sloppiness of AI generated front end

https://envs.net/~volpe/blog/posts/reduce-slop.html
129•FergusArgyll•5h ago•87 comments

Launch HN: BitBoard (YC P25) – Analytics Workspace for Agents

https://bitboard.work/
21•arcb•3h ago•9 comments

Where Did Earth Get Its Oceans? Maybe It Made Them Itself

https://www.quantamagazine.org/where-did-earth-get-its-oceans-maybe-it-made-them-itself-20260612/
78•ibobev•4h ago•47 comments

A dumpster arrived behind my university's library

https://yalereview.org/article/sheila-liming-the-end-of-books
130•mooreds•6h ago•114 comments

AI agent bankrupted their operator while trying to scan DN42

https://lantian.pub/en/article/fun/ai-agent-bankrupted-their-operator-scan-dn42lantian.lantian/
1343•xiaoyu2006•15h ago•483 comments

Introduction to UEFI HTTP(s) Boot with QEMU/OVMF

https://blog.yadutaf.fr/2026/06/12/introduction-to-uefi-https-boot-qemu-ovmf/
47•jtlebigot•5h ago•14 comments

There Is Life Before Main in Rust

https://grack.com/blog/2026/06/11/life-before-main/
43•mmastrac•1d ago•12 comments

Maxproof

https://arxiv.org/abs/2606.13473
118•ilreb•8h ago•9 comments

Cosmodial Sky Atlas

https://killedbyapixel.github.io/Cosmodial/
13•memalign•2h ago•1 comments

"Don't You Just Upload It to ChatGPT?"

https://correresmidestino.com/dont-you-just-upload-it-to-chatgpt/
129•speckx•2h ago•114 comments

If you are asking for human attention, demonstrate human effort

https://tombedor.dev/human-attention-and-human-effort/
1410•jjfoooo4•21h ago•443 comments

Hazel (YC W24) Is Hiring a Full Stack Engineer

https://www.ycombinator.com/companies/hazel-2/jobs/3epPWgu-full-stack-engineer-ts-sci
1•augustschen•7h ago

Show HN: StackScope – I crawled over 40k indie launches to see what they ship

https://stackscope.dev/
31•datafreak_•4h ago•8 comments

WASI 0.3

https://bytecodealliance.org/articles/WASI-0.3
202•mavdol04•6h ago•82 comments

A Call to Action: Stop the FCC's KYC Regime

https://blog.lopp.net/call-to-action-stop-the-fcc-kyc-regime/
282•FergusArgyll•5h ago•186 comments

Looking Forward to Postgres 19: It's About Time

https://www.pgedge.com/blog/looking-forward-to-postgres-19-its-about-time
92•xngbuilds•3h ago•27 comments

Encrypted Spaces An architecture for collaborative applications

https://encryptedspaces.org/
49•_____k•8h ago•5 comments

New privacy frontier: Europe eyes crackdown on smart glasses

https://www.politico.com/www.politico.eu/article/new-privacy-frontier-europe-eyes-crackdown-smart...
65•1vuio0pswjnm7•3h ago•49 comments

A jacket that harvests drinking water from the air

https://news.utexas.edu/2026/06/11/this-jacket-pulls-drinking-water-from-thin-air/
148•ilreb•21h ago•93 comments

Kimi K2.7-Code: open-source coding model with better token efficiency

https://huggingface.co/moonshotai/Kimi-K2.7-Code
362•nekofneko•9h ago•195 comments

Show HN: Script to bulk delete Claude chats from the web UI

https://github.com/MatteoLeonesi/bulk-delete-claude-chat
46•ML0037•5h ago•16 comments

Nobody ever gets credit for fixing problems that never happened (2001) [pdf]

https://web.mit.edu/nelsonr/www/Repenning=Sterman_CMR_su01_.pdf
698•sam_bristow•19h ago•232 comments

Vinyl succumbs to Loudness War: more than just collateral damage (2025)

https://magicvinyldigital.net/2025/04/27/vinyl-succumbs-to-loudness-war-more-than-just-collateral...
139•sneela•6d ago•216 comments