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•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?

Show HN: Files.md – Open-source alternative to Obsidian

https://github.com/zakirullin/files.md
189•zakirullin•2h ago•107 comments

1024000^2 Blocks, 2B2T Minecraft Server World Download Project, and Discoveries

https://github.com/2b2tplace/1m_release
36•exploraz•1h ago•23 comments

The Quiet Renovation at Bitwarden

https://blog.ppb1701.com/the-quiet-renovation-at-bitwarden
48•DaSHacka•1d ago•26 comments

We stopped AI bot spam in our GitHub repo using Git's –author flag

https://archestra.ai/blog/only-responsible-ai
7•ildari•13m ago•2 comments

The Aperiodic Table

https://blog.jgc.org/2026/05/the-aperiodic-table.html
42•jgrahamc•2d ago•9 comments

'We mould trees to grow into the shape of chairs'

https://www.bbc.co.uk/news/articles/cvg0yy3gp71o
96•bauc•2h ago•28 comments

Actually, Democracy Dies in H.R.

https://www.nytimes.com/2026/05/18/world/americas/actually-democracy-dies-in-hr.html
78•mitchbob•1h ago•29 comments

Project Glasswing: what Mythos showed us

https://blog.cloudflare.com/cyber-frontier-models/
14•Fysi•2h ago•0 comments

Linux security mailing list 'almost unmanageable'

https://www.theregister.com/security/2026/05/18/linus-torvalds-says-ai-powered-bug-hunters-have-m...
116•jonbaer•3h ago•48 comments

Math Jokes in Alice in Wonderland

https://storica.club/blog/alice-is-math-jokes/
75•yekbun123•4d ago•36 comments

Porting my 3D points renderer on a ZX Spectrum 48K

https://github.com/ttsiodras/3D-on-a-ZX-Spectrum-48K/
52•ttsiodras•1d ago•8 comments

GenCAD

https://gencad.github.io/
395•dagenix•17h ago•104 comments

The foundations of a provably secure operating system (PSOS) (1979) [pdf]

http://www.csl.sri.com/users/neumann/psos.pdf
81•rurban•5h ago•47 comments

Enough with the AI FOMO, go slow-mo, says Domo CDO

https://www.theregister.com/ai-ml/2026/05/17/enough-with-the-ai-fomo-go-slow-mo-says-domo-cdo/524...
94•Bender•2h ago•47 comments

It is time to give up the dualism introduced by the debate on consciousness

https://www.noemamag.com/there-is-no-hard-problem-of-consciousness/
197•ahalbert4•12h ago•511 comments

Show HN: Auto-identity-remove – Automated data broker opt-out runner for macOS

https://github.com/stephenlthorn/auto-identity-remove
293•stephenlthorn•4h ago•114 comments

When Kierkegaard Got Cancelled

https://www.plough.com/en/topics/faith/discipleship/when-kierkegaard-got-cancelled
14•bookofjoe•3h ago•6 comments

Voice AI Systems Are Vulnerable to Hidden Audio Attacks

https://spectrum.ieee.org/voice-ai-audio-attacks
11•SVI•3h ago•1 comments

Crystals found inside wreckage from the first nuclear bomb test

https://www.scientificamerican.com/article/strange-crystals-found-inside-wreckage-from-the-first-...
134•jumploops•2d ago•61 comments

I turned a $80 RK3562 Android tablet into a Debian Linux workstation

https://github.com/tech4bot/rk3562deb
413•tech4bot•1d ago•209 comments

Don't answer the first question

https://lalitm.com/post/dont-answer-the-first-question/
33•lalitmaganti•6h ago•20 comments

AI eats the world (Spring 26) [pdf]

https://static1.squarespace.com/static/50363cf324ac8e905e7df861/t/6a0af5d0484fbf5fe9a7743e/177910...
118•topherjaynes•2h ago•65 comments

Ask an Astronaut: 333 hours of Q&A footage with astronauts

https://askanastronaut.issinrealtime.org/
180•gaws•2d ago•22 comments

Show HN: Semble – Code search for agents that uses 98% fewer tokens than grep

https://github.com/MinishLab/semble
398•Bibabomas•1d ago•132 comments

Jank now has its own custom IR

https://jank-lang.org/blog/2026-05-08-optimization/
188•DASD•2d ago•36 comments

What "Amazon Supply Chain Services" Tells Us About What Amazon Is

https://gadallon.substack.com/p/the-third-time-amazon-did-this-what
4•JumpCrisscross•32m ago•0 comments

Build a Radio Wave Detector with Balls of Aluminum Foil

https://www.wired.com/story/build-a-radio-wave-detector-with-balls-of-aluminum-foil/
46•Brajeshwar•2d ago•16 comments

NASA still maintains some of the Voyager spacecraft code from the 70s era

https://spacedaily.com/nasa-still-maintains-some-of-the-voyager-spacecraft-code-in-a-1970s-era-pr...
53•redbell•4h ago•54 comments

WriteUp: 16 Bytes of x86 that turn Matrix rain into sound

https://hellmood.111mb.de//wake_up_16b_writeup.html
175•HellMood•16h ago•31 comments

Prolog Coding Horror

https://www.metalevel.at/prolog/horror
172•RohanAdwankar•18h ago•67 comments