Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
Search
po3rin
September 11, 2026
Programming
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
リポジトリ
https://github.com/po3rin/gocon2026-simd-search
po3rin
September 11, 2026
More Decks by po3rin
See All by po3rin
Driving AI Adoption Using In-House GPUs to Serve Qwen
po3rin
2
460
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
2.3k
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
1.5k
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
530
嗚呼、当時の本番環境の状態で AI Agentを再評価したいなぁ...
po3rin
0
620
Temporal Knowledge Graphで作る! 時間変化するナレッジを扱うAI Agentの世界
po3rin
7
2.4k
自作LLM Native GORM Pluginで実現する AI Agentバックテスト基盤構築
po3rin
2
1.2k
麻雀点数計算問題生成タスクから学ぶ Single Agentの限界と Agentic Workflowの底力
po3rin
5
3.2k
LLMOpsのパフォーマンスを支える技術と現場で実践した改善
po3rin
8
1.3k
Other Decks in Programming
See All in Programming
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
750
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
2
500
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
120
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
【デモ】Kiroで体験する仕様駆動開発|設計からコーディングまでAIと進める開発フロー
cmkudo
0
590
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
270
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
2
350
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4.4k
What We Talk About When We Talk About XP
m_seki
2
380
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
260
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
4.3k
Featured
See All Featured
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
440
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
First, design no harm
axbom
PRO
2
1.3k
The Spectacular Lies of Maps
axbom
PRO
1
980
Raft: Consensus for Rubyists
vanstee
141
7.7k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Bash Introduction
62gerente
615
220k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Deep Space Network (abreviated)
tonyrice
0
290
Building Applications with DynamoDB
mza
96
7.2k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
230
Transcript
Go × SIMDで高速化するベクトル検索 ルーフラインモデルでSIMDが効く境界を探れ! Hiromu Nakamura (@po3rin)
Hiromu Nakamura Hiromu Nakamura AI-UX/MLOps TechLead AI/MLOps Engineer. Interested in
Information Retrieval Nagoya Univ ~ Graduate School of Science M3, Inc. AI・ML Team MLOps & Data Engineering po3rin LayerX Inc. AI-UX/MLOps TechLead
1 Accelerating Vector Search with Go and SIMD ワークショップ用Repository https://github.com/po3rin/gocon2026-simd-search
GitHub CodeSpaces だけ先に起動させておきましょう (立ち上げに少し時間がかかるため)。
Accelerating Vector Search with Go and SIMD 1. Introduction
2 Accelerating Vector Search with Go and SIMD Go ×
SIMD ワークショップへようこそ!!!
3 Accelerating Vector Search with Go and SIMD お題: 10万件のベクトル検索を高速化してください
4 Accelerating Vector Search with Go and SIMD ベクトル検索 (1)
5 Accelerating Vector Search with Go and SIMD ベクトル検索 (2)
6 Accelerating Vector Search with Go and SIMD これをGoに入ったSIMDで高速化するぞ!!
Accelerating Vector Search with Go and SIMD 2. What is
SIMD ?
Accelerating Vector Search with Go and SIMD 7 SIMDって何? (1)
内積を普通に書くとこうなります。 fl 1命令で oat32 を1個。これをスカラ処理と呼びます。
8 Accelerating Vector Search with Go and SIMD SIMDって何? (2)
SIMD(Single Instruction, Multiple Data)は、 1 命令で複数のデータを まとめて処理する CPU の機能。 fl 256bit のレジスタには oat32 が 8 個入ります。
9 Accelerating Vector Search with Go and SIMD Go 1.27
の SIMD パッケージ (1) GOEXPERIMENT=simd を付けると simd/archsimd が使えます(実験的機能)。 アセンブリも cgo も書かず、メソッド呼び出しがほぼそのまま 1 つの CPU 命令になりま す。FMA(Fused Multiply-Add)1 命令で 8 要素ぶんが片付きます。
Accelerating Vector Search with Go and SIMD archsimd で覚えることは 3
つ ① 型がデータの形 Float32x8 = oat32 を 8 レーン = 256bit。型を選ぶことが、使う命令幅 とレーン数を選ぶことになる ② メソッド = 1 命令 MulAdd → VFMADD、DotProductPairs → VPMADDWD ③ 実行時にガード 未対応 CPU で呼ぶと SIGILL で落ちる。archsimd.X86.AVX2() などのガー ドで確認してから使う (左が Go のメソッド名、右はコンパイルされて出てくる x86 の機械語の命令名) 対応は amd64、arm64、WebAssembly。 fl 10
11 Accelerating Vector Search with Go and SIMD ポータブルな simd
パッケージ 1.27 で入った simd パッケージは型名からレーン数が消えます (Float32x8 -> Float32s) レーン数は実行時に CPU が決めます。
Accelerating Vector Search with Go and SIMD 3. Accelerating Vector
Search with Go and SIMD
12 Accelerating Vector Search with Go and SIMD SIMD を使えば速くなるとは限らない
😭
13 Accelerating Vector Search with Go and SIMD 例えば、、、メモリ帯域の上限
14 Accelerating Vector Search with Go and SIMD やみくもに SIMD
を足しても、効かないことのほうが多い。 何で詰まっているかを測ることが重要 そのための道具がルーフラインモデル🚗
15 Accelerating Vector Search with Go and SIMD ルーフラインモデル (1)
ルーフ(上の線)がマシンが出せる速度の限界。左がメモリ帯域で決まる斜線、右が演算ピークで決まる水平線。 ルーフはマシンによって決まる。ルーフの計算方法はワークショップに記載。
Accelerating Vector Search with Go and SIMD 16 内積のスカラ全探索はルーフラインモデルでどこか? ベースライン
2.15 GFLOP/s は、メモリ帯域から決まる上限(約 10)にすら届いていない。 算術強度 … メモリから 1 バイト運ぶごとに何回計算するか * 計算:掛け算 1 回 + 足し算 1 回 = 2 op * 運ぶ量:DRAM から運ぶ要素は oat32 なので 4 byte fl fl fl fl 算術強度 = 2 op ÷ 4 byte = 0.5 op/byte
17 Accelerating Vector Search with Go and SIMD SIMDにしてもメモリ律速で止まる!! 全探索は
35.7 ms → 7.9 ms(4.5x)。速くなったがまだ上があるぞ。
18 Accelerating Vector Search with Go and SIMD 演算律速のエリアへ動かす ワークショップでは右上を目指していく!!
Accelerating Vector Search with Go and SIMD 4. Workshop
19 Accelerating Vector Search with Go and SIMD SIMDを動かしてみよう!ルーフラインモデルで高速化してみよう docs/workshop/setup.md
の手順で Codespaces を起動して 教材を動かしてみましょう!!
Accelerating Vector Search with Go and SIMD 4. まとめ
20 Accelerating Vector Search with Go and SIMD 今日学んだこと *
Go + SIMD の使い方。 * ルーフラインモデルの使い方 * (検索の世界の入り口)
21 Accelerating Vector Search with Go and SIMD 「SIMD ってやつを使ってるのに速くならない😭」と諦めず、
計測してボトルネックを突破していく、 そうやって SIMD と仲良くしていきましょう。
Go × SIMDで高速化するベクトル検索 ルーフラインモデルでSIMDが効く境界を探れ! Hiromu Nakamura (@po3rin)