SlideShare a Scribd company logo
1 of 43
LLVM back-end for C#
@EgorBo
Senior Software Engineer at Microsoft
LLVMJIT/AOTRoslyn
Mono-LLVM: quick intro
2
C# IL (.dll) mini IR LLVM IR MIR
F#
LLVM: C# to MC
3
int MyAdd(int a, int b)
{
return a + b;
}
.method private hidebysig static
int32 MyAdd (
int32 a,
int32 b
) cil managed
{
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add
IL_0003: ret
}
Roslyn
LLVM: C# to MC
4
define monocc i32 @"Program:MyAdd (int,int)"
(i32 %arg_a, i32 %arg_b) {
BB0:
br label %BB3
BB3:
br label %BB2
BB2:
%t22 = add i32 %arg_a, %arg_b
br label %BB1
BB1:
ret i32 %t22
}
.method private hidebysig static
int32 MyAdd (
int32 a,
int32 b
) cil managed
{
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add
IL_0003: ret
}
mini
LLVM: C# to MC
5
define monocc i32 @"Program:MyAdd (int,int)"
(i32 %arg_a, i32 %arg_b) {
BB0:
br label %BB3
BB3:
br label %BB2
BB2:
%t22 = add i32 %arg_a, %arg_b
br label %BB1
BB1:
ret i32 %t22
}
.method private hidebysig static
int32 MyAdd (
int32 a,
int32 b
) cil managed
{
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: add
IL_0003: ret
}
mini
(simplifycfg)
LLVM: C# to MC
6
define monocc i32 @"Program:MyAdd (int,int)"(i32 %arg_a, i32 %arg_b) #0
{
BB0:
%t22 = add i32 %arg_a, %arg_b
ret i32 %t22
}
lea eax, [rdi + rsi]
ret
llc
(I am skipping the machine IR part)
LLVM: C# to MC
7
void MySet(byte* array, int len, byte val)
{
for (int i = 0; i < len; i++)
array[i] = val;
}
define monocc void @"MySet"(i8* %arg_array,
i32 %arg_len, i32 %arg_val) #0 {
BB0:
br label %BB3
BB3:
br label %BB2
BB2:
br label %BB4
BB4:
%0 = phi i32 [ 0, %BB2 ], [ %t32, %BB5 ]
%1 = icmp slt i32 %0, %arg_len
br i1 %1, label %BB5, label %BB6
BB6:
br label %BB1
BB5:
%t23 = sext i32 %0 to i64
%3 = getelementptr i8, i8* %arg_array, i64 %t23
%4 = trunc i32 %arg_val to i8
store i8 %4, i8* %3
%t32 = add i32 %0, 1
br label %BB4
BB1:
ret void
}
mini
8
define monocc void @"MySet"(i8* %arg_array,
i32 %arg_len, i32 %arg_val) #0 {
BB0:
br label %BB3
BB3:
br label %BB2
BB2:
br label %BB4
BB4:
%0 = phi i32 [ 0, %BB2 ], [ %t32, %BB5 ]
%1 = icmp slt i32 %0, %arg_len
br i1 %1, label %BB5, label %BB6
BB6:
br label %BB1
BB5:
%t23 = sext i32 %0 to i64
%3 = getelementptr i8, i8* %arg_array, i64 %t23
%4 = trunc i32 %arg_val to i8
store i8 %4, i8* %3
%t32 = add i32 %0, 1
br label %BB4
BB1:
ret void
}
opt
define monocc void @"MySet"(i8* %arg_array,
i32 %arg_len, i32 %arg_val) #0 {
BB0:
%0 = icmp sgt i32 %arg_len, 0
br i1 %0, label %BB5.lr.ph, label %BB1
BB5.lr.ph:
%1 = trunc i32 %arg_val to i8
%2 = zext i32 %arg_len to i64
call void @llvm.memset.p0i8.i64(i8* %arg_array, i8 %1, i64 %2…)
br label %BB1
BB1:
ret void
}
LLVM needs hints from front-ends
9
• Alias-analysis (`noalias`, TBAA, etc)
• PGO-data and @llvm.expect (branch-weights)
• Use GEPs where possible instead of `ptrtoint+add+inttoptr`
• Language specific order of optimization passes (maybe even custom passes)
• Alignment hints
• FaultMaps and implicit null-checks
• Use LLVM intrinsics where needed (libcalls, HW intrinsics, etc)
• Don’t forget about Fast-Math!
• NIT: Nullability, Escape analysis, etc
10
AA is important!
LLVM: ffast-math
11
float result = (x / 10) + 1 + 1;
CoreCLR, Mono, C++ -O2 Mono-LLVM (--llvm --ffast-math)
vfmadd132sd xmm0, xmm1, QWORD PTR .LC0[rip]vdivsd xmm0, xmm0, QWORD PTR .LC0[rip]
vaddsd xmm0, xmm0, xmm1
vaddsd xmm0, xmm0, xmm1
float result = (x / 10) + 2;
float result = (x * 0.1) + 2;
float result = fmadd(x, 0.1, 2);
1
2
3
4
LLVM: ffast-math
12
• No NaNs (NOTE: some apps rely on NaN values, e.g. WPF)
• No Infs
• No Signed Zeros (e.g. Math.Max(-0.0, 0.0) will return -0.0)
• Approximate functions
• Recognize FMA patterns (a * b + c)
• Reassociation transformations (x + c1 + c2 => x + (c1 + c2))
C# Math/MathF are LLVM intrinsics!
13
static float Foo(float x)
{
return MathF.Sqrt(x) * MathF.Sqrt(x);
}
define float @"Foo“ (float %arg_x) {
BB0:
br label %BB3
BB3:
br label %BB2
BB2:
%t19 = call fast float @llvm.sqrt.f32(float %arg_x)
%t21 = call fast float @llvm.sqrt.f32(float %arg_x)
%t22 = fmul fast float %t19, %t21
br label %BB1
BB1:
ret float %t22
}
declare float @llvm.sqrt.f32(float)
Emit
LLVM IR
C# Math/MathF are LLVM intrinsics!
14
define float @"Foo“ (float %arg_x) {
BB0:
br label %BB3
BB3:
br label %BB2
BB2:
%t19 = call fast float @llvm.sqrt.f32(float %arg_x)
%t21 = call fast float @llvm.sqrt.f32(float %arg_x)
%t22 = fmul fast float %t19, %t21
br label %BB1
BB1:
ret float %t22
}
declare float @llvm.sqrt.f32(float)
define float @"Foo“ (float %arg_x) {
BB0:
ret float %arg_x
}
opt
C# Math/MathF are LLVM intrinsics!
15
Math.Abs(X) * Math.Abs(X) => X * X
Math.Sin(X) / Math.Cos(X) => Math.Tan(X)
Math.Sqrt(X) * Math.Sqrt(X) => X
Math.Sin(-X) => -Math.Sin(X)
MathF.Pow(X, 0.5f) => MathF.Sqrt(X)
MathF.Pow(X, 2) => X * X
MathF.Pow(X, 4) => (X * X) * (X * X)
Significant boost in some FP benchmarks:
16
(CPU without FMA)
One of those benchmarks (Lorenz equations):
17
Don’t forget to feed the LLVM!
with some PGO data for better codegen
18
19static int Max(int x, int y)
{
return x > y ? x : y;
}
!0 = !{!"branch_weights", i32 1000, i32 1}
Default With profile data (PGO)
mov eax, esi
cmp edi, esi
cmovge eax, edi
ret
define i32 @Max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
define i32 @Max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1 !prof 0
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
mov eax, edi
cmp edi, esi
jle .LBB1_1
ret
.LBB1_1:
mov eax, esi
ret
20
21
PGO and switch
char* format(char format)
{
switch (format)
{
case 'G’:
return defaultFormat();
case 'X’:
return hexFormat();
case 'f’:
return floatFormat();
case 'p’:
return percentFormat();
}
return defaultFormat();
}
format(int): # @format(int)
cmp edi, 101
jg .LBB0_4
cmp edi, 71
je .LBB0_8
cmp edi, 88
jne .LBB0_8
jmp hexFormat() # TAILCALL
.LBB0_4:
cmp edi, 102
je .LBB0_9
cmp edi, 112
jne .LBB0_8
jmp percentFormat() # TAILCALL
.LBB0_8:
jmp defaultFormat() # TAILCALL
.LBB0_9:
jmp floatFormat() # TAILCALL
22
PGO and switch
char* format(char format)
{
switch (__builtin_expect(format, 'X'))
{
case 'G’:
return defaultFormat();
case 'X’:
return hexFormat();
case 'f’:
return floatFormat();
case 'p’:
return percentFormat();
}
return defaultFormat();
}
format(int): # @format(int)
movsxd rax, edi
cmp rax, 88
jne .LBB0_2
jmp hexFormat() # TAILCALL
.LBB0_2:
cmp rax, 112
je .LBB0_6
cmp rax, 102
je .LBB0_7
cmp rax, 71
jmp defaultFormat() # TAILCALL
.LBB0_6:
jmp percentFormat() # TAILCALL
.LBB0_7:
jmp floatFormat() # TAILCALL
23
PGO and Guarded Devirtualization
static void Foo(IAnimal animal)
{
animal.MakeSound();
}
static void Foo(IAnimal animal)
{
if (animal is Dog dog)
dog.Bark();
else
animal.MakeSound();
}
Mono-LLVM
24
• We use github.com/dotnet/llvm-project fork
• Currently target LLVM 6 but on our way to LLVM 9
• We currently use LLVM for:
• AOT (opt + llc)
• JIT (legacy::PassManager, ORCv1)
Mono-LLVM
25
• `opt –O2` is only for C++
• We have a lot of additional checks: null-checks, bound-checks
• We have to insert safe-points (-place-safepoints) for non-preemptive mode
void MyMethod(byte* array, int len, byte val)
{
if (unlikely(gcRequested))
performGC();
for (int i = 0; i < len; i++)
{
if (unlikely(gcRequested))
performGC();
array[i] = val;
}
if (unlikely(gcRequested))
performGC();
}
How do we use optimizations?
26
• LLVM AOT:
opt -O2 –place-safepoints
• LLVM JIT:
PassManager with a small subset of the most useful passes in a specific order:
-simplifycfg
-sroa
-lower-expect
-instcombine
-licm
-simplifycfg
-lcssa
-indvars
-loop-deletion
-gvn
-memcpyopt
-sccp
-bdce
-instcombine
-dse
-simplifycfg
`opt –O2`: These pass pipelines make a good starting
point for an optimizing compiler for any language, but they
have been carefully tuned for C and C++, not your target
language.
LLVM: tons of optimizations
28
Null-checks, Bound-checks 29
static int Test(int[] array)
{
return array[42];
}
Null-checks, Bound-checks 30
static int Test(int[] array)
{
if (array == null) ThrowNRE();
return array[42];
}
Null-checks, Bound-checks 31
static int Test(int[] array)
{
if (array == null) ThrowNRE();
if ((uint)array.Length <= 42) ThrowOBE();
return array[42];
}
Null-checks, Bound-checks 32
static int Test(int[] array)
{
if (array == null) ThrowNRE();
if ((uint)array.Length <= 42) ThrowOBE();
return array[42];
}
push rax
cmp DWORD PTR [rdi+0x18],0x0
je 1d <Test__int___+0x1d>
mov eax,DWORD PTR [rdi+0x20]
pop rcx
ret
movabs rax,0x1f1f030
mov edi,0xcc
call QWORD PTR [rax]
movabs rax,0x1f1f040
mov edi,0xa6
call QWORD PTR [rax]
InductiveRangeCheckElimination Pass
33
public static void Zero1000Elements(int[] array)
{
for (int i = 0; i < 1000; i++)
array[i] = 0; // bound checks will be inserted here
}
“If you language uses range checks, consider using the
IRCE pass. It is not currently part of the standard pass
order.”
InductiveRangeCheckElimination Pass
34
public static void Zero1000Elements(int[] array)
{
int limit = Math.Min(array.Length, 1000);
for (int i = 0; i < limit; i++)
array[i] = 0; // bound checks are not needed here!
for (int i = limit; i < 1000; i++)
array[i] = 0; // bound checks are needed here
// so at least we could "zero" first `limit` elements without bound checks
}
InductiveRangeCheckElimination Pass
35
public static void Zero1000Elements(int[] array)
{
int limit = Math.Min(array.Length, 1000);
for (int i = 0; i < limit - 3; i += 4)
{
array[i] = 0;
array[i+1] = 0;
array[i+2] = 0;
array[i+3] = 0;
}
for (int i = limit; i < 1000; i++)
array[i] = 0; // bound checks are needed here
// so at least we could "zero" first `limit` elements without bound checks
}
Now we can even unroll the first loop!
System.Runtime.Intrinsics.* 36
static uint Foo(uint x)
{
return Lzcnt.LeadingZeroCount(x);
}
define i32 @Foo(i32 %x)
{
%0 = call i32 @llvm.ctlz.i32(i32 %x, i1 true)
ret i32 %0
}
; x86 with lzcnt
lzcnt eax, edi
ret
; Arm64 (AArch64)
cls w0, w0
ret
System.Runtime.Intrinsics.* 37
int MySum(int[] array)
{
fixed (int* ptr = array)
{
var sum = Vector128<int>.Zero;
for (int i = 0; i < array.Length; i += 4)
{
sum = Sse2.Add(sum, Sse2.LoadVector128(ptr + i));
}
sum = Ssse3.HorizontalAdd(sum, sum);
sum = Ssse3.HorizontalAdd(sum, sum);
return sum.ToScalar();
}
}
G_M55440_IG07: ;; bbWeight=4
movsxd r8, ecx
vpaddd xmm0, xmm0, xmmword ptr [rax+4*r8]
add ecx, 4
cmp edx, ecx
jg SHORT G_M55440_IG07
G_M55440_IG08:
vphaddd xmm0, xmm0, xmm0
vphaddd xmm0, xmm0, xmm0
vmovapd xmmword ptr [rsp+20H], xmm0
mov eax, dword ptr [rsp+20H]
38
[Benchmark]
public bool IsNaN(float value)
{
bool result = false;
for (int i = 0; i < 1000000; i++)
{
result &= float.IsNaN(value);
value += 1.0f;
}
return result;
}
[Benchmark]
public bool IsNaN(float value)
{
return false;
}
What’s wrong with this benchmark?
Pros & Cons
39
• Pros:
• Tons of optimizations, frontends aren’t required to emit optimized IR.
• High MC quality and performance, especially for AArch64!
• A lot of smart people and huge companies invest into LLVM:
• Apple, Google, Samsung, Intel, Microsoft, etc.
• Cons:
• Deadly slow to compile and optimize stuff. LLVM JIT is an oxymoron
(unless it’s used in a tiered compilation)
• LLVM JIT adds 30-50mb to your application
• Not super friendly for managed languages (Precise GC, “movable”
pointers, etc)
Tiered JIT
40
Any AOT
code
around?
Take AOT code
Is it hot ?
Tier0 JIT
ReJIT to Tier1
YES NO
YES
Function
Run
NO
Optimizations… optimizations everywhere!
41
SSA form
Const/Copy prop
BC Removal
Import IL
Insert Bound checks
Inlining
Import C#
Const/Copy prop
Minor peephole opts
Convert to LLVM IR
Loop-related opts
Etc…
Including inlining!
Simplify CFG
SROA
InstCombine
Machine IR opts
Register allocation
Etc…
Roslyn Mono LLVM PassManager DAG, MC, RA
Runtimes for C# (IL):
• .NET Framework 4.x
• JIT
• AOT (Fragile NGEN)
• CoreCLR
• JIT (Tiered)
• AOT (ReadyToRun – R2R)
• Mono
• JIT
• (Full)AOT
• LLVM (AOT, FullAOT, JIT)
• Interpreter
• CoreRT
• Unity IL2CPP
• Unity Burst
Q&Atwitter: EgorBo
blog: EgorBo.com
EgorBo
Senior Software Engineer at Microsoft

