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
remore
November 11, 2016
Technology
1
1.3k
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
610
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.1k
Code, Arguments and Startups
remore
0
1.8k
詳解🔍Burn🔥
remore
4
5.4k
DockerCon 2015 Quick Recap
remore
0
440
dockerfileview: A Dockerfile viewer to trace ancestry of the base image
remore
2
440
Burn: 8-Bit Game Development With Ruby
remore
3
980
Other Decks in Technology
See All in Technology
株式会社ARAV 採用案内
maqui
0
330
アジャイルテストで高品質のスプリントレビューを
takesection
0
110
Goでマークダウンの独自記法を実装する
lag129
0
210
実践アプリケーション設計 ③ドメイン駆動設計
recruitengineers
PRO
1
110
サービスロボット最前線:ugoが挑むPhysical AI活用
kmatsuiugo
0
190
サイボウズフロントエンドの横断活動から考える AI時代にできること
mugi_uno
4
1.4k
Backboneとしてのtimm2025
yu4u
4
1.4k
小さなチーム 大きな仕事 - 個人開発でAIをフル活用する
himaratsu
0
120
人と組織に偏重したEMへのアンチテーゼ──なぜ、EMに設計力が必要なのか/An antithesis to the overemphasis of people and organizations in EM
dskst
5
580
第64回コンピュータビジョン勉強会@関東(後編)
tsukamotokenji
0
220
つくって納得、つかって実感! 大規模言語モデルことはじめ
recruitengineers
PRO
18
4k
Observability for LLM Application lifecycle
ivry_presentationmaterials
1
240
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
890
RailsConf 2023
tenderlove
30
1.2k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Art, The Web, and Tiny UX
lynnandtonic
302
21k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
183
54k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.4k
Practical Orchestrator
shlominoach
190
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Building Adaptive Systems
keathley
43
2.7k
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!