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?

LG denies TV spying claims, says tracking and snooping concerns 'not true'

https://www.tomshardware.com/tech-industry/big-tech/lg-strongly-denies-tv-security-claims-says-tr...
83•datakan•2d ago•128 comments

Make your first edit to OpenStreetMap

https://high5apps.github.io/josm-plugin-website-wizard/
88•juliantigler•2h ago•31 comments

Nvidia is the central bank of AI

https://www.economist.com/interactive/briefing/2026/09/03/nvidia-is-the-central-bank-of-ai
189•tolugenius•3h ago•152 comments

Microcode in Intel's 8087 floating-point chip: the scale instruction

https://www.righto.com/2026/09/8087-microcode-reverse-engineering-fscale.html
40•pwg•2h ago•8 comments

IKEA made a mod for Skyrim [video]

https://www.youtube.com/watch?v=iZODN0QUgjI
458•kegenaar•2d ago•116 comments

I refuse to let SPICE die

https://github.com/nefarius/vd_agent/
51•Nefarius•4h ago•38 comments

We must pace the frontier

https://darioamodei.com/post/we-must-pace-the-frontier
250•apsec112•4h ago•322 comments

google.com/goto: Google's anti-scraping update

https://www.autom.dev/blog/google-search-goto-links
564•1e1a•15h ago•447 comments

A Mathematical Framework for Transformer Circuits (2021)

https://transformer-circuits.pub/2021/framework/index.html
55•Bluestein•4h ago•12 comments

Retrospectively Reverse-Engineering Apple's Neural Engine

https://eiln.github.io/posts/ane.html
191•zdw•10h ago•24 comments

How Trail of Bits helps verify the integrity of Signal chats

https://blog.trailofbits.com/2026/08/11/how-trail-of-bits-helps-verify-the-integrity-of-your-sign...
8•dgroshev•7h ago•1 comments

I made a build visualizer to understand Bun's compile times

https://lalitm.com/post/buildprof/
10•lalitmaganti•3h ago•2 comments

A Few Good Ideas in Programming Languages

https://prydt.xyz/blog/a-few-good-ideas-in-pl/
41•airhangerf15•5h ago•12 comments

LRU is harder to beat than the KV-cache papers suggest

https://github.com/gauravapiscean/agentic-kv-cache
73•gauravapiscean•2d ago•34 comments

Android NAT-T keepalive offload bypasses VPN lockdown

https://supuk.ch/papers/android-natt-keepalive-vpn-bypass
127•mhitza•21h ago•28 comments

Eating Fruit Skins

https://pgadey.ca/blog/eating-fruit-skins/
27•surprisetalk•3d ago•85 comments

I fixed a tractor using John Deere's self-repair service. Farmers aren't sold

https://www.wired.com/story/i-fixed-a-tractor-john-deere-self-repair-service/
51•sbulaev•1d ago•64 comments

Performance of WebAssembly Runtimes in 2026

https://00f.net/2026/06/23/webassembly-runtimes-2026/
53•fagnerbrack•3d ago•12 comments

Navier-Stokes Announcement

https://www.claymath.org/news/navier-stokes-announcement/
251•rvz•14h ago•201 comments

The worst spam emails: iLands AI agent hustle

https://tedium.co/2026/09/11/ilands-agents-email-spam-kaixin-tang/
79•ColinWright•7h ago•42 comments

λ Snap – An inviting programming language for kids and adults for CS study

https://snap.berkeley.edu/
161•dr_kiszonka•1d ago•100 comments

Experimental Evaluation Methodology for the Era of No Steady Performance [pdf]

https://www.d3s.mff.cuni.cz/files/publications/antoch_experimental_2026.pdf
3•luu•2d ago•0 comments

Reconstructing Concurrency Invariants Through Medieval East Asian Logic

https://oborona.zip/post/a-middle-period-engine-reconstructing-concurrency-invariants-through-eas...
10•gg582•1d ago•3 comments

How we manage and engage with our horses shapes their personality

https://www.utu.fi/en/news/press-release/how-we-manage-and-engage-with-our-horses-shapes-their-pe...
16•thunderbong•2d ago•2 comments

Fuck it, make it anyway

https://www.joelotter.com/posts/2026/09/make-it-anyway/
464•JayOtter•6h ago•451 comments

A Design Space Exploration of Async/Await

https://cel.cs.brown.edu/blog/design-space-async-await/
391•wcrichton•3d ago•113 comments

Waymo pulls over, calls cops on juvenile riders who had 'ghost gun"

https://www.latimes.com/california/story/2026-09-12/juveniles-riding-in-waymo-arrested-after-poli...
69•mmayberry•4h ago•107 comments

Great Lakes sturgeon may be 400 years old:Scientists rethinking how to save them

https://www.cbc.ca/news/canada/ontario-great-lakes-sturgeon-lifespan-study-9.7329250
127•bookofjoe•3d ago•36 comments

A misalignment of AI in mathematics

https://mathandai.org/
1147•meredydd•1d ago•1086 comments

Will There Be a 7G?

https://arxiv.org/abs/2609.01877
27•Betelbuddy•1h ago•40 comments