More Related Content

What's hot

Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Andrey Akinshin
 
Travel management
Travel managementTravel management
Travel management1Parimal2
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTsKevlin Henney
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semesterDOSONKA Group
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)David de Boer
 
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...ssuserd6b1fd
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2Amit Kapoor
 
C aptitude scribd
C aptitude scribdC aptitude scribd
C aptitude scribdAmit Kapoor
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...ssuserd6b1fd
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...ssuserd6b1fd
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...akaptur
 
How to not write a boring test in Golang
How to not write a boring test in GolangHow to not write a boring test in Golang
How to not write a boring test in GolangDan Tran
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...ssuserd6b1fd
 
C aptitude.2doc
C aptitude.2docC aptitude.2doc
C aptitude.2docSrikanth
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterakaptur
 

What's hot (20)

c programming
c programmingc programming
c programming
 
Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?Что нам готовит грядущий C#7?
Что нам готовит грядущий C#7?
 
Travel management
Travel managementTravel management
Travel management
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
 
Network lap pgms 7th semester
Network lap pgms 7th semesterNetwork lap pgms 7th semester
Network lap pgms 7th semester
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)
 
pointers 1
pointers 1pointers 1
pointers 1
 
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
Notes for C++ Programming / Object Oriented C++ Programming for MCA, BCA and ...
 
