Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
rust-to-spir.pdf
Search
Takuro IIZUKA
May 16, 2015
450
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
Navigating Team Friction
lara
192
16k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
490
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
The Curse of the Amulet
leimatthew05
2
14k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
450
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The agentic SEO stack - context over prompts
schlessera
0
910
Art, The Web, and Tiny UX
lynnandtonic
304
22k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
530
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
970
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