SIMD has a reputation for being complex. I've met many very good software engineers who dismiss it as something too complex to learn or a niche optimization meant for only the highest-performance software, not useful in everyday programming. I think that's wrong. SIMD can be simple to understand1, and common "process N values at a time" SIMD code to speed up a naive for loop almost always follows
In a previous post SIMD Matters I discussed the big wins I got from graph coloring to make the contact solver faster. That same approach exists in Box3D. I like to call this approach “wide SIMD”. The idea is to process multiple work units at the same time. In the contact solver this means solving four contact points at the same time. This is different from “narrow SIMD” where a 3-vector (xyz) is p
C++26 ships with std::simd (P1928), a library-based portable SIMD abstraction. The pitch is seductive: write SIMD code once, compile it for AVX2, AVX-512, NEON, SVE. No more #ifdef __AVX512F__ spaghetti. No more intrinsics. Just std::simd<float> and let the compiler figure out the rest. A satirical repository by NoNaeAbC recently made the rounds, presenting “6 reasons to use std::simd” — each one
If you’re already familiar with SIMD, the table below is all you need. And if you’re not, you will understand the table by the end of this article! What’s SIMD? Why SIMD?Hardware that does arithmetic is cheap, so any CPU made this century has plenty of it. But you still only have one instruction decoding block and it is hard to get it to go fast, so the arithmetic hardware is vastly underutilized.
I’ve been learning a lot about low-level programming languages lately, and for a long time there has been one thing that has interested me: SIMD (or ‘single instruction, multiple data’) code. I’ve seen a lot of articles about having massive performance gains by utilizing SIMD and wanted to learn how to do it myself. This article is a journey into implementing ~60% faster substring searching compar
私は最近、Haskell処理系であるGHCのx86 NCG (native code generator) にSIMDプリミティブを実装する作業をやっています。LLVMなんかはSIMDに対するいい感じの抽象化を提供しているのですが、それを自前でやろうというわけです。 この記事は、x86のSSE等の命令を使ってSIMDプリミティブを実装する際に使う命令などに関するメモです。「SIMD命令比較」も参考になるかもしれません。 この記事では基本的に128ビット幅のベクトルを想定します。shuffle以外は256ビット幅や512ビット幅に応用するのは難しくないと思います。というか、256ビットとかだとAVXを仮定できるので色々楽だと思います。 基本:GCCやClangの出力を確認する 基本的な方針として、既存のコンパイラーの出力するアセンブリコードを参考にすると良いでしょう。 GCCでは型に __a
Using portable SIMD in stable Rust by Itamar Turner-Trauring Last updated 09 Dec 2024, originally created 12 Nov 2024 In a previous post we saw that you can speed up code significantly on a single core using SIMD: Single Instruction Multiple Data. These specialized CPU instructions allow you to, for example, add 4 values at once with a single instruction, instead of the usual one value at a time.
A couple of years ago I wrote about tolower() in bulk at speed using SWAR tricks. A couple of days ago I was interested by Olivier Giniaux’s article about unsafe read beyond of death, an optimization for handling small strings with SIMD instructions, for a fast hash function written in Rust. I’ve long been annoyed that SIMD instructions can easily eat short strings whole, but it’s irritatingly dif
So, there's this function. It's called a lot. More importantly, all those calls are on the critical path of a key user interaction. Let's talk about making it fast. Spoiler: it's a dot product. Some background (or skip to the juicy stuff)At Sourcegraph, we're working on a Code AI tool named Cody. In order for Cody to answer questions well, we need to give them enough context to work with. One of t
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く