C interview question answer 2
C interview question answer 2C interview question answer 2
C interview question answer 2
 
c programming
c programmingc programming
c programming
 
C aptitude scribd
C aptitude scribdC aptitude scribd
C aptitude scribd
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5  b...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 5 of 5 by...
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 
How to not write a boring test in Golang
How to not write a boring test in GolangHow to not write a boring test in Golang
How to not write a boring test in Golang
 
Computer Programming- Lecture 4
Computer Programming- Lecture 4Computer Programming- Lecture 4
Computer Programming- Lecture 4
 
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 2 of 5 by...
 
Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01Captitude 2doc-100627004318-phpapp01
Captitude 2doc-100627004318-phpapp01
 
C aptitude.2doc
C aptitude.2docC aptitude.2doc
C aptitude.2doc
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 

Similar to Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019

Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)bolovv
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationWei-Ren Chen
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADDharmalingam Ganesan
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기Ji Hun Kim
 
How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITEgor Bogatov
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonakaptur
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersJen Yee Hong
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)Saifur Rahman
 
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуdelimitry
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsAsuka Nakajima
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate CompilersFunctional Thursday
 
Javascript engine performance
Javascript engine performanceJavascript engine performance
Javascript engine performanceDuoyi Wu
 
MuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CMuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CSusumu Tokumoto
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp fullVõ Hòa
 
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)changehee lee
 
