8000 GitHub - 4ar0nma0/Merlin: Code for Merlin: multi-tier optimization of eBPF code for performance and compactness
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

4ar0nma0/Merlin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Merlin

This is repository for <Merlin: multi-tier optimization of eBPF code for performance and compactness>

Usage

LLVM Passes (IR Refinement)

git clone https://github.com/4ar0nma0/Merlin.git && cd Merlin

Before you do a cmake, change the llvm install dir and version in the cmakelist file in each directory. After that, run cmake and make

cmake .<
75CD
/span>
make

You can find compiled .so library in ./lib directory. To integrate the pass into compilation process, you need to use opt. Alignment optimization:

opt --load-pass-plugin ./lib/libAlignBPF.so -passes=alignbpf input.ll -o output.ll

Macro-op Fusion:

opt --load-pass-plugin ./lib/libAtomicBPF.so -passes=atomicbpf input.ll -o output.ll

Together, but note put alignbpf before atomicbpf:

opt --load-pass-plugin ./lib/libAtomicBPF.so --load-pass-plugin ./lib/libAtomicBPF.so -passes=alignbpf,atomicbpf input.ll -o output.ll

Python Scripts (Bytecode Optimization)

Librarys

pip install lief numpy

Usage

prog = BPFProg('test.o')
prog.save('test_optimized.o')

You will need an object file generated by clang or llc. By default the script applies all optimizations. PRs are welcome.

Reproducing Results

Please re-compile the llvm passes with line 227-229 in alignment optimziation uncommented. If you have any issues, please submit an issue. Note that detailed results may differ if using different flags or llvm versions.

License

MIT License

About

Code for Merlin: multi-tier optimization of eBPF code for performance and compactness

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0