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
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
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
Transcript
13 slides
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
More Decks by Takuro IIZUKA
See All by Takuro IIZUKA
OpenCL Programming for FPGA
iitaku
9
5.7k
Featured
See All Featured
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
480
Skip the Path - Find Your Career Trail
mkilby
1
290
Product Roadmaps are Hard
iamctodd
55
13k
The Language of Interfaces
destraynor
162
27k
HDC tutorial
michielstock
2
1k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
48k
Abbi's Birthday
coloredviolet
5
11k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
840
Visualization
eitanlees
153
17k