Zn task - defcon russia 20
Zn task  - defcon russia 20Zn task  - defcon russia 20
Zn task - defcon russia 20DefconRussia
 

Similar to Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019 (20)

Chapter Eight(3)
Chapter Eight(3)Chapter Eight(3)
Chapter Eight(3)
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate Representation
 
Boosting Developer Productivity with Clang
Boosting Developer Productivity with ClangBoosting Developer Productivity with Clang
Boosting Developer Productivity with Clang
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
 
GCC
GCCGCC
GCC
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
 
How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJIT
 
Faster Python, FOSDEM
Faster Python, FOSDEMFaster Python, FOSDEM
Faster Python, FOSDEM
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
 
Basic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmersBasic c++ 11/14 for python programmers
Basic c++ 11/14 for python programmers
 
C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)C cheat sheet for varsity (extreme edition)
C cheat sheet for varsity (extreme edition)
 
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
 
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading SkillsReverse Engineering Dojo: Enhancing Assembly Reading Skills
Reverse Engineering Dojo: Enhancing Assembly Reading Skills
 
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
[FT-11][suhorng] “Poor Man's” Undergraduate Compilers
 
Javascript engine performance
Javascript engine performanceJavascript engine performance
Javascript engine performance
 
MuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for CMuVM: Higher Order Mutation Analysis Virtual Machine for C
MuVM: Higher Order Mutation Analysis Virtual Machine for C
 
