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
A PoC-ish Trick: LLVM IR Generation with Ruby
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
remore
November 11, 2016
Technology
1
1.4k
A PoC-ish Trick: LLVM IR Generation with Ruby
A Lightning Talk at RubyConf 2016
remore
November 11, 2016
Tweet
Share
More Decks by remore
See All by remore
Turning CDN edge into a Rack web server with ruby.wasm
remore
0
650
Prototyping Kubernetes CRI With Ruby and gRPC
remore
3
1.2k
How I made a pure-Ruby word2vec program more than 3x faster
remore
3
3.2k
Code, Arguments and Startups
remore
0
1.8k
詳解🔍Burn🔥
remore
4
5.4k
DockerCon 2015 Quick Recap
remore
0
450
dockerfileview: A Dockerfile viewer to trace ancestry of the base image
remore
2
450
Burn: 8-Bit Game Development With Ruby
remore
3
1k
Other Decks in Technology
See All in Technology
フロントエンド開発者のための「厄払い」
optim
0
170
3リポジトリーを2ヶ月でモノレポ化した話 / How I turned 3 repositories into a monorepo in 2 months
kubode
0
110
ReproでのicebergのStreaming Writeの検証と実運用にむけた取り組み
joker1007
0
490
Hardware/Software Co-design: Motivations and reflections with respect to security
bcantrill
1
260
新規事業における「一部だけどコア」な AI精度改善の優先順位づけ
zerebom
0
310
新規事業 toitta におけるAI 機能評価の話 / AI Feature Evaluation in toitta
pokutuna
0
270
GitHub Copilot CLI 現状確認会議
torumakabe
12
4.8k
エンジニアとして長く走るために気づいた2つのこと_大賀愛一郎
nanaism
1
250
Werner Vogelsが14年間 問い続けてきたこと
yusukeshimizu
2
220
Claude Codeベストプラクティスまとめ
minorun365
49
27k
一番人に近いコードレビューア CodeRabbit
kinopeee
0
110
Data Intelligence on Lakehouse Paradigm
scotthsieh825
0
200
Featured
See All Featured
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1k
KATA
mclloyd
PRO
34
15k
Getting science done with accelerated Python computing platforms
jacobtomlinson
1
100
A Tale of Four Properties
chriscoyier
162
24k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
55
49k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Mind Mapping
helmedeiros
PRO
0
55
A Soul's Torment
seathinner
5
2.2k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
The Spectacular Lies of Maps
axbom
PRO
1
450
Navigating Team Friction
lara
192
16k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
280
Transcript
A PoC-ish Trick: LLVM IR Generation with Ruby A Lightning
Talk at RubyConf 2016 Kei Sawada (@remore)
None
a modern, fast, and open source language for data science
and technical computing
Julia is 4 years old young Good performance, as fast
as C Dynamic typing Julia has Capability to call C functions directly without wrappers or special APIs a compiler that used LLVM to translate Julia programs into ef cient executable code
In short,
Write some Julia code then you will get LLVM IR
without hassle
debussy:~ guest$ julia _ _ _ _(_)_ | A fresh
approach to technical computin (_) | (_) (_) | Documentation: http://docs.julialang.o _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC) _/ |\__'_|_|_|\__'_| | |__/ | x86_64-apple-darwin15.5.0 julia>
debussy:~ guest$ julia _ _ _ _(_)_ | A fresh
approach to technical computin (_) | (_) (_) | Documentation: http://docs.julialang.o _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC) _/ |\__'_|_|_|\__'_| | |__/ | x86_64-apple-darwin15.5.0 julia> function hello() "rubyconf" end hello (generic function with 1 method) julia>
debussy:~ guest$ julia _ _ _ _(_)_ | A fresh
approach to technical computin (_) | (_) (_) | Documentation: http://docs.julialang.o _ _ _| |_ __ _ | Type "?help" for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.4.6 (2016-06-19 17:16 UTC) _/ |\__'_|_|_|\__'_| | |__/ | x86_64-apple-darwin15.5.0 julia> function hello() "rubyconf" end hello (generic function with 1 method) julia> hello() "rubyconf" julia>
julia> code_llvm(hello, ()) define %jl_value_t* @julia_hello_21549() { top: ret %jl_value_t*
inttoptr (i64 4447575696 to %jl_value_t*) } julia>
julia> code_llvm(hello, ()) define %jl_value_t* @julia_hello_21549() { top: ret %jl_value_t*
inttoptr (i64 4447575696 to %jl_value_t*) } julia> code_native(hello, ()) .section __TEXT,__text,regular,pure_instructions Filename: none Source line: 2 pushq %rbp movq %rsp, %rbp movabsq $4447575696, %rax ## imm = 0x109189E90 Source line: 2 popq %rbp ret julia>
OK Julia is a thing But we are in
None
What if
You can write some Ruby code which can be translated
into Julia where you can get LLVM IR easily?
Ruby -> Julia -> LLVM IR
None
Julializer Allow you to convert your arbitrary Ruby code into
Julia code
Time to DEMO!
For more examples and attempts, check out: github.com/remore/julializer github.com/remore/virtual_module Thanks!