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

Comments

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

It's OK to abandon your side-project

https://robbowen.digital/wrote-about/abandoned-side-projects/
27•hisamafahri•50m ago•7 comments

Flipdiscs

https://flipdisc.io
231•skogstokig•3d ago•44 comments

I bought Friendster for $30k – Here's what I'm doing with it

https://ca98am79.medium.com/i-bought-friendster-for-30k-heres-what-i-m-doing-with-it-d5e8ddb3991d
775•ca98am79•12h ago•398 comments

TurboQuant: A first-principles walkthrough

https://arkaung.github.io/interactive-turboquant/
143•kweezar•7h ago•29 comments

AI should elevate your thinking, not replace it

https://www.koshyjohn.com/blog/ai-should-elevate-your-thinking-not-replace-it/
475•koshyjohn•12h ago•342 comments

Self-updating screenshots

https://interblah.net/self-updating-screenshots
277•bjhess•1d ago•41 comments

The Prompt API

https://developer.chrome.com/docs/ai/prompt-api
107•gslin•6h ago•65 comments

Bob Odenkirk would like to remind you that life is a meaningless farce

https://www.nytimes.com/2026/04/25/magazine/bob-odenkirk-interview.html
8•wslh•20h ago•2 comments

Three constraints before I build anything

https://jordanlord.co.uk/blog/3-constraints/
202•nervous_north•1d ago•30 comments

When the cheap one is the cool one

https://arun.is/blog/cheap-cool/
117•ddrmaxgt37•1d ago•56 comments

Fast16: High-precision software sabotage 5 years before Stuxnet

https://www.sentinelone.com/labs/fast16-mystery-shadowbrokers-reference-reveals-high-precision-so...
245•dd23•12h ago•52 comments

A Guide to CubeSat Mission and Bus Design

https://pressbooks-dev.oer.hawaii.edu/epet302/
25•o4c•1d ago•2 comments

Box to save memory in Rust

https://dystroy.org/blog/box-to-save-memory/
126•emschwartz•3d ago•31 comments

The Mushroom That Makes People Have the Exact Same Hallucination

https://www.vice.com/en/article/meet-the-mushroom-that-make-people-have-the-exact-same-hallucinat...
30•thunderbong•1h ago•11 comments

Rust Memory Management: Ownership vs. Reference Counting

https://slicker.me/rust/ownership_and_borrowing_vs_reference_counting.html
5•vinhnx•1d ago•1 comments

FreeBSD Device Drivers Book

https://github.com/ebrandi/FDD-book
83•myth_drannon•10h ago•14 comments

Sawe becomes first athlete to run a sub-two-hour marathon in a competitive race

https://www.bbc.com/sport/athletics/articles/crm1m7e0zwzo
380•berkeleyjunk•12h ago•259 comments

SWE-bench Verified no longer measures frontier coding capabilities

https://openai.com/index/why-we-no-longer-evaluate-swe-bench-verified/
298•kmdupree•19h ago•165 comments

Mystery Cpuid Bit

http://www.os2museum.com/wp/mystery-cpuid-bit/
12•userbinator•2d ago•1 comments

Revocation of X.509 Certificates

https://blog.apnic.net/2026/04/24/revocation-of-x-509-certificates/
37•jandeboevrie•1d ago•7 comments

Quirks of Human Anatomy

https://www.sdbonline.org/sites/fly/lewheldquirk/figlegq6.htm
132•gurjeet•2d ago•73 comments

Chernobyl wildlife forty years on

https://www.bbc.com/future/article/20260424-chernobyl-wildlife-forty-years-on
105•reconnecting•13h ago•34 comments

Butterflies are in decline across North America, a look at the Western Monarch

https://www.smithsonianmag.com/science-nature/butterflies-are-in-dramatic-decline-across-north-am...
205•1659447091•11h ago•63 comments

Magic: The Gathering took me from N2 to Japanese fluency

https://www.tokyodev.com/articles/how-magic-the-gathering-took-me-from-n2-to-japanese-fluency
131•pwim•3d ago•57 comments

An AI agent deleted our production database. The agent's confession is below

https://twitter.com/lifeof_jer/status/2048103471019434248
665•jeremyccrane•16h ago•812 comments

Running Bare-Metal Rust Alongside ESP-IDF on the ESP32-S3's Second Core

https://tingouw.com/blog/embedded/esp32/run_rust_on_app_core
67•MrBuddyCasino•3d ago•11 comments

EvanFlow – A TDD driven feedback loop for Claude Code

https://github.com/evanklem/evanflow
65•evanklem2004•7h ago•26 comments

The Military Rockets That Launched the Space Age (2023)

https://airandspace.si.edu/stories/editorial/military-rockets-launched-space-age
8•radeeyate•1d ago•0 comments

Clay PCB Tutorial

https://feministhackerspaces.cargo.site/Clay-PCB-Tutorial
223•j0r0b0•16h ago•131 comments

Show HN: Free textbook on engineering thermodynamics

https://thermodynamicsbook.com/
141•2DcAf•17h ago•37 comments