Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get llvm ir from tensorflow dataset? #1

Closed
aifight opened this issue Dec 20, 2018 · 3 comments
Closed

how to get llvm ir from tensorflow dataset? #1

aifight opened this issue Dec 20, 2018 · 3 comments

Comments

@aifight
Copy link

aifight commented Dec 20, 2018

Hello, Thanks for your impressive paper and remarkable code! I'm starting from compiling tensorflow source code to learn your algorithm better, but I'm stuck in comiling c++ code to llvm ir. Could you tell me how to compile tensorflow source code to llvm ir?

For now, I've downloaded tensorflow source code and put it in path: "/data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/"

Then, I entered the path:"/data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/tensorflow/cc/gradients"
I invoke command clang -I/data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow -I/data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/third_party/eigen3 -S -emit-llvm image_grad.cc to get llvm ir, but I got error below:

In file included from /data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:
In file included from /data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:
/data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/third_party/eigen3/unsupported/Eigen/CXX11/Tensor:1:10: error: #include nested too deeply
#include "unsupported/Eigen/CXX11/Tensor"

In file included from image_grad.cc:17:
In file included from /data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/tensorflow/cc/framework/grad_op_registry.h:21:
In file included from /data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/tensorflow/cc/framework/ops.h:21:
In file included from /data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/tensorflow/core/framework/tensor.h:22:
In file included from /data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/tensorflow/core/framework/allocator.h:23:
In file included from /data/sjd/project/sometest/llvmtest/tensorflow-c-source/tensorflow/tensorflow/core/framework/numeric_types.h:19:
In file included from /usr/lib/gcc/x86_64-linux-gnu/5.5.0/../../../../include/c++/5.5.0/complex:44:
/usr/lib/gcc/x86_64-linux-gnu/5.5.0/../../../../include/c++/5.5.0/cmath:1096:11: error: no member named 'acoshf' in the global namespace; did you mean 'acosh'?
using ::acoshf;
~~^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:88:13: note: 'acosh' declared here
__MATHCALL (acosh,, (Mdouble __x));
^

@tbennun
Copy link
Collaborator

tbennun commented Dec 24, 2018

Trying to compile a large project such as TensorFlow manually can be very messy. What we did to obtain the full compilation commands was:

  • Follow the "Build from Source" instructions: https://www.tensorflow.org/install/source
    • Set clang as the compiler (so that flags are set properly)
  • After compilation, read the build log file generated by bazel
    • grep the file for lines with "clang"
    • Add the -S -emit-llvm and -o flags

Hope this helps.

@tbennun
Copy link
Collaborator

tbennun commented Feb 19, 2019

@aifight did it help?

@aifight
Copy link
Author

aifight commented Feb 22, 2019

@tbennun Thanks for your instruction! I'm doing somethins more urgent recently, I'll try this method later

@tbennun tbennun closed this as completed Apr 8, 2019
tbennun pushed a commit that referenced this issue Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants