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•8mo ago
Code at https://github.com/wiwa/blog-code/

Comments

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

Private equity firms acquired more than 500 autism centers in past decade: study

https://www.brown.edu/news/2026-01-07/private-equity-autism-centers
40•hhs•47m ago•3 comments

Show HN: Librario, a book metadata API that aggregates G Books, ISBNDB, and more

15•jamesponddotco•38m ago•1 comments

Show HN: I used Claude Code to discover connections between 100 books

https://trails.pieterma.es/
176•pmaze•7h ago•66 comments

Finding and fixing Ghostty's largest memory leak

https://mitchellh.com/writing/ghostty-memory-leak-fix
182•thorel•5h ago•44 comments

Open Chaos: A self-evolving open-source project

https://www.openchaos.dev/
290•stefanvdw1•8h ago•57 comments

Show HN: GlyphLang – An AI-first programming language

8•goose0004•36m ago•1 comments

Show HN: Play poker with LLMs, or watch them play against each other

https://llmholdem.com/
35•projectyang•4h ago•24 comments

AI is a business model stress test

https://dri.es/ai-is-a-business-model-stress-test
140•amarsahinovic•7h ago•176 comments

Eulogy for Dark Sky, a data visualization masterpiece (2023)

https://nightingaledvs.com/dark-sky-weather-data-viz/
350•skadamat•12h ago•155 comments

Overdose deaths are falling in America because of a 'supply shock': study

https://www.economist.com/united-states/2026/01/08/why-overdose-deaths-are-falling-in-america
42•marojejian•4h ago•30 comments

1970 Paris, cut into a grid and photographed

https://paris1970.jeantho.eu/index.html
10•panic•1w ago•2 comments

Code Is Clay

https://campedersen.com/code-is-clay
20•ecto•4h ago•6 comments

Rats caught on camera hunting flying bats

https://scienceclock.com/rats-caught-on-camera-hunting-flying-bats-for-the-first-time/
65•akg130522•5h ago•8 comments

ASCII-Driven Development

https://medium.com/@calufa/ascii-driven-development-850f66661351
80•_hfqa•2d ago•53 comments

ChatGPT Health is a marketplace, guess who is the product?

https://consciousdigital.org/chatgpt-health-is-a-marketplace-guess-who-is-the-product/
211•yoaviram•2d ago•217 comments

The eight ways that all the elements in the Universe are made (2021)

https://bigthink.com/starts-with-a-bang/8-ways-elements-made/
42•zdw•5d ago•15 comments

New information extracted from Snowden PDFs through metadata version analysis

https://libroot.org/posts/going-through-snowden-documents-part-4/
265•libroot•12h ago•116 comments

I replaced Windows with Linux and everything's going great

https://www.theverge.com/tech/858910/linux-diary-gaming-desktop
498•rorylawless•8h ago•427 comments

Code and Let Live

https://fly.io/blog/code-and-let-live/
186•usrme•1d ago•57 comments

Org Mode Syntax Is One of the Most Reasonable Markup Languages for Text (2017)

https://karl-voit.at/2017/09/23/orgmode-as-markup-only/
237•adityaathalye•15h ago•170 comments

UpCodes (YC S17) is hiring PMs, SWEs to automate construction compliance

https://up.codes/careers?utm_source=HN
1•Old_Thrashbarg•7h ago

Extracting books from production language models (2026)

https://arxiv.org/abs/2601.02671
19•logicprog•3h ago•0 comments

Side-by-side comparison of how AI models answer moral dilemmas

https://civai.org/p/ai-values
62•jesenator•2d ago•42 comments

Varnish and Virtue

https://literaryreview.co.uk/varnish-virtue
4•prismatic•2d ago•0 comments

A child in the state of nature

https://lareviewofbooks.org/article/a-child-in-the-state-of-nature/
7•Caiero•3d ago•0 comments

How wolves became dogs

https://www.economist.com/christmas-specials/2025/12/18/how-wolves-became-dogs
97•mooreds•5d ago•83 comments

Bindless Oriented Graphics Programming

https://alextardif.com/BindlessProgramming.html
31•ibobev•3d ago•4 comments

How your high school affects your chances of UC Admission

https://sfeducation.substack.com/p/how-your-high-school-affects-your
54•mutator•2d ago•116 comments

UK Orders Ofcom to Explore Encryption Backdoors

https://reclaimthenet.org/uk-orders-ofcom-to-explore-encryption-backdoors
55•worldofmatthew•2h ago•19 comments

Distributed Denial of Secrets

https://ddosecrets.com/
52•sabakhoj•3d ago•11 comments