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?

Cognition launches new SWE-2 model, Rivaling Fable 5.1 and GPT-Astra

https://cognition.com/blog/swe-2
245•seelos•5h ago•111 comments

More questions about whether researchers can trust OpenAI with unpublished math

https://mathstodon.xyz/@andreasthom/117240535270608201
387•pred_•14h ago•476 comments

NASA Color Trick Was Meant for Mars. Now It's Unveiling Rock Art on Earth

https://gizmodo.com/this-nasa-color-trick-was-meant-for-mars-now-its-unveiling-rock-art-on-earth-...
183•gumby•5h ago•31 comments

Don't let anyone take away your big box of cables

https://blog.jim-nielsen.com/2026/hands-off-my-cables/
125•Brajeshwar•5h ago•101 comments

Shopify moves back to Native from React Native

https://shopify.engineering/back-to-native
581•fnthawar2•6h ago•401 comments

Music Theory for the 21st-Century Classroom

https://musictheory.pugetsound.edu/mt21c/MusicTheory.html
75•aanet•3h ago•39 comments

Forgejo <=16.0.3 Critical RCE

https://codeberg.org/forgejo/forgejo/src/branch/forgejo/release-notes-published/16.0.4.md
99•weierstass•4h ago•41 comments

Neki

https://planetscale.com/blog/introducing-neki
156•simon_weber•5h ago•64 comments

Rust is tier-1 language at Microsoft

https://rustfoundation.org/media/guest-post-rust-is-tier-1-language-at-microsoft/
517•mmastrac•7h ago•281 comments

Hitachi launches CO2 heat pump water heaters with solar-friendly tariff controls

https://www.pv-magazine.com/2026/09/07/hitachi-launches-co2-heat-pump-water-heaters-with-solar-fr...
254•thelastgallon•1d ago•205 comments

JEP 544: Ahead-of-Time Code Compilation

https://openjdk.org/jeps/544
40•Skinney•3h ago•19 comments

Douglas Hofstadter: Analogy as the Core of Cognition [video]

https://www.youtube.com/watch?v=n8m7lFQ3njk
95•tosh•4d ago•57 comments

DeepSeek v4.1 Flash

https://twitter.com/deepseek_ai/status/2097930608790167907
890•Liwink•14h ago•498 comments

Proof of Capture: Apple Reference Image, but open source and using steganography

https://merybenavente.me/blog/proof-of-capture
9•merybenavente•1h ago•0 comments

Silicon Valley Is Transforming the Military-Industrial Complex

https://costsofwar.watson.brown.edu/paper/how-big-tech-and-silicon-valley-are-transforming-milita...
110•paimapi•5h ago•169 comments

Creativity is the New Moat

https://www.inventbuild.studio/blog/genuine-creativity-is-your-new-moat
68•virgil_disgr4ce•1h ago•36 comments

What happens when a GPU writes memory

https://blog.doubleword.ai/what-happens-when-a-gpu-writes-memory
10•ibobev•2d ago•0 comments

Cognition's SWE-2 achieves 92.8 on Terminal-Bench 2.1

https://tokenstead.ai/models/swe-2
38•cdnsteve•3h ago•17 comments

Compute-efficient pretraining and scaling to trillion-parameter models

https://magic.dev/blog/pretraining#
103•ronfriedhaber•2d ago•54 comments

What algorithm did Windows XP use to choose your initial user picture?

https://devblogs.microsoft.com/oldnewthing/20260909-00/?p=112683
315•soheilpro•11h ago•153 comments

Schemy Lisp En DOS

https://sled.neocities.org/
67•AlexeyBrin•4d ago•11 comments

Python sets and dictionaries can have quadratic-time performance

https://lemire.me/blog/2026/09/03/python-sets-and-dictionaries-can-have-quadratic-time-performance/
69•ibobev•2d ago•34 comments

iPhone Duo

https://www.apple.com/iphone-duo/
1383•thecosmicfrog•1d ago•2400 comments

List of references on Sony websites to players "owning" their digital games

https://consumerrights.wiki/w/Sony_PlayStation_digital_game_ownership_lawsuit
308•haunter•8h ago•100 comments

Stockfish 19

https://stockfishchess.org/blog/2026/stockfish-19/
245•atiedebee•3d ago•141 comments

Macbeth and His Problems

https://porticoquarterly.com/essay/macbeth-and-his-problems/
70•apophatic•3d ago•26 comments

Detecting and countering misuse of AI: September 2026

https://www.anthropic.com/threat-intelligence-report-september-2026
20•garo-pro•3h ago•7 comments

To write non-fiction, draw the trunk, then the rest of the tree

https://devz.cl/posts/how-to-write/
74•DanielVZ•2d ago•27 comments

Show HN: MultiMatte, a Promptable Image Background Removal Model

https://usefeyn.com/blog/multimatte/
27•snyy•5h ago•5 comments

Casablanca: How an unproduced play marched into movie history

https://www.thecollector.com/casablanca-unproduced-play-movie-history/
41•mdp2021•4h ago•15 comments