lukeiwanski / tensorflow

OpenCL support for TensorFlow via SYCL
Apache License 2.0
65 stars 14 forks source link

Revamping CMakeList #250

Open skn123 opened 6 years ago

skn123 commented 6 years ago

Please go to Stack Overflow for help and support:

https://stackoverflow.com/questions/tagged/tensorflow

If you open a GitHub issue, here is our policy:

  1. It must be a bug, a feature request, or a significant problem with documentation (for small docs fixes please send a PR instead).
  2. The form below must be filled out.
  3. It shouldn't be a TensorBoard issue. Those go here.

Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.


System information

You can collect some of this information using our environment capture script:

https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh

You can obtain the TensorFlow version with

python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

Describe the problem

Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request. Need a revamp of contrib/cmake/CMakeLists.txt to account for ComputeCPP

Source code / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem. No logs are needed as this is a feature request. I am trying to rebuild the dev/amd_gpu version of TF and for that I would need to revamp the entire CMakeLists file(s). My first target would be to build a C++ example and then I will attempt the python version (which itself looks pretty messy). In this regard, are there any special #define flags that need to be defined for ComputeCpp?

DuncanMcBain commented 6 years ago

Hi @skn123, thanks for your interest in contributing. As it happens, there's more than a couple of defines required for building TensorFlow with ComputeCpp! Forgive me if you've seen this, but because ComputeCpp interacts with OpenCL devices, a separate compiler is required to output instructions they can execute. As it happens we maintain a FindComputeCpp.cmake module which does basically everything. It's recently been revamped to be much better-behaved and more in-line with modern CMake, this should be the last interface change for a while.

If you'd like to attempt a CMake build of TensorFlow + ComputeCpp, I would advise starting here. You can find some example usage of the module in the linked respository - the important function is "add_sycl_to_target", which will compile all the sources in a target with compute++ (our device compiler) and make sure that code is in the objects produced. I can understand that this might not be desireable - in which case you can use the function "__build_ir" directly, which might be more useful in this case. It operates on single source files, so you'd have a little more control.

If you have any other questions, please ask me, I've spent a bunch of time working on the module recently (however, I have no idea how what TensorFlow's CMake looks like :p).

In terms of special defines... I think the bazel configuration for SYCL should list them all. I can't remember offhand but there are a couple.