Getting started cpp full
Getting started cpp   fullGetting started cpp   full
Getting started cpp full
 
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
 
Zn task - defcon russia 20
Zn task  - defcon russia 20Zn task  - defcon russia 20
Zn task - defcon russia 20
 

More from corehard_by

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...corehard_by
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...corehard_by
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотниковcorehard_by
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титовcorehard_by
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...corehard_by
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишковcorehard_by
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...corehard_by
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...corehard_by
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...corehard_by
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...corehard_by
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...corehard_by
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...corehard_by
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филоновcorehard_by
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukićcorehard_by
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakovacorehard_by
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухинcorehard_by
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...corehard_by
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019corehard_by
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019corehard_by
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019corehard_by
 

More from corehard_by (20)

C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
C++ CoreHard Autumn 2018. Создание пакетов для открытых библиотек через conan...
 
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
C++ CoreHard Autumn 2018. Что должен знать каждый C++ программист или Как про...
 
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений ОхотниковC++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
C++ CoreHard Autumn 2018. Actors vs CSP vs Tasks vs ... - Евгений Охотников
 
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр ТитовC++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
C++ CoreHard Autumn 2018. Знай свое "железо": иерархия памяти - Александр Титов
 
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
C++ CoreHard Autumn 2018. Информационная безопасность и разработка ПО - Евген...
 
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья ШишковC++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
C++ CoreHard Autumn 2018. Заглядываем под капот «Поясов по C++» - Илья Шишков
 
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
C++ CoreHard Autumn 2018. Ускорение сборки C++ проектов, способы и последстви...
 
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
C++ CoreHard Autumn 2018. Метаклассы: воплощаем мечты в реальность - Сергей С...
 
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
C++ CoreHard Autumn 2018. Что не умеет оптимизировать компилятор - Александр ...
 
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
C++ CoreHard Autumn 2018. Кодогенерация C++ кроссплатформенно. Продолжение - ...
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
 
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
C++ CoreHard Autumn 2018. Обработка списков на C++ в функциональном стиле - В...
 
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел ФилоновC++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
C++ Corehard Autumn 2018. Обучаем на Python, применяем на C++ - Павел Филонов
 
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan ČukićC++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
C++ CoreHard Autumn 2018. Asynchronous programming with ranges - Ivan Čukić
 
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia KazakovaC++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
C++ CoreHard Autumn 2018. Debug C++ Without Running - Anastasia Kazakova
 
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон ПолухинC++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
C++ CoreHard Autumn 2018. Полезный constexpr - Антон Полухин
 
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
C++ CoreHard Autumn 2018. Text Formatting For a Future Range-Based Standard L...
 
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
Исключительная модель памяти. Алексей Ткаченко ➠ CoreHard Autumn 2019
 
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019Как помочь и как помешать компилятору. Андрей Олейников ➠  CoreHard Autumn 2019
Как помочь и как помешать компилятору. Андрей Олейников ➠ CoreHard Autumn 2019
 
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019Автоматизируй это. Кирилл Тихонов ➠  CoreHard Autumn 2019
Автоматизируй это. Кирилл Тихонов ➠ CoreHard Autumn 2019
 

Recently uploaded

Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 

Recently uploaded (20)

Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 

