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?

Cloudflare Quick Tunnels

https://try.cloudflare.com/
77•jcbhmr•1h ago•44 comments

An Empirical Study of Harness Design for Coding Agents

https://arxiv.org/abs/2609.20804
134•wek•2h ago•23 comments

North Korean nuclear test sets off years of earthquakes

https://www.science.org/content/article/north-korean-nuclear-test-sets-years-earthquakes
38•rbanffy•1h ago•27 comments

Show HN: Rickub – The Smartest Git in the Universe

https://rickub.com/
13•ssaboum•1h ago•2 comments

OpenJev

https://openjev.com/
332•ilreb•6h ago•191 comments

Bend 2 and the Vibe-Coding Trap

https://blog.liampwll.com/posts/bend_vibe_coding/
271•LiamPowell•3h ago•191 comments

I don't like passkeys

https://hawksley.dev/blog/i-dont-like-passkeys
417•ethanhawksley•3h ago•390 comments

The Shadows Lurking in the Equations – Underwater Islands

https://gods.art/articles/equation_shadows
39•vismit2000•2d ago•7 comments

Mathematicians Build Long-Awaited Graph Sandwich

https://www.quantamagazine.org/mathematicians-build-long-awaited-graph-sandwich-20260918/
11•ibobev•1h ago•0 comments

GrassLobster: AI Agentic Generation of Parametric Geometry Workflows

https://www.miro.vision/index.php/2026/09/17/grasslobbster/
6•aidog•57m ago•0 comments

NATS publishes preliminary report on technical incident of 8 September

https://www.nats.aero/news/nats-publishes-preliminary-report-on-technical-incident-of-8-september/
20•asplake•2h ago•11 comments

Build Faster Feedback Loops Using Qualitative User Research

https://blog.nseldeib.com/p/build-faster-feedback-loops-using
7•nadis•1h ago•0 comments

Jemalloc 5.4.0

https://github.com/jemalloc/jemalloc/releases/tag/5.4.0
268•gkfasdfasdf•11h ago•65 comments

Cekura (YC F24) Is Hiring

https://www.ycombinator.com/companies/cekura-ai/jobs/AiWwUxI-forward-deployed-engineer-us
1•atarus•4h ago

The scourge of x86 emulation

https://fex-emu.com/Scourge-of-emulation/
230•dagmx•11h ago•62 comments

Warren Buffett Steps Down as Berkshire Chairman, Names Son to Replace Him

https://www.nytimes.com/2026/09/18/business/warren-buffett-berkshire-chairman.html
193•saimiam•5h ago•128 comments

Bonsai 2 27B: Near-Lossless Compression in a 9x Smaller Footprint

https://prismml.com/news/bonsai-2-27b
523•JonSchneider•18h ago•172 comments

Bend – A language that blocks AI mistakes via proof, on CPU and GPU

https://bend-lang.com/
561•nicolas-siplis•19h ago•283 comments

ZCode, the GLM coding agent, silently uploads your Git history

https://tokenstead.ai/guides/zcode-silent-git-history-upload
235•cdnsteve•5h ago•53 comments

BeanShell3 in Development

https://beanshell.github.io/home.html
11•jimjag•1h ago•6 comments

Qwen 3.8 Omni Flash

https://qwen.ai/blog?id=qwen3.8-omni-flash
296•jjcm•16h ago•106 comments

Microsoft exec called AI scraping 'the largest theft of labor in human history'

https://techcrunch.com/2026/09/17/microsoft-exec-called-ai-scraping-the-largest-theft-of-labor-in...
642•pluc•6h ago•557 comments

Second Circuit Allows Government to Search Electronic Devices at the Border

https://knightcolumbia.org/content/second-circuit-allows-government-to-search-electronic-devices-...
37•HotGarbage•1h ago•26 comments

When the fractional part of a float fixes your shader

https://crocidb.com/post/when-the-fractional-part-of-a-float-fixes-your-shader/
83•vinhnx•2d ago•16 comments

How to Write with an LLM

https://sockpuppet.org/blog/2026/09/17/how-to-write-with-an-llm/
258•joeriddles•18h ago•174 comments

Pre-Greek: The lost language hidden within Ancient Greek

https://linguisticdiscovery.com/posts/pre-greek/
127•axiologist•12h ago•57 comments

HEIF Heist: image parser RCE exploit

https://heif-heist.com
7•glennericksen•2h ago•1 comments

Replacing Pull Requests with Delta

https://zed.dev/blog/delta-public-beta
103•vquemener•2d ago•59 comments

I Vibed a Proof of Conway's Conjecture

https://overreacted.io/how-i-vibed-a-proof-of-conways-conjecture/
68•m-hodges•1h ago•68 comments

New wild cat species discovered – with only one known living member

https://www.bbc.com/news/articles/c6x2zgv9rr4ro
38•drgo•8h ago•8 comments