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?

Running local models is good now

https://vickiboykis.com/2026/06/15/running-local-models-is-good-now/
234•jfb•1h ago•129 comments

Fable ban was never about a jailbreak

https://techcrunch.com/2026/06/15/the-us-governments-anthropic-models-ban-was-never-about-an-ai-j...
66•amarant•51m ago•16 comments

Mechanical Watch (2022)

https://ciechanow.ski/mechanical-watch/
443•razin•4h ago•79 comments

Subquadratic – Introducing SubQ 1.1 Small

https://subq.ai/subq-1-1-small-technical-report
42•EDM115•1h ago•18 comments

Correlated randomness in Slay the Spire 2

https://tck.mn/blog/correlated-randomness-sts2/
180•rdmuser•6h ago•60 comments

I admire Fabrice Bellard. He is almost certainly a better overall programmer

https://twitter.com/ID_AA_Carmack/status/2064095424420487226
660•apitman•11h ago•326 comments

Google Chrome's Next Update Will Mark the End of Popular Ad Blockers

https://tech.slashdot.org/story/26/06/15/205219/google-chromes-next-update-will-mark-the-end-of-p...
89•arnejenssen•1h ago•64 comments

A backdoor in a LinkedIn job offer

https://roman.pt/posts/linkedin-backdoor/
1455•lwhsiao•20h ago•274 comments

The time the x86 emulator team found code so bad they fixed it during emulation

https://devblogs.microsoft.com/oldnewthing/20260615-00/?p=112419
426•paulmooreparks•11h ago•136 comments

An interview with an Apple emoji designer

https://shadycharacters.co.uk/2026/06/ollie-wagner/
52•nate•2d ago•26 comments

Getting Creative with Perlin Noise Fields

https://sighack.com/post/getting-creative-with-perlin-noise-fields
112•0x000xca0xfe•2d ago•19 comments

4× RTX Pro 6000 Blackwell on Water, and the One Card That Wouldn't Behave

https://sabareesh.com/posts/blackwell-waterblock/
34•sabareesh•3d ago•32 comments

Unicorn – The Ultimate CPU Emulator

https://www.unicorn-engine.org/
39•tosh•5h ago•11 comments

Feds freaked over Fable 5 after simple 'fix this code' prompt, not jailbreak

https://www.theregister.com/security/2026/06/15/feds-freaked-over-fable-5-after-simple-fix-this-c...
410•_tk_•6h ago•230 comments

Banned Book Library in a Wi-Fi Smart Light Bulb

https://www.richardosgood.com/posts/banned-book-library/
520•sohkamyung•17h ago•311 comments

But yak shaving is fun

https://parksb.github.io/en/article/32.html
9•parksb•1h ago•0 comments

TinyWind: A pixel pirate sailing game with real wind physics (380k+ kms sailed)

https://tinywind.io
951•tinywind•1d ago•169 comments

SpaceX to buy Cursor for $60B

https://www.reuters.com/legal/transactional/spacex-buy-anysphere-60-billion-2026-06-16/
269•itsmarcelg•5h ago•209 comments

The history of butterfly swimming

https://www.swimming.org/sport/history-of-butterfly/
13•mooreds•2d ago•11 comments

UK to require ID or face scan before you can make social media accounts

https://www.bleepingcomputer.com/news/security/uk-to-require-id-or-face-scan-before-you-can-make-...
18•speckx•39m ago•12 comments

Understanding the rationale behind a rule when trying to circumvent it

https://devblogs.microsoft.com/oldnewthing/20260611-00/?p=112415
84•tosh•8h ago•27 comments

Trinket.io shutting down, so we saved it and hosted it a trinket.strivemath.org

https://trinket.strivemath.org/
88•apulkit6•6h ago•11 comments

Google Chrome update will close the door on ad blockers

https://9to5google.com/2026/06/15/google-chromes-next-update-will-mark-the-end-of-popular-ad-bloc...
169•speckx•2h ago•104 comments

I Love the Computer

https://michaelenger.com/blog/i-love-the-computer/
286•speckx•20h ago•156 comments

Color Photos of Stalin-Era Soviet Union Taken by a US Diplomat

https://rarehistoricalphotos.com/stalin-era-soviet-union-pictures-martin-manhoff/
109•Cider9986•2d ago•37 comments

I Fired Google

https://www.theartofdoingstuff.com/i-fired-google/
103•speckx•1h ago•91 comments

Show HN: Garden of Flowers – an archive of pictorial typography before ASCII art

https://garden-of-flowers.heikkilotvonen.com/
119•california-og•11h ago•16 comments

'Wow, it really worked ': 70s TV show causing worldwide panic today

https://www.theguardian.com/tv-and-radio/2026/jun/16/alternative-3-mockumentary-missing-scientist...
62•defrost•3h ago•39 comments

I hacked into the worst e-bike and fixed it [video]

https://www.youtube.com/watch?v=hPrtVGimBYs
149•alexis-d•5d ago•73 comments

CJEU: Social networks are the 'publishers' of algorithmically-altered feeds

https://bsky.app/profile/stevepeers.bsky.social/post/3mofdspytds2l
13•handelaar•49m ago•3 comments