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?

Shopify is moving from React Native back to Swift and Kotlin

https://shopify.engineering/back-to-native
940•fnthawar2•15h ago•628 comments

The little holes in your bread are telling you something

https://edconway.substack.com/p/the-little-holes-in-your-bread-are
21•baud147258•2d ago•6 comments

Nine coding harnesses vs. your laptop

https://nasutton.notion.site/Nine-coding-harnesses-vs-your-laptop-3d139990182b80d59fa3cf500f0450b...
32•nasutton12•6h ago•1 comments

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

https://blog.jim-nielsen.com/2026/hands-off-my-cables/
422•Brajeshwar•14h ago•292 comments

OpenAI Agents API

https://developers.openai.com/api/docs/guides/agents-api/overview
204•aquir•10h ago•122 comments

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

https://cognition.com/blog/swe-2
392•seelos•14h ago•165 comments

The Gemini app is now available for Windows

https://blog.google/innovation-and-ai/products/gemini-app/gemini-app-now-on-windows/
7•quysala12•58m ago•3 comments

The Deathray: A simple way for an untrusted site to freeze a Mac

https://auberon.xyz/blog/posts/deathray/
132•auberonedu•10h ago•88 comments

Technique for Manipulating Satellite Photos Now Reveals Ancient Images (2025)

https://spinoff.nasa.gov/Manipulating_Satellite_Photos_Now_Reveals_Ancient_Images
304•gumby•14h ago•46 comments

Mexican student creates an acoustic fire extinguisher to put out fire in seconds

https://www.upsocl.com/en/16-year-old-mexican-student-creates-an-acoustic-fire-extinguisher-that-...
122•rguiscard•4h ago•48 comments

Google will buy half the electricity from one of Finland's nuclear power plants

https://www.bbc.com/news/articles/c8r6y4me2g6o
171•lukaspetersson•5h ago•132 comments

Thelio Mira AI Linux Workstation: 192 GB GPU Memory

https://system76.com/workstations/thelio-mira-ai
74•jonifico•6h ago•47 comments

NTSB issues investigative update on B-767 runway excursion accident in Miami

https://www.ntsb.gov:443/news/press-releases/Pages/NR20260909.aspx
83•mckn1ght•8h ago•138 comments

Exercise intensity is associated with cardiometabolic health

https://www.cell.com/cell-reports-medicine/fulltext/S2666-3791(26)00405-2
58•qclibre22•2h ago•25 comments

Music Theory for the 21st-Century Classroom

https://musictheory.pugetsound.edu/mt21c/MusicTheory.html
197•aanet•12h ago•85 comments

More questions about whether researchers can trust OpenAI with unpublished math

https://mathstodon.xyz/@andreasthom/117240535270608201
767•pred_•23h ago•707 comments

YuE2 · Frontier Music with Symbolic Planning

https://map-yue2.github.io/
72•sexy_seedbox•5h ago•63 comments

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

https://merybenavente.me/blog/proof-of-capture
88•merybenavente•10h ago•52 comments

iPhone Duo

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

Neki – Sharded Postgres

https://planetscale.com/blog/introducing-neki
223•simon_weber•14h ago•122 comments

Forgejo <=16.0.3 Critical RCE

https://codeberg.org/forgejo/forgejo/src/branch/forgejo/release-notes-published/16.0.4.md
162•weierstass•13h ago•59 comments

Rust is tier-1 language at Microsoft

https://rustfoundation.org/media/guest-post-rust-is-tier-1-language-at-microsoft/
640•mmastrac•16h ago•369 comments

Herdr Studio

https://powerfooI.github.io/herdr-studio/
22•throwaway888abc•4h ago•14 comments

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

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

Customizing my Compaq MX-11800 keyboard

https://blog.webb.page/WM-102
22•NetOpWibby•3d ago•4 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...
297•thelastgallon•1d ago•247 comments

Detecting and countering misuse of AI: September 2026

https://www.anthropic.com/threat-intelligence-report-september-2026
107•garo-pro•12h ago•181 comments

JEP 544: Ahead-of-Time Code Compilation

https://openjdk.org/jeps/544
85•Skinney•12h ago•30 comments

What happens when a GPU writes memory

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

Recursion into madness

https://blog.coredump.cx/p/recursion-into-madness
54•surprisetalk•3d ago•14 comments