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?

Since Chromium 148, Math.tanh is now fingerprintable to link underlying OS

https://scrapfly.dev/posts/browser-math-os-fingerprint/
313•joahnn_s•5h ago•154 comments

GhostLock, a stack-UAF that has existed in all Linux distributions for 15 years

https://nebusec.ai/research/ionstack-part-2/
92•ranger_danger•4d ago•16 comments

Cyberpunk Comics, Manga and Graphic Novels

https://shellzine.net/cyberpunk-comics/
79•zdw•3h ago•17 comments

Ask HN: Add flag for AI-generated articles

56•levkk•49m ago•20 comments

Tiny Emulators

https://floooh.github.io/tiny8bit-preview/index.html
149•naves•5h ago•9 comments

Designing and assembling my first PCB

https://vilkeliskis.com/b/2026/0711.html
53•tadasv•3h ago•5 comments

So you want to learn physics (second edition, 2021)

https://www.susanrigetti.com/physics
105•azhenley•4d ago•11 comments

Why Vanilla JavaScript

https://guseyn.com/html/posts/why-vanilla-js.html
48•guseyn•3h ago•20 comments

Ask HN: What Are You Working On? (July 2026)

79•david927•4h ago•205 comments

Old and new apps, via modern coding agents

https://terrytao.wordpress.com/2026/07/11/old-and-new-apps-via-modern-coding-agents/
413•subset•15h ago•120 comments

Migrating a production AI agent to GPT-5.6: 2.2x faster, 27% cheaper

https://ploy.ai/blog/migrating-a-production-ai-agent-to-gpt-5-6
145•brryant•9h ago•47 comments

Modernizing Property Tax Assessments in Allegheny County

https://www.prohousingpgh.org/blog/new-report-modernizing-property-tax-assessments-in-allegheny-c...
3•mooreds•26m ago•0 comments

The four horsemen behind Postgres outages

https://malisper.me/the-four-horsemen-behind-thousands-of-postgres-outages/
8•craigkerstiens•3d ago•0 comments

Claude Code sends 33k tokens before reading the prompt; OpenCode sends 7k

https://systima.ai/blog/claude-code-vs-opencode-token-overhead
470•systima•7h ago•264 comments

How we can reduce traffic congestion

https://research.google/blog/the-power-of-collaboration-how-we-can-reduce-traffic-congestion/
79•raahelb•10h ago•93 comments

Kode Dot Programmable pocket device for makers, pentesters and geeks

https://kode.diy
41•iNic•4h ago•10 comments

LARP – Revenue infrastructure for serious founders

https://www.larp.website/
163•BerislavLopac•9h ago•36 comments

I Learned to Read Again

https://substack.magazinenongrata.com/p/how-i-learned-to-read-again
103•georgex7•7h ago•41 comments

Why write code in 2026

https://softwaredoug.com/blog/2026/07/09/write-code
115•softwaredoug•2d ago•152 comments

Profiling the "Abundance" housing bottleneck with real data

https://laxmena.com/same-capacity-less-throughput
26•laxmena•4h ago•12 comments

Architecture Description Languages [pdf]

https://ics.uci.edu/~taylor/documents/2000-ADLs-TSE.pdf
20•ascent817•3h ago•1 comments

Calculix: A Free Software Three-Dimensional Structural Finite Element Program

https://www.calculix.de/
4•joebig•3d ago•0 comments

Automation Without Understanding

https://arxiv.org/abs/2607.06377
95•root-parent•9h ago•41 comments

Vint Cerf, “father of the Internet”, is retiring

https://techcrunch.com/2026/06/30/the-father-of-the-internet-is-finally-retiring/
283•compiler-guy•3d ago•162 comments

Mechanistic interpretability researchers applying causality theory to LLMs

https://cacm.acm.org/news/can-we-understand-how-large-language-models-reason/
84•adunk•8h ago•63 comments

I love LLMs, I hate hype

https://geohot.github.io//blog/jekyll/update/2026/07/12/i-love-llms.html
327•therepanic•7h ago•195 comments

MacKenzie Scott's giving, in quality-adjusted life years

https://maxghenis.com/mackenzie-scott-qaly/
52•383toast•1h ago•21 comments

Flash-MSA: Accelerating Million-Token Training with Sparse Attention Kernels

https://nanduruganesh.github.io/flash-msa/
22•rawsh•5h ago•0 comments

Against Usefulness

https://www.motivenotes.ai/p/against-usefulness
85•supo•8h ago•22 comments

Circular Obstacle Pathfinding (2017)

https://redblobgames.github.io/circular-obstacle-pathfinding/
9•andsoitis•2h ago•1 comments