Giter Site home page Giter Site logo

jmmartinez / easy-just-in-time Goto Github PK

View Code? Open in Web Editor NEW
505.0 505.0 31.0 596 KB

LLVM Optimization to extract a function, embedded in its intermediate representation in the binary, and execute it using the LLVM Just-In-Time compiler.

License: BSD 3-Clause "New" or "Revised" License

CMake 5.12% C++ 91.98% Shell 0.09% C 0.36% Python 2.45%
cpp jit llvm

easy-just-in-time's People

Contributors

dendisuhubdy avatar jmmartinez avatar jmmartinez-qb avatar ppapageo avatar serge-sans-paille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easy-just-in-time's Issues

Linking errors when moving to LLVM 14.0.6

I'm attempting to update this library to use LLVM 14.0.6. I can compile the plugin and runtime library, but I encounter a linking error when attempting to build the easyjit-example test:

Undefined symbols for architecture arm64:
  "char* easy::layout::serialize_arg<char const*>(char const*)", referenced from:
      void* easy::layout::get_layout<char const*>() in camfilter.cpp.o
  "char* easy::layout::serialize_arg<unsigned char const*>(unsigned char const*)", referenced from:
      void* easy::layout::get_layout<unsigned char const*>() in camfilter.cpp.o
  "char* easy::layout::serialize_arg<unsigned char*>(unsigned char*)", referenced from:
      void* easy::layout::get_layout<unsigned char*>() in camfilter.cpp.o
  "char* easy::layout::serialize_arg<unsigned int>(unsigned int)", referenced from:
      void* easy::layout::get_layout<unsigned int>() in camfilter.cpp.o
ld: symbol(s) not found for architecture arm64

My fork:
https://github.com/kathlenehurt-sifive/easy-just-in-time/tree/llvm-14.0.6

Is this repo still being maintained?

Internal structure of the project

Hi, I'm actually doing my bachelor's thesis about Just in Time compiler and i found your project, which could be really useful for me. But, I have a question, is there any documentation about the internal structure of the project, or about how the library works ? It could be a mailling list or a schema with explanation or anything else.

Every example fails with an Assertion Error

I am currently experimenting with this tool / library, but every example that I want to try fails with the following assertion error:

a.out: /path/to/easy-just-in-time/runtime/pass/InlineParameters.cpp:31: easy::HighLevelLayout GetNewLayout(const easy::Context &, easy::HighLevelLayout &): Assertion `C.size() == HLL.Args_.size()' failed.

Since I have no Idea about the internals of this project I do not know what to do. Do you have any idea whats wrong (or what I am missing?)?

Additional Information:

  • Happens during the call of easy::jit

  • Command used to compile the tests: clang++ --std=c++14 test.cpp -Xclang -load -Xclang /path/to/easy-just-in-time/build/bin/EasyJitPass.so -I /path/to/easy-just-in-time/include -L /path/to/easy-just-in-time/build/bin -lEasyJitRuntime -stdlib=libc++

CMake Error: Could NOT find PY_lit (missing: PY_LIT)

Ubuntu 18.04
Clang 8.0
LLVM 6.0 dev and tools
CMake 3.12
Running CMake as appropriate yields an immediate failure of
-- Could NOT find PY_lit (missing: PY_LIT)
I assume this to be some kind of python dependency but I've never seen that error before.
Python 2.7.15 and 3.6.8 are installed, so I don't know what the issue is.

Example fails with `Inserted && "Pass registered multiple times!"' error

Compiling with a custom build of LLVM 6.0 works:

$ pwd
/home/mogosanu/llvm-jit/easyjit-obj
$ cmake -DLLVM_DIR=/opt/llvm-6.0/lib/cmake/llvm/ ../easy-just-in-time/
$ cmake --build .
# generates /home/mogosanu/llvm-jit/easyjit-obj/bin/{EasyJitPass.so,libEasyJitRuntime.so}

And so does compiling a very simple example:

/opt/llvm-6.0/bin/clang++ -O2 --std=c++14 -o hello hello.cpp \
  -Xclang -load -Xclang /home/mogosanu/llvm-jit/easyjit-obj/bin/EasyJitPass.so \
  -I/home/mogosanu/llvm-jit/easy-just-in-time/include -L/home/mogosanu/llvm-jit/easyjit-obj/bin \
  -lEasyJitRuntime

