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?

Xiaomi MiMo v2.6

https://mimo.xiaomi.com/mimo-v2-6
564•volf_•6h ago•286 comments

Claude Status – Elevated errors for multiple models

https://status.claude.com/incidents/7g1qpkyz5gxh
60•corvad•1h ago•32 comments

Spymarks, Not Watermarks

https://brand.io/article/spymarks/
129•possibilistic•3h ago•32 comments

I don't want to read what you didn't write

https://blog.colinbreck.com/i-dont-want-to-read-what-you-didnt-write/
283•mooreds•3h ago•108 comments

Transformers Explained Visually

https://poloclub.github.io/transformer-explainer/
213•aray07•6h ago•37 comments

What Sun got wrong

https://bcantrill.dtrace.org/2026/09/20/what-sun-got-wrong/
504•chmaynard•12h ago•294 comments

Attention is all you have

https://alicegg.tech/2026/09/21/attention
590•zer0tonin•11h ago•178 comments

NASA’s Mars Sample Return mission is dead

https://www.science.org/content/article/nasa-s-mars-sample-return-mission-dead
318•Muhammad523•7h ago•252 comments

AI coding has made CI a bottleneck, so we reworked ours to keep up

https://linear.app/now/ci-bottleneck-reworked
145•julian_digital•6h ago•148 comments

Looking forward to Git 2.56 – and 3.0

https://lwn.net/SubscriberLink/1094575/2385e98583715c2b/
34•chmaynard•2h ago•7 comments

Divide by depth for instant 3D

https://gabrieloc.com/2026/09/15/perspective.html
87•gabrieloc•2d ago•9 comments

The Advisory Group on Mathematics and Artificial Intelligence

https://terrytao.wordpress.com/2026/09/21/advisory-group-on-mathematics-and-artificial-intelligence/
90•digital55•6h ago•43 comments

Socrates vs. the Written Word (2011)

https://wondermark.com/socrates-vs-writing/
9•spectraldrift•2h ago•0 comments

Robin Williams' Daughter to Fans Creating AI Videos: 'Have Some Shame'

https://variety.com/2026/film/news/robin-williams-daughter-ai-videos-1236871568/
28•CharlesW•51m ago•0 comments

How do traffic signals work? (2019)

https://practical.engineering/blog/2019/5/11/how-do-traffic-signals-work
62•at1as•10h ago•46 comments

More Floating Point Alternatives

https://wizardzines.com/comics/floating-point-alternatives/
8•vismit2000•2d ago•6 comments

The agents, they just want to talk

https://snats.xyz/pages/articles/political_ecology/the_agents_they_just_want_to_talk.html
15•snats•9h ago•4 comments

Why does mathmain need an encrypted loader?

https://safedep.io/mathmain-encrypted-loader/
111•abhisek•7h ago•31 comments

Paper Models of Polyhedra

https://www.polyhedra.net/en/
4•pykello•2d ago•0 comments

Frontier AI on Your Own Hardware

https://timdettmers.com/2026/09/21/dlab-open-source-week/
105•pretext•7h ago•54 comments

First Shader from Zero in Godot 4

https://www.gdquest.com/library/first_shader_godot4_portal/
33•ibobev•15h ago•3 comments

Turn off and restrict access to Apple Intelligence features on Mac

https://support.apple.com/guide/mac-help/turn-restrict-access-apple-intelligence-mchlb2e44f94/mac
245•alwillis•8h ago•165 comments

Grok 4.7

https://x.ai/news/grok-4-7
504•meetpateltech•10h ago•419 comments

Kev: Tiny Jev-like family of decision models built on top of Qwen3.5

https://github.com/jaredpalmer/kev/tree/main
408•tosh•19h ago•184 comments

Apple Copland D11E4 Booting in the Browser

https://www.pagetable.com/300
104•luu•8h ago•30 comments

HERMES radio enables voice and data communication over vast distances

https://spectrum.ieee.org/hermes-shortwave-radio-digital-data
100•SamuraiLion•10h ago•41 comments

Python Workers are now generally available

https://blog.cloudflare.com/python-workers-ga/
184•torutofu•12h ago•32 comments

Roboharm: Do frontier robot policies refuse unsafe instructions?

https://robocurve.org/roboharm/
37•msadowski•7h ago•19 comments

US halts flights at busy East Coast airports, says fiber line cut

https://www.reuters.com/world/us/faa-halts-some-us-east-coast-flights-due-communication-issues-20...
203•allanbreyes•7h ago•116 comments

TXR: An Original, New Programming Language for Convenient Data Munging

https://www.nongnu.org/txr/
22•andsoitis•21h ago•2 comments