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?

Nvidia announces native GPU programming in Rust

https://developer.nvidia.com/blog/introducing-cuda-rust-two-tracks-for-writing-gpu-kernels/
272•nonmaskable•14h ago•105 comments

Training a 4B model to produce 81% faster query plans than Postgres

https://rohanbansal.com/qorl
397•polyphilz•6h ago•84 comments

Xiaomi Mimo 2.6 live post-training dashboard

https://mimo.xiaomi.com/rl/
254•krackers•5h ago•64 comments

Breaking the 1.58-bit Barrier for Ternary LLMs

https://arxiv.org/abs/2609.16338
143•matt_d•4h ago•18 comments

Backups Aren't Simple

https://filipovski.net/2026/09/16/backups-arent-simple.html
77•afilipovski•5h ago•33 comments

Small programming tricks

https://will-keleher.com/posts/small-programming-tricks-matter/
399•signa11•9h ago•181 comments

The engineering behind the US Strategic Petroleum Reserve

https://johnjwang.com/post/2026/09/15/engineering-behind-us-strategic-petroleum-reserve
99•johnjwang•1d ago•32 comments

OpenSpec – A lightweight and configurable AI spec framework

https://openspec.dev/
63•etoxin•2h ago•18 comments

Reversing Factorio's RNG

https://gegell.github.io/posts/factorio-rng/
145•jheitmann•4d ago•19 comments

Performance Improvements in .NET 11

https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-11/
168•soheilpro•1d ago•33 comments

HarnessTax: How Much Does the Harness Matter for Coding Agents?

https://harnesstax.github.io/
36•matt_d•3h ago•4 comments

Japan's book scene is moving from bookstores to libraries

https://untranslatedjp.substack.com/p/japans-book-scene-is-quietly-moving
112•herbertl•4d ago•41 comments

Reverse-engineered Jev-like model

https://github.com/vinnylarouge/jevlike
76•rochansinha•6h ago•10 comments

Australia says it could follow Canada in forging deeper ties with EU

https://www.independent.co.uk/news/world/australasia/canda-eu-membership-australia-us-trade-b3050...
132•doener•2h ago•80 comments

Show HN: An e-ink frame that hears birds and draws them as 1800s illustrations

https://github.com/arnegiacomo/fugleramme
2085•arnemunthekaas•1d ago•239 comments

The Return of Sail Power: Cargo Ships Are Turning Back to the Wind

https://gcaptain.com/the-return-of-sail-power-cargo-ships-are-turning-back-to-the-wind/
9•gumby•1h ago•0 comments

OpenAI Discloses Six New Incidents of ‘Concerning’ A.I. Behavior

https://www.nytimes.com/2026/09/16/technology/openai-model-safety-guardrails.html
24•jbegley•42m ago•8 comments

AWS says it can't restore some data from mideast facilities struck by Iran

https://www.wsj.com/world/middle-east/aws-says-it-cant-restore-some-data-from-mideast-facilities-...
236•berkeleyjunk•1d ago•212 comments

Developing provably correct Rust code with Verus

https://www.amazon.science/blog/developing-provably-correct-rust-code-with-verus
9•Betelbuddy•2d ago•0 comments

Anecdotally, programmers dislike "reduce"

https://evanhahn.com/posts/2026-09-13-programmers-dislike-reduce/
95•vinhnx•2d ago•158 comments

Why Does the Universe Expand?

https://cosmicave.org/2026/09/15/why-does-the-universe-expand/
27•the__alchemist•5h ago•13 comments

Anatomy of a Texture

https://agentlien.github.io/texture/
74•Agentlien•11h ago•14 comments

Dream-RSI: Recursive Self-Improvement through Evolving Worlds

https://arxiv.org/abs/2609.14858
180•bananaflag•11h ago•49 comments

I replaced my brown-noise browser tab with a menu bar app

https://oldmanrahul.com/2026/09/14/hush/
22•oldmanrahul•12h ago•8 comments

Accurate Models of AMD Matrix Cores

https://arxiv.org/abs/2609.14845
60•matt_d•6h ago•7 comments

Destroy After Reading: photocopiers,cheap paper and DIY gave metal it's look

https://www.truegrittexturesupply.com/blogs/news/destroy-after-reading
15•pigeons•2d ago•4 comments

Hackers Got Inside a Flock Camera

https://www.wired.com/story/hackers-flock-camera-data-shows-how-system-works/
467•driverdan•12h ago•217 comments

Training Text-to-Image Models 3.6× Faster

https://www.linum.ai/field-notes/jit-ddt
36•schopra909•8h ago•7 comments

The DeepMind Institute

https://institute.deepmind.com/
141•vertigoruntime•11h ago•43 comments

Kyber (YC W23) Is Hiring a Forward Deployed Engineer

https://www.ycombinator.com/companies/kyber/jobs/eturrAR-forward-deployed-engineer
1•asontha•13h ago