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?

Type-safe HTML templating in Zig

https://lalinsky.com/2026/10/11/type-safe-html-templating-in-zig.html
117•lukaslalinsky•5h ago•55 comments

Fingerprints are the new cookies

https://royfish.dev/fingerprints-are-the-new-cookies
380•royfish•11h ago•182 comments

Postgres isn't slow, your storage is

https://clickhouse.com/blog/posette-talk-recap-postgres-isnt-slow-your-storage-is
85•saisrirampur•3h ago•59 comments

Total Annihilation, rebuilt for modern computers

https://nanolathe.gg
516•jttnr•16h ago•204 comments

Calculus with Julia

https://jverzani.github.io/CalculusWithJuliaNotes.jl/
130•subset•1d ago•11 comments

Running the unmodified Linux amdgpu driver on an iPad

https://github.com/Geramy/LemonSeed-Studio
24•joshcsimmons•23h ago•10 comments

Whatever became of holography? (2011)

https://www.americanscientist.org/article/whatever-became-of-holography
133•cainxinth•10h ago•64 comments

Fable Took My Job

https://cendyne.dev/posts/2026-10-11-fable-took-my-jorb.html
121•jllyhill•1h ago•120 comments

Cartographers of North Korea (2019)

https://cartographers-nk.wonyoung.so/
264•edent•14h ago•48 comments

Zod 4.6.6 compromised by malware?

https://github.com/colinhacks/zod/commit/d821685ea6732436fcdf786a81d076958471e467
122•luggage_bazooka•2h ago•31 comments

Terence Tao: Math 2.0 [pdf]

https://teorth.github.io/tao-web/slides/math-2-0-caltech-2026.pdf
402•Anon84•20h ago•426 comments

Show HN: PS2 games statically recompiled to WebAssembly

https://github.com/snuri00/ps2-web-recomp
26•deadxwarrior•3h ago•4 comments

The gap in shared understanding of LLM capability is widening

https://twitter.com/karpathy/status/2109361546505966046
468•albertzeyer•13h ago•679 comments

Research Firm Calls Anthropic's IPO 'Unprecedented Test of Investor Gullibity'

https://www.cnbc.com/2026/10/07/anthropic-will-be-most-ridiculous-ipo-of-year-analyst-says.html
74•m463•5h ago•38 comments

Doory – Open-Source Canva

https://github.com/shaongitbd/doory
117•acley•9h ago•44 comments

Local Indexing to reduce tool calling and token usage

https://tedhaley.ca/pensieve/
80•TedHaley•10h ago•22 comments

No portable way to detect string-to-float conversion errors in standard C

https://sebsite.pw/w/20261009-strtod.html
51•signa11•1d ago•43 comments

Passkeys are a trap

https://nonfunctional.substack.com/p/passkeys-are-a-trap-do-not-use-them
638•laurex•12h ago•377 comments

Illustration Beyond Proof

https://terrytao.wordpress.com/2026/10/11/illustration-beyond-proof/
67•smilelamp•10h ago•7 comments

Chapter 1 of "Ways of Seeing" by John Berger (1972)

https://www.ways-of-seeing.com/ch1
110•rafael859•15h ago•18 comments

Will Linux phones become a viable alternative to the Android/iOS duopoly?

https://amosbbatto.wordpress.com/2026/10/05/linux-phones-alternative/
149•amosbatto•5h ago•160 comments

Bag of Decisions Reranker

https://softwaredoug.com/blog/2026/10/08/bag-of-decisions.html
3•zdw•1d ago•0 comments

Programmable pigments: Photochromic nanoparticle inks for rewritable tattoos

https://www.cell.com/matter-light/fulltext/S3117-5848(26)00119-5
56•Bluestein•1d ago•36 comments

Ask HN: Do you want a router that has DD-WRT pre-installed?

55•Ixander•1d ago•61 comments

Every US Electrical Outlet Explained [video]

https://www.youtube.com/watch?v=n_1wzYQwnts
25•zdw•1d ago•32 comments

So, you’d like to sell your print issues of The Onion?

https://theonion.com/archivehunt/
326•mooreds•14h ago•48 comments

NYC's "Click to Cancel" rule is now in effect

https://www.nyc.gov/main/click-to-cancel
477•gregsadetsky•16h ago•230 comments

Vectorized CLZ and CTZ

https://purplesyringa.moe/blog/vectorized-clz-and-ctz/
45•zX41ZdbW•1d ago•5 comments

Google Data Centers around the world

https://datacenters.google/locations/
58•andsoitis•11h ago•55 comments

I guess I'm using WebP now?

https://anderegg.ca/2026/10/08/i-guess-im-using-webp-now
112•Brajeshwar•2d ago•124 comments