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?

OpenRouter is joining Stripe

https://openrouter.ai/blog/announcements/openrouter-is-joining-stripe/
441•rvz•4h ago•250 comments

Go 1.27

https://go.dev/blog/go1.27
309•database64128•3h ago•52 comments

Unsloth Dynamic 3.0 GGUFs

https://unsloth.ai/docs/basics/dynamic-3.0-ggufs
113•jonesy827•3h ago•29 comments

Unlocking a locked/deactivated e-waste Cricut Maker

https://sprocketfox.io/xssfox/2026/07/01/cricut-unlock/
63•1e1a•2h ago•18 comments

Google replaced Git tags for certain source code with obtaining via Google Drive

https://grapheneos.social/@GrapheneOS/117057099753905023
128•Animux•3h ago•31 comments

A joke domain purchase turned in geopolitical warfare

https://sprocketfox.io/xssfox/2026/08/19/sondehub-and-war/
652•kareiva•10h ago•87 comments

Casio F-B100W-1A

https://www.casio.com/uk/watches/casio/product.F-B100W-1A/
214•__fst__•6h ago•160 comments

Pressed Penny Machine Map

https://pennypresses.net/home/map.php
23•willmeyers•1h ago•11 comments

The little-known winstart.bat batch file

https://devblogs.microsoft.com/oldnewthing/20260811-00/?p=112605
35•ingve•4d ago•1 comments

XWayland 26.1-rc1 Released Two Years After the Last Release

https://lists.x.org/archives/xorg/2026-August/062280.html
21•ErenayDev•1h ago•0 comments

Geolocating a random island using geometry and CUDA programming

https://yassa9.github.io/osint/gralhix-004/
370•yassa9•9h ago•65 comments

DFlash 2: Keep Drafting Parallel

https://inco.ai/blog/dflash2/
19•mike-the-brain•1h ago•3 comments

Ornith-1.5: From Self-Scaffolding to Self-Improvement

https://ornith.ai/ornith_1_5.html
149•CommonGuy•6h ago•47 comments

Mathematics in the age of AI

https://arxiv.org/abs/2608.16753
83•jonbaer•6h ago•67 comments

A portable, sensitive, low power, analog Geiger counter

https://ludens.cl/Electron/geiger2/geiger2.html
17•crorella•3d ago•0 comments

Extensible Software in the age of LLMs

https://jeremymorrell.dev/blog/extensible-software-in-the-age-of-llms/
84•coloneltcb•5h ago•36 comments

Rules of Good Social Skills (2025)

https://liamrosen.com/2025/07/24/33-rules-of-good-social-skills/
49•bilsbie•3h ago•22 comments

fx :Tiny, open, native coding agent.

https://fx.sh
138•handfuloflight•23h ago•67 comments

Digital Immortality

https://dogdogfish.com/blog/2026/08/19/digital-immortality/
17•matthewsharpe3•1h ago•4 comments

How Kubernetes Probes Work

https://ngrok.com/blog/probes
94•cyndunlop•5h ago•18 comments

Remote workers report the highest well-being in study of 7,700 employees

https://www.colorado.edu/today/2026/08/12/remote-workers-report-highest-well-being-study-7700-emp...
399•downbad_•6h ago•184 comments

PostgreSQL for Everything

https://www.raphaelbauer.com:443/posts/postgresql-everything/
262•karlmush•8h ago•168 comments

Launch HN: OneCLI (YC S26) – OSS sandboxed agent harness for teams

https://github.com/onecli/onecli
43•guyb3•5h ago•13 comments

Air Theremin – A browser theremin you play by waving at your webcam

https://theremin.bizibah.com/
223•gurov•11h ago•79 comments

Introducing MicroLighter

https://daverupert.com/2026/08/microlighter/
37•tobr•3h ago•7 comments

Pacing model development in an era of cyber-critical capabilities

https://openai.com/index/pacing-model-development-cyber-capabilities/
100•j4mie•1d ago•100 comments

From Quantum Relative Entropy to the Semiclassical Einstein Equations

https://arxiv.org/abs/2510.24491
16•Luc•2h ago•0 comments

Moderna reports first positive Phase 3 for mRNA neoantigen therapy in melanoma

https://twitter.com/NoubarAfeyan/status/2090050162441752787
470•heydenberk•8h ago•213 comments

Microgpt in pure C hits 10M tps on Apple m5

https://github.com/vixhal-baraiya/microgpt-c
111•dhorthy•1d ago•36 comments

Devices with GrapheneOS support should be available in 2027

https://grapheneos.social/@GrapheneOS/117078064184215730
554•exceptione•9h ago•352 comments