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?

Astrophysicists Puzzle over Webb’s New Universe

https://www.quantamagazine.org/astrophysicists-puzzle-over-webbs-new-universe-20260702/
87•jnord•4h ago•36 comments

The Vespa at 80: Why the Italian scooter remains the coolest thing on 2 wheels

https://www.cbc.ca/news/world/vespa-italy-postwar-design-9.7252641
50•cf100clunk•3d ago•41 comments

Show HN: Foundation, a different approach to software and AI

https://github.com/nmxmxh/foundation
10•MomohNobert•1h ago•2 comments

Night Witches – all-female Soviet aviator regiment WW2

https://en.wikipedia.org/wiki/Night_Witches
23•gverrilla•3d ago•4 comments

Maybe you should learn something

https://www.marginalia.nu/log/a_135_learn/
205•tylerdane•10h ago•95 comments

The bottleneck might be the air in the room

https://blog.mikebowler.ca/2026/07/03/co2-and-decision-making/
489•gslin•7h ago•303 comments

Postgres data stored in Parquet on S3: LTAP architecture explained

https://www.databricks.com/blog/lakebase-ltap-rethinking-database-storage
75•andrenotgiant•3d ago•22 comments

Performance per dollar is getting faster and cheaper

https://www.wafer.ai/blog/glm52-amd
291•latchkey•16h ago•107 comments

Leanstral 1.5: Proof abundance for all

https://mistral.ai/news/leanstral-1-5/
290•programLyrique•15h ago•83 comments

Costco is the anti-Amazon

https://phenomenalworld.org/analysis/the-anti-amazon/
457•bookofjoe•22h ago•415 comments

Mir Books – Books from the Soviet Era

https://mirtitles.org
116•clmul•3d ago•50 comments

Giant trees have no trouble pumping water to top branches: new research

https://news.exeter.ac.uk/faculty-of-environment-science-and-economy/giant-trees-have-no-trouble-...
231•hhs•15h ago•103 comments

Explanation of everything you can see in htop/top on Linux

https://peteris.rocks/blog/htop/
5•theanonymousone•2h ago•0 comments

Steam Controller Auto-Charge – pilot to magnetic charging puck using CV

https://github.com/FossPrime/Steam-Controller-Auto-Charge
166•zdw•15h ago•36 comments

Agentic coding notes from Galapagos Island

https://danluu.com/ai-coding/#appendix-agentic-loops-and-writing-this-post
133•gm678•9h ago•63 comments

MSI Center – How to gain SYSTEM privileges in seconds

https://mrbruh.com/msicenter/
114•MrBruh•13h ago•48 comments

Synthesis is harder than analysis

https://surfingcomplexity.blog/2026/07/03/synthesis-is-harder-than-analysis/
115•azhenley•11h ago•27 comments

2026 Unslop AI-Written Fiction Contest Results

https://www.hyperstitionai.com/unslop-results
32•networked•8h ago•82 comments

Jamesob's guide to running SOTA LLMs locally

https://github.com/jamesob/local-llm
371•livestyle•22h ago•168 comments

FreeBSD ate my RAM

https://crocidb.com/post/freebsd-ate-my-ram/
162•theanonymousone•18h ago•65 comments

SearXNG: A free internet metasearch engine

https://github.com/searxng/searxng
240•theanonymousone•17h ago•65 comments

The firefighting system of the Van der Heyden brothers in 17th century Amsterdam

https://worksinprogress.co/issue/how-amsterdam-invented-the-fire-department/
111•zdw•15h ago•20 comments

Odin, Wikipedia and engagement farming

https://katamari64.se/posts/2026/odin-wikipedia/
191•stock_toaster•14h ago•258 comments

The Scanline Sweeper: A Glyph Rendering Algorithm [pdf]

https://rookandpossum.com/papers/scanline_sweeper_preprint.pdf
25•kouosi•3d ago•2 comments

New serious vulnerabilities spiked around release of Claude Mythos Preview

https://epoch.ai/data-insights/cve-severity-spike
129•cubefox•16h ago•55 comments

Ship traces journey Spanish Armada sailors made in 1588

https://www.irishtimes.com/ireland/2026/06/30/it-is-a-huge-honour-ship-traces-journey-spanish-arm...
15•austinallegro•3d ago•8 comments

Soatok's Informal Guide to Threat Models

https://soatok.blog/2026/06/30/soatoks-informal-guide-to-threat-models/
109•zdw•13h ago•26 comments

Gone but Not Forgotten: Recovering the Dead Web

https://blog.archive.org/2026/04/23/gone-but-not-forgotten-recovering-the-dead-web/
85•wslh•3d ago•30 comments

Show HN: Classify mechanical faults using Contrastive Language-Audio Pretraining

https://github.com/adam-s/car-diagnosis
27•dataviz1000•2d ago•1 comments

Applied Category Theory Course (2018)

https://math.ucr.edu/home/baez/act_course/index.html
130•measurablefunc•17h ago•11 comments