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?

Mea Culpa – Dark Hours

https://blog.terrygodier.com/2026/08/09/mea-culpa-dark-hours.html
347•satvikpendem•4h ago•146 comments

Criminal Deception in Silicon Valley

https://pubsonline.informs.org/doi/full/10.1287/orsc.2024.19981
76•iamnothere•2h ago•25 comments

Ask HN: What are you working on? (August 2026)

10•david927•26m ago•20 comments

Cool URIs Don't Change (1998)

https://www.w3.org/Provider/Style/URI
57•Klaster_1•3h ago•6 comments

John C. Lilly on solid state intelligence and the elimination of man (1978)

https://kibotronics.net/unlisted/lilly-machines/
58•Kiboneu•4h ago•22 comments

Production Imminent: 40 Solar-Charging Aptera EVs Coming Soon

https://frequal.com/aptera/ProductionImminent.html
5•TeaVMFan•30m ago•1 comments

Show HN: A Project Oberon System version running on RISC-V instead of RISC-5

https://github.com/rochus-keller/OberonSystem/tree/op2-rv32
69•Rochus•5h ago•15 comments

Human vs. AI – Diff-based line-level provenance for text under agentic editing

https://github.com/eighttrigrams/us-vs-them
13•eighttrigrams•2h ago•1 comments

Every fast write moves work somewhere else

https://www.shayon.dev/post/2026/220/every-fast-write-moves-work-somewhere-else/
19•shayonj•2h ago•6 comments

Crickets as Pets

https://en.wikipedia.org/wiki/Crickets_as_pets
18•Michelangelo11•4d ago•5 comments

There Are Magic Hexagons of Every Order

https://gukov.dev/math/2026/08/02/new-magic-hexagons.html
147•gukoff•10h ago•21 comments

Silicon Valley misreads science fiction and undermines democracy

https://techcrunch.com/2026/08/09/historian-jill-lepore-says-the-tech-industry-is-led-by-bad-read...
138•evo_9•2h ago•96 comments

My server is a phone now

https://seg6.space/posts/phone-server/
457•seg6•19h ago•216 comments

Tom Stanton's supersonic trebuchet breaks sound barrier with gravity alone

https://www.techeblog.com/tom-stanton-supersonic-trebuchet/
84•Thorondor•2h ago•24 comments

Microsoft Word for Windows 1.1a, Native X64 Port

https://github.com/jmarshall23/msword
137•BruceEel•12h ago•59 comments

Os8088: A powerful Mac-like OS for the IBM XT, 286, 386

https://os8088.com/
232•jggonz•18h ago•150 comments

FCC moves to ban Lidar-equipped foreign drones from US

https://www.tomshardware.com/tech-industry/drones/fcc-moves-to-ban-lidar-equipped-foreign-drones-...
27•f-serif•1h ago•2 comments

Show HN: Today's cities on a globe of Earth's tectonic past and future

https://douwe.com/projects/tectonic_globe
12•dosinga•3h ago•0 comments

Taxi drivers rarely die of Alzheimer's

https://theconversation.com/taxi-drivers-rarely-die-of-alzheimers-how-complex-mental-maps-and-spa...
39•jader201•2h ago•27 comments

Dithered QR Codes

https://www.andrewt.net/dithered-qr-codes/wtf/
336•jmusall•18h ago•37 comments

The Alpha 21264 CPU: NT's Greatest RISC (1998)

https://halfhill.com/byte/1998-12_alpha.html
59•Lammy•7h ago•41 comments

The Grid That Doubles the Strength of the Ground

https://practical.engineering/blog/2026/8/4/the-grid-that-doubles-the-strength-of-the-ground
102•michaefe•4d ago•29 comments

Windows 11's built-in Weather app wastes more than 1 GB of RAM

https://www.notebookcheck.net/Windows-11-s-built-in-Weather-app-wastes-more-than-1-GB-of-RAM.1364...
101•akyuu•2h ago•86 comments

Literary Sins

https://www.thedial.world/articles/news/seven-literary-sins
4•lermontov•3d ago•0 comments

A partial digestion of the HRT counterexample

https://terrytao.wordpress.com/2026/08/06/a-partial-digestion-of-the-hrt-counterexample/
9•ijustlovemath•3h ago•1 comments

Banksy works cost public almost £150k

https://www.bbc.co.uk/news/articles/cx2vnny7j5zo
14•alvis•1h ago•23 comments

Show HN: Airy – Free, fast, and simple voice content creation

https://airy.so
24•login588•8h ago•12 comments

We replaced Redis with MySQL for inventory reservations and it scaled

https://shopify.engineering/scaling-inventory-reservations
311•adletbalzhanov•19h ago•209 comments

Making difficulty curves in games

http://www.davetech.co.uk/difficultycurves
157•hakkikonu•4d ago•76 comments

TheoremDB – A public workspace for machine mathematics

https://theoremdb.org/
83•frozenseven•16h ago•13 comments