Как работает LLVM бэкенд в C#. Егор Богатов ➠ CoreHard Autumn 2019

  • 1. LLVM back-end for C# @EgorBo Senior Software Engineer at Microsoft
  • 2. LLVMJIT/AOTRoslyn Mono-LLVM: quick intro 2 C# IL (.dll) mini IR LLVM IR MIR F#
  • 3. LLVM: C# to MC 3 int MyAdd(int a, int b) { return a + b; } .method private hidebysig static int32 MyAdd ( int32 a, int32 b ) cil managed { IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: add IL_0003: ret } Roslyn
  • 4. LLVM: C# to MC 4 define monocc i32 @"Program:MyAdd (int,int)" (i32 %arg_a, i32 %arg_b) { BB0: br label %BB3 BB3: br label %BB2 BB2: %t22 = add i32 %arg_a, %arg_b br label %BB1 BB1: ret i32 %t22 } .method private hidebysig static int32 MyAdd ( int32 a, int32 b ) cil managed { IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: add IL_0003: ret } mini
  • 5. LLVM: C# to MC 5 define monocc i32 @"Program:MyAdd (int,int)" (i32 %arg_a, i32 %arg_b) { BB0: br label %BB3 BB3: br label %BB2 BB2: %t22 = add i32 %arg_a, %arg_b br label %BB1 BB1: ret i32 %t22 } .method private hidebysig static int32 MyAdd ( int32 a, int32 b ) cil managed { IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: add IL_0003: ret } mini (simplifycfg)
  • 6. LLVM: C# to MC 6 define monocc i32 @"Program:MyAdd (int,int)"(i32 %arg_a, i32 %arg_b) #0 { BB0: %t22 = add i32 %arg_a, %arg_b ret i32 %t22 } lea eax, [rdi + rsi] ret llc (I am skipping the machine IR part)
  • 7. LLVM: C# to MC 7 void MySet(byte* array, int len, byte val) { for (int i = 0; i < len; i++) array[i] = val; } define monocc void @"MySet"(i8* %arg_array, i32 %arg_len, i32 %arg_val) #0 { BB0: br label %BB3 BB3: br label %BB2 BB2: br label %BB4 BB4: %0 = phi i32 [ 0, %BB2 ], [ %t32, %BB5 ] %1 = icmp slt i32 %0, %arg_len br i1 %1, label %BB5, label %BB6 BB6: br label %BB1 BB5: %t23 = sext i32 %0 to i64 %3 = getelementptr i8, i8* %arg_array, i64 %t23 %4 = trunc i32 %arg_val to i8 store i8 %4, i8* %3 %t32 = add i32 %0, 1 br label %BB4 BB1: ret void } mini
  • 8. 8 define monocc void @"MySet"(i8* %arg_array, i32 %arg_len, i32 %arg_val) #0 { BB0: br label %BB3 BB3: br label %BB2 BB2: br label %BB4 BB4: %0 = phi i32 [ 0, %BB2 ], [ %t32, %BB5 ] %1 = icmp slt i32 %0, %arg_len br i1 %1, label %BB5, label %BB6 BB6: br label %BB1 BB5: %t23 = sext i32 %0 to i64 %3 = getelementptr i8, i8* %arg_array, i64 %t23 %4 = trunc i32 %arg_val to i8 store i8 %4, i8* %3 %t32 = add i32 %0, 1 br label %BB4 BB1: ret void } opt define monocc void @"MySet"(i8* %arg_array, i32 %arg_len, i32 %arg_val) #0 { BB0: %0 = icmp sgt i32 %arg_len, 0 br i1 %0, label %BB5.lr.ph, label %BB1 BB5.lr.ph: %1 = trunc i32 %arg_val to i8 %2 = zext i32 %arg_len to i64 call void @llvm.memset.p0i8.i64(i8* %arg_array, i8 %1, i64 %2…) br label %BB1 BB1: ret void }
  • 9. LLVM needs hints from front-ends 9 • Alias-analysis (`noalias`, TBAA, etc) • PGO-data and @llvm.expect (branch-weights) • Use GEPs where possible instead of `ptrtoint+add+inttoptr` • Language specific order of optimization passes (maybe even custom passes) • Alignment hints • FaultMaps and implicit null-checks • Use LLVM intrinsics where needed (libcalls, HW intrinsics, etc) • Don’t forget about Fast-Math! • NIT: Nullability, Escape analysis, etc
  • 11. LLVM: ffast-math 11 float result = (x / 10) + 1 + 1; CoreCLR, Mono, C++ -O2 Mono-LLVM (--llvm --ffast-math) vfmadd132sd xmm0, xmm1, QWORD PTR .LC0[rip]vdivsd xmm0, xmm0, QWORD PTR .LC0[rip] vaddsd xmm0, xmm0, xmm1 vaddsd xmm0, xmm0, xmm1 float result = (x / 10) + 2; float result = (x * 0.1) + 2; float result = fmadd(x, 0.1, 2); 1 2 3 4
  • 12. LLVM: ffast-math 12 • No NaNs (NOTE: some apps rely on NaN values, e.g. WPF) • No Infs • No Signed Zeros (e.g. Math.Max(-0.0, 0.0) will return -0.0) • Approximate functions • Recognize FMA patterns (a * b + c) • Reassociation transformations (x + c1 + c2 => x + (c1 + c2))
  • 13. C# Math/MathF are LLVM intrinsics! 13 static float Foo(float x) { return MathF.Sqrt(x) * MathF.Sqrt(x); } define float @"Foo“ (float %arg_x) { BB0: br label %BB3 BB3: br label %BB2 BB2: %t19 = call fast float @llvm.sqrt.f32(float %arg_x) %t21 = call fast float @llvm.sqrt.f32(float %arg_x) %t22 = fmul fast float %t19, %t21 br label %BB1 BB1: ret float %t22 } declare float @llvm.sqrt.f32(float) Emit LLVM IR
  • 14. C# Math/MathF are LLVM intrinsics! 14 define float @"Foo“ (float %arg_x) { BB0: br label %BB3 BB3: br label %BB2 BB2: %t19 = call fast float @llvm.sqrt.f32(float %arg_x) %t21 = call fast float @llvm.sqrt.f32(float %arg_x) %t22 = fmul fast float %t19, %t21 br label %BB1 BB1: ret float %t22 } declare float @llvm.sqrt.f32(float) define float @"Foo“ (float %arg_x) { BB0: ret float %arg_x } opt
  • 15. C# Math/MathF are LLVM intrinsics! 15 Math.Abs(X) * Math.Abs(X) => X * X Math.Sin(X) / Math.Cos(X) => Math.Tan(X) Math.Sqrt(X) * Math.Sqrt(X) => X Math.Sin(-X) => -Math.Sin(X) MathF.Pow(X, 0.5f) => MathF.Sqrt(X) MathF.Pow(X, 2) => X * X MathF.Pow(X, 4) => (X * X) * (X * X)
  • 16. Significant boost in some FP benchmarks: 16 (CPU without FMA)
  • 17. One of those benchmarks (Lorenz equations): 17
  • 18. Don’t forget to feed the LLVM! with some PGO data for better codegen 18
  • 19. 19static int Max(int x, int y) { return x > y ? x : y; } !0 = !{!"branch_weights", i32 1000, i32 1} Default With profile data (PGO) mov eax, esi cmp edi, esi cmovge eax, edi ret define i32 @Max(i32 %0, i32 %1) { %3 = icmp sgt i32 %0, %1 %4 = select i1 %3, i32 %0, i32 %1 ret i32 %4 } define i32 @Max(i32 %0, i32 %1) { %3 = icmp sgt i32 %0, %1 !prof 0 %4 = select i1 %3, i32 %0, i32 %1 ret i32 %4 } mov eax, edi cmp edi, esi jle .LBB1_1 ret .LBB1_1: mov eax, esi ret
  • 20. 20
  • 21. 21 PGO and switch char* format(char format) { switch (format) { case 'G’: return defaultFormat(); case 'X’: return hexFormat(); case 'f’: return floatFormat(); case 'p’: return percentFormat(); } return defaultFormat(); } format(int): # @format(int) cmp edi, 101 jg .LBB0_4 cmp edi, 71 je .LBB0_8 cmp edi, 88 jne .LBB0_8 jmp hexFormat() # TAILCALL .LBB0_4: cmp edi, 102 je .LBB0_9 cmp edi, 112 jne .LBB0_8 jmp percentFormat() # TAILCALL .LBB0_8: jmp defaultFormat() # TAILCALL .LBB0_9: jmp floatFormat() # TAILCALL
  • 22. 22 PGO and switch char* format(char format) { switch (__builtin_expect(format, 'X')) { case 'G’: return defaultFormat(); case 'X’: return hexFormat(); case 'f’: return floatFormat(); case 'p’: return percentFormat(); } return defaultFormat(); } format(int): # @format(int) movsxd rax, edi cmp rax, 88 jne .LBB0_2 jmp hexFormat() # TAILCALL .LBB0_2: cmp rax, 112 je .LBB0_6 cmp rax, 102 je .LBB0_7 cmp rax, 71 jmp defaultFormat() # TAILCALL .LBB0_6: jmp percentFormat() # TAILCALL .LBB0_7: jmp floatFormat() # TAILCALL
  • 23. 23 PGO and Guarded Devirtualization static void Foo(IAnimal animal) { animal.MakeSound(); } static void Foo(IAnimal animal) { if (animal is Dog dog) dog.Bark(); else animal.MakeSound(); }
  • 24. Mono-LLVM 24 • We use github.com/dotnet/llvm-project fork • Currently target LLVM 6 but on our way to LLVM 9 • We currently use LLVM for: • AOT (opt + llc) • JIT (legacy::PassManager, ORCv1)
  • 25. Mono-LLVM 25 • `opt –O2` is only for C++ • We have a lot of additional checks: null-checks, bound-checks • We have to insert safe-points (-place-safepoints) for non-preemptive mode void MyMethod(byte* array, int len, byte val) { if (unlikely(gcRequested)) performGC(); for (int i = 0; i < len; i++) { if (unlikely(gcRequested)) performGC(); array[i] = val; } if (unlikely(gcRequested)) performGC(); }
  • 26. How do we use optimizations? 26 • LLVM AOT: opt -O2 –place-safepoints • LLVM JIT: PassManager with a small subset of the most useful passes in a specific order: -simplifycfg -sroa -lower-expect -instcombine -licm -simplifycfg -lcssa -indvars -loop-deletion -gvn -memcpyopt -sccp -bdce -instcombine -dse -simplifycfg `opt –O2`: These pass pipelines make a good starting point for an optimizing compiler for any language, but they have been carefully tuned for C and C++, not your target language.
  • 27.
  • 28. LLVM: tons of optimizations 28
  • 29. Null-checks, Bound-checks 29 static int Test(int[] array) { return array[42]; }
  • 30. Null-checks, Bound-checks 30 static int Test(int[] array) { if (array == null) ThrowNRE(); return array[42]; }
  • 31. Null-checks, Bound-checks 31 static int Test(int[] array) { if (array == null) ThrowNRE(); if ((uint)array.Length <= 42) ThrowOBE(); return array[42]; }
  • 32. Null-checks, Bound-checks 32 static int Test(int[] array) { if (array == null) ThrowNRE(); if ((uint)array.Length <= 42) ThrowOBE(); return array[42]; } push rax cmp DWORD PTR [rdi+0x18],0x0 je 1d <Test__int___+0x1d> mov eax,DWORD PTR [rdi+0x20] pop rcx ret movabs rax,0x1f1f030 mov edi,0xcc call QWORD PTR [rax] movabs rax,0x1f1f040 mov edi,0xa6 call QWORD PTR [rax]
  • 33. InductiveRangeCheckElimination Pass 33 public static void Zero1000Elements(int[] array) { for (int i = 0; i < 1000; i++) array[i] = 0; // bound checks will be inserted here } “If you language uses range checks, consider using the IRCE pass. It is not currently part of the standard pass order.”
  • 34. InductiveRangeCheckElimination Pass 34 public static void Zero1000Elements(int[] array) { int limit = Math.Min(array.Length, 1000); for (int i = 0; i < limit; i++) array[i] = 0; // bound checks are not needed here! for (int i = limit; i < 1000; i++) array[i] = 0; // bound checks are needed here // so at least we could "zero" first `limit` elements without bound checks }
  • 35. InductiveRangeCheckElimination Pass 35 public static void Zero1000Elements(int[] array) { int limit = Math.Min(array.Length, 1000); for (int i = 0; i < limit - 3; i += 4) { array[i] = 0; array[i+1] = 0; array[i+2] = 0; array[i+3] = 0; } for (int i = limit; i < 1000; i++) array[i] = 0; // bound checks are needed here // so at least we could "zero" first `limit` elements without bound checks } Now we can even unroll the first loop!
  • 36. System.Runtime.Intrinsics.* 36 static uint Foo(uint x) { return Lzcnt.LeadingZeroCount(x); } define i32 @Foo(i32 %x) { %0 = call i32 @llvm.ctlz.i32(i32 %x, i1 true) ret i32 %0 } ; x86 with lzcnt lzcnt eax, edi ret ; Arm64 (AArch64) cls w0, w0 ret
  • 37. System.Runtime.Intrinsics.* 37 int MySum(int[] array) { fixed (int* ptr = array) { var sum = Vector128<int>.Zero; for (int i = 0; i < array.Length; i += 4) { sum = Sse2.Add(sum, Sse2.LoadVector128(ptr + i)); } sum = Ssse3.HorizontalAdd(sum, sum); sum = Ssse3.HorizontalAdd(sum, sum); return sum.ToScalar(); } } G_M55440_IG07: ;; bbWeight=4 movsxd r8, ecx vpaddd xmm0, xmm0, xmmword ptr [rax+4*r8] add ecx, 4 cmp edx, ecx jg SHORT G_M55440_IG07 G_M55440_IG08: vphaddd xmm0, xmm0, xmm0 vphaddd xmm0, xmm0, xmm0 vmovapd xmmword ptr [rsp+20H], xmm0 mov eax, dword ptr [rsp+20H]
  • 38. 38 [Benchmark] public bool IsNaN(float value) { bool result = false; for (int i = 0; i < 1000000; i++) { result &= float.IsNaN(value); value += 1.0f; } return result; } [Benchmark] public bool IsNaN(float value) { return false; } What’s wrong with this benchmark?
  • 39. Pros & Cons 39 • Pros: • Tons of optimizations, frontends aren’t required to emit optimized IR. • High MC quality and performance, especially for AArch64! • A lot of smart people and huge companies invest into LLVM: • Apple, Google, Samsung, Intel, Microsoft, etc. • Cons: • Deadly slow to compile and optimize stuff. LLVM JIT is an oxymoron (unless it’s used in a tiered compilation) • LLVM JIT adds 30-50mb to your application • Not super friendly for managed languages (Precise GC, “movable” pointers, etc)
  • 40. Tiered JIT 40 Any AOT code around? Take AOT code Is it hot ? Tier0 JIT ReJIT to Tier1 YES NO YES Function Run NO
  • 41. Optimizations… optimizations everywhere! 41 SSA form Const/Copy prop BC Removal Import IL Insert Bound checks Inlining Import C# Const/Copy prop Minor peephole opts Convert to LLVM IR Loop-related opts Etc… Including inlining! Simplify CFG SROA InstCombine Machine IR opts Register allocation Etc… Roslyn Mono LLVM PassManager DAG, MC, RA
  • 42. Runtimes for C# (IL): • .NET Framework 4.x • JIT • AOT (Fragile NGEN) • CoreCLR • JIT (Tiered) • AOT (ReadyToRun – R2R) • Mono • JIT • (Full)AOT • LLVM (AOT, FullAOT, JIT) • Interpreter • CoreRT • Unity IL2CPP • Unity Burst
  • 43. Q&Atwitter: EgorBo blog: EgorBo.com EgorBo Senior Software Engineer at Microsoft