But running it gives the following error:

$ LD_LIBRARY_PATH=/home/mogosanu/llvm-jit/easyjit-obj/bin ./hello 
hello: /home/mogosanu/llvm-jit/llvm/lib/IR/PassRegistry.cpp:62: void llvm::PassRegistry::registerPass(const llvm::PassInfo&, bool): Assertion `Inserted && "Pass registered multiple times!"' failed.
Aborted

hello.cpp:

#include <cstdio>

int main(void)
{
	printf("Hello, world!\n");
	return 0;
}

Can I get some help regarding this? Thank you!

more complex examples?

the idea behind his project is really cool. very nice work.

i've been looking at some of the examples, and i'm wondering if you have any more complex examples of the functions that can be jit compiled. it looks like all the examples (maybe im missing some?) are all just doing basic variable value substitution before the jit compile step. i'm wondering about loop unrolling (e.g. if a vector is the parameter), or perhaps changing control flow to build expressions.

Example camfilter fails

I have a self-built LLVM/Clang 6.0.1 and building with examples fails at camfilter with

[1/2] Building CXX object doc/readme/CMakeFiles/easyjit-example.dir/camfilter.cpp.o
FAILED: doc/readme/CMakeFiles/easyjit-example.dir/camfilter.cpp.o 
/usr/local/bin/clang++   -I/usr/local/include -I/home/maliusarth/dev/ext/repos/easy-just-in-time/include -isystem /usr/local/include/opencv4 -Xclang -disable-O0-optnone -Xclang -load -Xclang /home/maliusarth/dev/ext/projects/cmake/easy-just-in-time/bin/EasyJitPass.so -g   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=gnu++14 -MD -MT doc/readme/CMakeFiles/easyjit-example.dir/camfilter.cpp.o -MF doc/readme/CMakeFiles/easyjit-example.dir/camfilter.cpp.o.d -o doc/readme/CMakeFiles/easyjit-example.dir/camfilter.cpp.o -c /home/maliusarth/dev/ext/repos/easy-just-in-time/doc/readme/camfilter.cpp
/home/maliusarth/dev/ext/repos/easy-just-in-time/doc/readme/camfilter.cpp:198:50: error: use of undeclared identifier 'cvPoint'
    cv::putText(*Out, fps_message.str().c_str(), cvPoint(30,30),
                                                 ^
/home/maliusarth/dev/ext/repos/easy-just-in-time/doc/readme/camfilter.cpp:200:17: error: use of undeclared identifier 'cvScalar'
                cvScalar(200,200,250), 1, CV_AA);
                ^
/home/maliusarth/dev/ext/repos/easy-just-in-time/doc/readme/camfilter.cpp:200:43: error: use of undeclared identifier 'CV_AA'
                cvScalar(200,200,250), 1, CV_AA);
                                          ^
3 errors generated.
ninja: build stopped: subcommand failed.

Compare with optimized convolutions

Hey there, promising work on a C++ JIT.

Can you compare your JIT results with state-of-the-art convolution or at least im2col + GEMM convolution and report the GFLOP/s reached and theoretical peak?

Here are all the resources I gathered regarding convolution optimisation.

The main issue with naive direct convolution are the cache misses and poor utilisation of the CPU cache hierarchy.

On benchmarks on my CPU, a i5-5257U 2.7Ghz dual core Broadwell supporting AVX+FMA the theoretical compute peak is 172.8 GLOP/s, however a naive convolution can reach only 2.6 GFLOP/s. When reframing as a im2col + GEMM (matrix multiplication), I can reach 20+ GFLOP/s.

I didn't finish yet but I hope to reach 120+ GFLOP/s using my own BLAS which attains 98% of the speed of OpenBLAS (72.4 GFLOPS vs 73.8 GFLOPS single threaded, 136 GFLOP/s vs 145 GFLOP/s multithreaded) and fusing im2col with the matrix multiplication repacking steps.

Other promising approaches that should reach 100+ GFLOP/s are MKL-DNN and libxsmm which is described in great detail in this paper.

Also Halide has an optimised JIT generation for computational imagery and already relies on LLVM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.