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?

Houthis 'take control' of key island in global shipping route

https://www.bbc.com/news/live/cmd683p01eljt
171•consumer451•1h ago•124 comments

The Waymo effect: how AI is quietly making research less collaborative

https://www.researchagenda.news/articles/the-waymo-effect.html
263•JohnHammersley•4h ago•207 comments

Logo Programming Language

https://el.media.mit.edu/logo-foundation/what_is_logo/logo_programming.html
58•azhenley•2d ago•18 comments

Ask HN: Can we please limit the AI news flood?

482•cromka•2h ago•251 comments

So you want to use OpenRouter?

https://mmoustafa.com/blog/so-you-want-to-use-openrouter/
414•player85•2d ago•106 comments

Re-Engineering YouTube for the Living Room: Bringing "Chrobalt" to RDK

https://www.collabora.com/news-and-blog/news-and-events/re-engineering-youtube-for-the-living-roo...
14•losgehts•1h ago•3 comments

Cherenkov Radiation - traveling faster than light

http://www.iaea.org/newscenter/news/what-is-cherenkov-radiation
157•andsoitis•6h ago•80 comments

Shopify is moving from React Native back to Swift and Kotlin

https://shopify.engineering/back-to-native
1178•fnthawar2•1d ago•871 comments

RTK reports token savings, but our cost benchmarks disagree

https://quesma.com/blog/does-rtk-make-ai-coding-cheaper/
81•michalwarda•4h ago•48 comments

HuggingFace: Security.txt

https://huggingface.co/security.txt
25•yarapavan•42m ago•2 comments

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

https://blog.jim-nielsen.com/2026/hands-off-my-cables/
685•Brajeshwar•23h ago•413 comments

iPod Classic 6G in QEMU

https://www.reddit.com/r/emulation/s/VL4Au2HGxq
98•dmonterocrespo•3d ago•19 comments

RISC-V Emulator and Linux System from Scratch

https://github.com/WerWolv/riscv-emulator
30•Bluestein•3d ago•2 comments

CSS Curiosities of the Past

https://vale.rocks/posts/css-relics
54•robin_reala•7h ago•31 comments

I've operated petabyte-scale ClickHouse clusters for 5 years

https://www.tinybird.co/blog/what-i-learned-operating-clickhouse
9•adastral•3d ago•1 comments

If coding is solved, what now?: Measuring the sloppiness of code

https://earendil.com/posts/measuring-code-sloppiness/
93•doppp•1h ago•112 comments

Working with Git Worktrees in Magit

https://emacsredux.com/blog/2026/09/02/working-with-git-worktrees-in-magit/
91•srijan4•3d ago•38 comments

OpenAI Agents API

https://developers.openai.com/api/docs/guides/agents-api/overview
310•aquir•19h ago•166 comments

An interactive tour of the spanning tree protocol

https://vincent.bernat.ch/en/blog/2026-spanning-tree
57•zdw•3d ago•5 comments

Experiment – Projectional Viewer

https://programmingsimplicity.substack.com/p/experiment-projectional-viewer
11•surprisetalk•3d ago•1 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-...
321•rguiscard•14h ago•105 comments

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

https://spinoff.nasa.gov/Manipulating_Satellite_Photos_Now_Reveals_Ancient_Images
361•gumby•23h ago•62 comments

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

https://auberon.xyz/blog/posts/deathray/
249•auberonedu•19h ago•165 comments

Claude is no longer available for minors

https://support.claude.com/en/articles/15171100-age-assurance-on-claude
265•Muhammad523•4h ago•354 comments

New York thoracic surgeon: "For many patients 9/11 is not over"

https://www.statnews.com/2026/09/11/sept-11-25th-anniversary-ground-zero-exposure-cancer-moment-o...
13•EA-3167•1h ago•4 comments

Why Bullshit Jobs Are (Finally) Dying [video]

https://www.youtube.com/watch?v=QecDVkcGPxY
17•mpweiher•1h ago•11 comments

Music Theory for the 21st-Century Classroom

https://musictheory.pugetsound.edu/mt21c/MusicTheory.html
267•aanet•22h ago•125 comments

More questions about whether researchers can trust OpenAI with unpublished math

https://mathstodon.xyz/@andreasthom/117240535270608201
844•pred_•1d ago•787 comments

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

https://www.ntsb.gov:443/news/press-releases/Pages/NR20260909.aspx
135•mckn1ght•17h ago•237 comments

Nine coding harnesses vs. your laptop

https://nasutton.notion.site/Nine-coding-harnesses-vs-your-laptop-3d139990182b80d59fa3cf500f0450b...
150•nasutton12•16h ago•51 comments