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?

StreetComplete: Fixing OpenStreetMap, one tiny quest at a time

https://streetcomplete.app/
293•kls0e•3h ago•60 comments

Microsoft Fire IdTech Team at Id Software

https://gamefromscratch.com/microsoft-fire-idtech-team-at-id-software/
62•bauc•28m ago•20 comments

A better way to tie your gym shorts. (Or any drawstring) [video]

https://www.youtube.com/watch?v=3R0Lp86GEBk
231•surprisetalk•3h ago•90 comments

98% Isn't Much

https://whynothugo.nl/journal/2026/07/03/98-isnt-very-much/
287•speckx•3h ago•218 comments

Better Auth is joining Vercel

https://better-auth.com/blog/better-auth-joins-vercel
15•sync•9m ago•4 comments

Europe's company websites are mostly served by US vendors

https://ciphercue.com/blog/european-web-hosting-vendor-share-2026
168•adulion•3h ago•126 comments

Chat Control passed first round in EU Parliament

https://www.heise.de/en/news/Showdown-in-Strasbourg-The-unexpected-return-of-Chat-Control-1-0-113...
96•miroljub•45m ago•41 comments

Top researchers leave USA for the Netherlands (in Dutch)

https://www.nwo.nl/nieuws/eerste-internationale-wetenschappers-via-het-tulp-fonds-naar-nederland
242•28304283409234•5h ago•187 comments

C++ Details of Asymmetric Fences

https://nekrozqliphort.github.io/posts/membarrier/
35•anon_farmer•3d ago•1 comments

9 Mothers (YC P26) Is Hiring in Austin, TX

https://9mothers.com/careers
1•ukd1•4h ago

Show HN: PostgreSQL performance and cost across 23 EC2 instance types

https://postgres.saneengineer.com
31•anivan_•3h ago•0 comments

OpenWrt One – Open Hardware Router

https://openwrt.org/toh/openwrt/one
764•peter_d_sherman•21h ago•285 comments

CoMaps – FOSS Offline Maps

https://www.comaps.app/
712•basilikum•21h ago•174 comments

The Family Keeping Watch over a 52-Year-Old Pot of Soup

https://www.wsj.com/arts-culture/food-cooking/the-family-keeping-watch-over-a-52-year-old-pot-of-...
40•petethomas•6d ago•34 comments

How to sequence your own DNA at home

https://bradleywoolf.com/links-1/sequencing-my-own-dna-at-home
331•bilsbie•15h ago•124 comments

The Revenge of the Philosophy Majors

https://www.nytimes.com/2026/07/05/business/philosophy-majors-ai-jobs.html
49•benbreen•1h ago•55 comments

Small AI Models Gain Traction In places with unreliable networks

https://spectrum.ieee.org/small-language-models-ai-pharmaceuticals
235•sscaryterry•16h ago•70 comments

Historic Photos of NASA's Cavernous Wind Tunnels

https://www.theatlantic.com/photo/2018/05/historic-photos-of-nasas-cavernous-wind-tunnels/560660/
76•ohjeez•2d ago•20 comments

The Art of Computer Programming by Donald E. Knuth

https://www-cs-faculty.stanford.edu/~knuth/taocp.html
134•archargelod•10h ago•36 comments

GLM 5.2 and the coming AI margin collapse

https://martinalderson.com/posts/the-upcoming-ai-margin-collapse-part-1-glm-5-2/
616•martinald•19h ago•398 comments

Ask HN: Where are the good search engines for mathematical formulas?

22•lo0dot0•2d ago•7 comments

Microsoft Can Track Users via a Windows Device ID

https://www.pcmag.com/news/a-hackers-arrest-reveals-microsoft-can-track-users-via-a-windows-device
264•ifh-hn•7h ago•108 comments

But Nothing Has Changed on Our Side

https://cacm.acm.org/blogcacm/but-nothing-has-changed-on-our-side/
4•adunk•3d ago•1 comments

Fable turned reMarkable into Tom Riddle's diary from Harry Potter

https://github.com/MaximeRivest/Riddle
589•modinfo•17h ago•358 comments

Dolosse – a South African invention used over the world

https://thisbugslife.com/2021/11/21/dolosse-a-south-african-invention-used-over-the-world/
110•andsoitis•3d ago•27 comments

Dua Lipa opens library for banned and censored books in Portugal

https://www.euronews.com/culture/2026/06/29/dua-lipa-opens-library-for-banned-and-censored-books-...
168•pax•3h ago•151 comments

Ternlight – 7 MB embedding model that runs in browser (WASM)

https://ternlight-demo.vercel.app/
297•soycaporal•16h ago•60 comments

A global workspace in language models

https://www.anthropic.com/research/global-workspace
427•in-silico•22h ago•169 comments

Resetting Xbox

https://news.xbox.com/en-us/2026/07/06/resetting-xbox/
707•dijksterhuis•1d ago•842 comments

In Praise of Observational Evidence

https://asteriskmag.com/issues/14/in-praise-of-observational-evidence
66•fi-le•6d ago•34 comments