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
rust-to-spir.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Takuro IIZUKA
May 16, 2015
440
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
rust-to-spir.pdf
Takuro IIZUKA
May 16, 2015
More Decks by Takuro IIZUKA
See All by Takuro IIZUKA
OpenCL Programming for FPGA
iitaku
9
5.7k
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
For a Future-Friendly Web
brad_frost
183
10k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
1
360
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
990
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
170
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
450
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.4k
Transcript
Rust to SPIR Rustで快適 OpenCLプログラミング (したい) @iitaku
まずは 祝:Rust 1.0 !!!
About Me twitter id: @iitaku マルチコアCPU/GPU/FPGAさわってます 最近はストレージファームウェアとか
めでたいので、 RustでGPU/MIC/FPGAプログラミングしたい
OpenCLバインディングか?いやいや
OpenCLカーネル中でRustを使いたい! __kernel void saxpy(const float alpha, __global const float *x,
__global const float *y, __global float *z) { uint i = get_global_id(0); z[i] = alpha * x[i] + y[i]; } #[spir_kernel] fn saxpy<T: Float>(alpha: T, xp: &[T], y: &[T], z: &[T]) { let i = get_global_id(0); pz[i] = alpha * x[i] + y[i]; } Old-School OpenCL C Modern OpenCL Rust
The SPIR TM Specification Standard Portable Intermediate Representation Version 1.2
Khronos Group主導で規格化された LLVM IRベースの中間言語仕様 OpenCL1.2対応プラットフォームなら、 SPIRからターゲットへコンパイル・実行可能!
Rust Lang Rust AST Rust AST Metadata Rust AST LLVM
IR ASM/OBJ Phase1: パース・構文木生成 Phase2: マクロ展開・ユーザー構文拡張 Phase3: 各種静的解析 Phase4: LLVM IR生成 Phase5: リンク・オブジェクト生成 これを
Rust Lang Rust AST Rust AST Metadata Rust AST LLVM
IR ASM/OBJ SPIR 1.2/2.0 既存のLLVM IR生成系を拡張してSPIR生成 アトリビュートを解析して構文木を拡張 ビルトイン関数を提供 SPIR生成に必要な メタデータを取得 こうしたい
状況 SPIR向けLLVMターゲット追加 構文木拡張 メタデータ抽出 SPIR生成 まだまともなSPIRでない・・・ ← いまここ
所感 Rustはランタイム層薄いので 新アーキ追加が楽っぽい python on GPUをやった時は かなり制約が必要だった はやくRustでOpenCLカーネル書きたい!
Related Works RustGPU: RustをNVPTXに変換する https://github.com/eholk/RustGPU PyNVVM: PythonをNVVMに変換してGPUで動かす https://github.com/iitaku/pynvvm
Congrats ! @iitaku