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?

Protecting SSH Keys with macOS Secure Enclave

https://gatezh.com/posts/macos-secure-enclave-ssh-keys/
127•js2•3h ago•46 comments

Greg Kurtzer's Ginux is now a userspace kernel

https://github.com/gmkurtzer/ginux
46•d3Xt3r•2h ago•22 comments

Scion is back and is going to sell a kei truck in America

https://www.theautopian.com/scion-is-back-and-its-going-to-sell-a-freaking-kei-truck-in-america/
451•NaOH•12h ago•305 comments

.name Grandfathered

https://neil.fraser.name/news/2026/11/10/
793•p4bl0•15h ago•171 comments

Smart home devices should work without the internet

https://docodethatmatters.com/home-automation-overnight-success/
874•skittleson•16h ago•313 comments

To deter bioterrorism, U.S. imposes new rules on ordering synthetic DNA

https://www.science.org/content/article/deter-bioterrorism-u-s-imposes-new-rules-ordering-synthet...
77•Metacelsus•4h ago•43 comments

A Compendium of Abandoned Greenhouses

https://www.messynessychic.com/2015/01/15/a-compendium-of-abandoned-greenhouses/
26•ohjeez•2d ago•1 comments

A great old-timey game-programming hack (2013)

https://blog.moertel.com/posts/2013-12-14-great-old-timey-game-programming-hack.html
120•palsecam•6h ago•17 comments

Six Math Essentials

https://teorth.github.io/tao-web/six-math-essentials.html
222•digital55•10h ago•39 comments

Apple has new Mac app coming to make running local AI models easy

https://9to5mac.com/2026/11/10/apple-has-new-mac-app-coming-to-make-running-local-ai-models-easy/
183•linolevan•10h ago•142 comments

Why I wrote the BEAM book (2025)

https://happihacking.com/blog/posts/2025/why_I_wrote_theBEAMBook/
62•zenincognito•1d ago•5 comments

Synaptics patent claims stop work on DisplayLink drivers

https://lwn.net/SubscriberLink/1102549/acbc92e00cee3a3f/
378•speckx•13h ago•218 comments

A ZIP-style Prolog VM for trilog

https://github.com/no382001/zipc
8•triska•1d ago•0 comments

Starlink Mini 2

https://starlink.com/mini-2
379•robertjfclarke•13h ago•393 comments

AlphaProof Code

https://deepmind.google/blog/introducing-alphaproof-code/
615•ilreb•19h ago•182 comments

Tracking Anthropic-discovered vulnerabilities

https://www.vulncheck.com/blog/anthropic-glasswing-november-update
391•panic•9h ago•180 comments

Val Town is winding down

https://blog.val.town/winding-down
369•tosh•14h ago•93 comments

Hacking the Meta Ray-Ban smartglasses

https://p0pcycle.com/2026/11/06/hacking-the-meta-ray-ban-smartglasses/
99•moooooky•3d ago•35 comments

Show HN: Get your coding agent off ~2019 JavaScript, onto modern web primitives

https://github.com/GoogleChrome/modern-web-guidance
347•paulirish•13h ago•104 comments

Announcing .NET 11

https://devblogs.microsoft.com/dotnet/announcing-dotnet-11/
165•runesoerensen•15h ago•219 comments

AI is becoming an information gateway. Audiences still don’t want it making news

https://www.niemanlab.org/2026/11/ai-is-becoming-an-information-gateway-audiences-still-dont-want...
52•rdmuser•7h ago•33 comments

$30M Raised to Redo the CPU

https://tendrils.co/blog/2026-11-10/30m-raised
83•shioyama•9h ago•84 comments

LLMs Play Zachtronics' TIS-100

https://tis-100.wincon.dev/
49•fairestvalue•7h ago•8 comments

Claude Whiteboards, Claude Sheets, and Claude Data

https://claude.com/resources/articles/sheets-whiteboards-data
194•Yorothegoat•14h ago•146 comments

AI usage generates a fragile codebase

https://evanxmerz.com/post/ai-usage-generates-a-fragile-codebase/
510•plun9•21h ago•484 comments

AMD's Zen 6 Family: Feeding the Beast

https://chipsandcheese.com/p/amds-zen-6-family-feeding-the-beast
223•pixelpoet•14h ago•88 comments

Hooked on Tuna

https://theconversation.com/hooked-on-tuna-people-have-been-harvesting-these-ocean-predators-for-...
28•dnetesn•5h ago•3 comments

Process Explorer for macOS

https://github.com/microsoft/Procexp-Mac
190•ingve•1d ago•59 comments

A comprehensive study of how fingerprintable users are

https://fingerprinting.study/
107•tomrittervg•12h ago•47 comments

Ableton Live 13

https://www.ableton.com/en/live/
306•phaser•18h ago•320 comments