tensorflow: Cannot build TFLite with OpenCL SYCL support

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 18.04
  • TensorFlow version: master (May 6th, 2020)
  • Bazel version (if compiling from source): 2.0.0

Describe the problem Cannot build TFLite with OpenCL SYCL support. Not with GCC (version 7.5.0). Not with Clang (version 10.0.0).

Provide the exact sequence of commands / steps that you executed before running into the problem Using GCC (version 7.5.0)

terminal: python3 configure.py
Extracting Bazel installation...
You have bazel 2.0.0 installed.
Please specify the location of python. [Default is /usr/bin/python3]:


Found possible Python library paths:
  /usr/local/lib/python3.6/dist-packages
  /usr/lib/python3/dist-packages
Please input the desired Python library path to use.  Default is [/usr/local/lib/python3.6/dist-packages]

Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: y
OpenCL SYCL support will be enabled for TensorFlow.

Please specify which C++ compiler should be used as the host C++ compiler. [Default is /usr/bin/g++]:


Please specify which C compiler should be used as the host C compiler. [Default is /usr/bin/gcc]:


Do you wish to build TensorFlow with ComputeCPP support? [Y/n]: y
ComputeCPP support will be enabled for TensorFlow.

Please specify the location where ComputeCpp for SYCL 1.2 is installed. [Default is /usr/local/computecpp]: /opt/ComputeCpp-CE-2.0.0-x86_64-linux-gnu


Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.

Do you wish to build TensorFlow with CUDA support? [y/N]: n
No CUDA support will be enabled for TensorFlow.

Do you wish to download a fresh release of clang? (Experimental) [y/N]: n
Clang will not be downloaded.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]:


Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.

Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.
	--config=mkl         	# Build with MKL support.
	--config=monolithic  	# Config for mostly static monolithic build.
	--config=ngraph      	# Build with Intel nGraph support.
	--config=numa        	# Build with NUMA support.
	--config=dynamic_kernels	# (Experimental) Build kernels into separate shared objects.
	--config=v2          	# Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
	--config=noaws       	# Disable AWS S3 filesystem support.
	--config=nogcp       	# Disable GCP support.
	--config=nohdfs      	# Disable HDFS support.
	--config=nonccl      	# Disable NVIDIA NCCL support.
terminal: bazel build -c opt --config=sycl //tensorflow/lite:libtensorflowlite.so
Starting local Bazel server and connecting to it...
WARNING: The following configs were expanded more than once: [sycl]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=275
INFO: Reading rc options for 'build' from /media/ssd512/tensorflow-master/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /media/ssd512/tensorflow-master/.bazelrc:
  'build' options: --apple_platform_type=macos --define framework_shared_object=true --define open_source_build=true --java_toolchain=//third_party/toolchains/java:tf_java_toolchain --host_java_toolchain=//third_party/toolchains/java:tf_java_toolchain --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --noincompatible_prohibit_aapt1 --enable_platform_specific_config --config=v2
INFO: Reading rc options for 'build' from /media/ssd512/tensorflow-master/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/usr/bin/python3 --action_env PYTHON_LIB_PATH=/usr/local/lib/python3.6/dist-packages --python_path=/usr/bin/python3 --config=xla --config=sycl --action_env HOST_CXX_COMPILER=/usr/bin/g++ --action_env HOST_C_COMPILER=/usr/bin/gcc --action_env TF_NEED_COMPUTECPP=1 --action_env COMPUTECPP_TOOLKIT_PATH=/opt/ComputeCpp-CE-2.0.0-x86_64-linux-gnu --action_env TF_CONFIGURE_IOS=0
INFO: Found applicable config definition build:v2 in file /media/ssd512/tensorflow-master/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:xla in file /media/ssd512/tensorflow-master/.bazelrc: --action_env=TF_ENABLE_XLA=1 --define=with_xla_support=true
INFO: Found applicable config definition build:sycl in file /media/ssd512/tensorflow-master/.bazelrc: --crosstool_top=@local_config_sycl//crosstool:toolchain --define=using_sycl=true --action_env TF_NEED_OPENCL_SYCL=1
INFO: Found applicable config definition build:sycl in file /media/ssd512/tensorflow-master/.bazelrc: --crosstool_top=@local_config_sycl//crosstool:toolchain --define=using_sycl=true --action_env TF_NEED_OPENCL_SYCL=1
INFO: Found applicable config definition build:linux in file /media/ssd512/tensorflow-master/.bazelrc: --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --config=dynamic_kernels
INFO: Found applicable config definition build:dynamic_kernels in file /media/ssd512/tensorflow-master/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
DEBUG: Rule 'io_bazel_rules_docker' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1556410077 -0400"
DEBUG: Call stack for the definition of repository 'io_bazel_rules_docker' which is a git_repository (rule definition at /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
 - /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/bazel_toolchains/repositories/repositories.bzl:37:9
 - /media/ssd512/tensorflow-master/WORKSPACE:37:1
ERROR: /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/local_config_sycl/crosstool/BUILD:12:1: @local_config_sycl//crosstool:cc-compiler-local: missing value for mandatory attribute 'toolchain_config' in 'cc_toolchain' rule
ERROR: /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/local_config_sycl/crosstool/BUILD:12:1: Target '@local_config_sycl//crosstool:empty' contains an error and its package is in error and referenced by '@local_config_sycl//crosstool:cc-compiler-local'
ERROR: /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/local_config_sycl/crosstool/BUILD:5:1: Target '@local_config_sycl//crosstool:cc-compiler-local' contains an error and its package is in error and referenced by '@local_config_sycl//crosstool:toolchain'
ERROR: /media/ssd512/tensorflow-master/tensorflow/lite/BUILD:574:1: every rule of type cc_binary implicitly depends upon the target '@local_config_sycl//crosstool:toolchain', but this target could not be found because of: Target '@local_config_sycl//crosstool:toolchain' contains an error and its package is in error
ERROR: Analysis of target '//tensorflow/lite:libtensorflowlite.so' failed; build aborted: Analysis failed
INFO: Elapsed time: 11.888s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (24 packages loaded, 53 targets configured)

Using Clang (version 10.0.0)

terminal: python3 configure.py
Extracting Bazel installation...
You have bazel 2.0.0 installed.
Please specify the location of python. [Default is /usr/bin/python3]:


Found possible Python library paths:
  /usr/lib/python3/dist-packages
  /usr/local/lib/python3.6/dist-packages
Please input the desired Python library path to use.  Default is [/usr/lib/python3/dist-packages]

Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: y
OpenCL SYCL support will be enabled for TensorFlow.

Please specify which C++ compiler should be used as the host C++ compiler. [Default is /usr/bin/g++]: /opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang++


Please specify which C compiler should be used as the host C compiler. [Default is /usr/bin/gcc]: /opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang


Do you wish to build TensorFlow with ComputeCPP support? [Y/n]: y
ComputeCPP support will be enabled for TensorFlow.

Please specify the location where ComputeCpp for SYCL 1.2 is installed. [Default is /usr/local/computecpp]: /opt/ComputeCpp-CE-2.0.0-x86_64-linux-gnu


Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.

Do you wish to build TensorFlow with CUDA support? [y/N]: n
No CUDA support will be enabled for TensorFlow.

Do you wish to download a fresh release of clang? (Experimental) [y/N]: n
Clang will not be downloaded.

Please specify optimization flags to use during compilation when bazel option "--config=opt" is specified [Default is -march=native -Wno-sign-compare]:


Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.

Preconfigured Bazel build configs. You can use any of the below by adding "--config=<>" to your build command. See .bazelrc for more details.
	--config=mkl         	# Build with MKL support.
	--config=monolithic  	# Config for mostly static monolithic build.
	--config=ngraph      	# Build with Intel nGraph support.
	--config=numa        	# Build with NUMA support.
	--config=dynamic_kernels	# (Experimental) Build kernels into separate shared objects.
	--config=v2          	# Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
	--config=noaws       	# Disable AWS S3 filesystem support.
	--config=nogcp       	# Disable GCP support.
	--config=nohdfs      	# Disable HDFS support.
	--config=nonccl      	# Disable NVIDIA NCCL support.
terminal: bazel build -c opt --config=sycl //tensorflow/lite:libtensorflowlite.so
Starting local Bazel server and connecting to it...
WARNING: The following configs were expanded more than once: [sycl]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=275
INFO: Reading rc options for 'build' from /media/ssd512/tensorflow-master/.bazelrc:
  Inherited 'common' options: --experimental_repo_remote_exec
INFO: Reading rc options for 'build' from /media/ssd512/tensorflow-master/.bazelrc:
  'build' options: --apple_platform_type=macos --define framework_shared_object=true --define open_source_build=true --java_toolchain=//third_party/toolchains/java:tf_java_toolchain --host_java_toolchain=//third_party/toolchains/java:tf_java_toolchain --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --noincompatible_prohibit_aapt1 --enable_platform_specific_config --config=v2
INFO: Reading rc options for 'build' from /media/ssd512/tensorflow-master/.tf_configure.bazelrc:
  'build' options: --action_env PYTHON_BIN_PATH=/usr/bin/python3 --action_env PYTHON_LIB_PATH=/usr/lib/python3/dist-packages --python_path=/usr/bin/python3 --config=xla --config=sycl --action_env HOST_CXX_COMPILER=/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang++ --action_env HOST_C_COMPILER=/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang --action_env TF_NEED_COMPUTECPP=1 --action_env COMPUTECPP_TOOLKIT_PATH=/opt/ComputeCpp-CE-2.0.0-x86_64-linux-gnu --action_env TF_CONFIGURE_IOS=0
INFO: Found applicable config definition build:v2 in file /media/ssd512/tensorflow-master/.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:xla in file /media/ssd512/tensorflow-master/.bazelrc: --action_env=TF_ENABLE_XLA=1 --define=with_xla_support=true
INFO: Found applicable config definition build:sycl in file /media/ssd512/tensorflow-master/.bazelrc: --crosstool_top=@local_config_sycl//crosstool:toolchain --define=using_sycl=true --action_env TF_NEED_OPENCL_SYCL=1
INFO: Found applicable config definition build:sycl in file /media/ssd512/tensorflow-master/.bazelrc: --crosstool_top=@local_config_sycl//crosstool:toolchain --define=using_sycl=true --action_env TF_NEED_OPENCL_SYCL=1
INFO: Found applicable config definition build:linux in file /media/ssd512/tensorflow-master/.bazelrc: --copt=-w --define=PREFIX=/usr --define=LIBDIR=$(PREFIX)/lib --define=INCLUDEDIR=$(PREFIX)/include --cxxopt=-std=c++14 --host_cxxopt=-std=c++14 --config=dynamic_kernels
INFO: Found applicable config definition build:dynamic_kernels in file /media/ssd512/tensorflow-master/.bazelrc: --define=dynamic_loaded_kernels=true --copt=-DAUTOLOAD_DYNAMIC_KERNELS
DEBUG: Rule 'io_bazel_rules_docker' indicated that a canonical reproducible form can be obtained by modifying arguments shallow_since = "1556410077 -0400"
DEBUG: Call stack for the definition of repository 'io_bazel_rules_docker' which is a git_repository (rule definition at /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/bazel_tools/tools/build_defs/repo/git.bzl:195:18):
 - /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/bazel_toolchains/repositories/repositories.bzl:37:9
 - /media/ssd512/tensorflow-master/WORKSPACE:37:1
ERROR: /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/local_config_sycl/crosstool/BUILD:12:1: @local_config_sycl//crosstool:cc-compiler-local: missing value for mandatory attribute 'toolchain_config' in 'cc_toolchain' rule
ERROR: /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/local_config_sycl/crosstool/BUILD:12:1: Target '@local_config_sycl//crosstool:empty' contains an error and its package is in error and referenced by '@local_config_sycl//crosstool:cc-compiler-local'
ERROR: /home/lotte/.cache/bazel/_bazel_lotte/984900b31b80e1f2c94e5989b5f952f7/external/local_config_sycl/crosstool/BUILD:5:1: Target '@local_config_sycl//crosstool:cc-compiler-local' contains an error and its package is in error and referenced by '@local_config_sycl//crosstool:toolchain'
ERROR: /media/ssd512/tensorflow-master/tensorflow/lite/BUILD:574:1: every rule of type cc_binary implicitly depends upon the target '@local_config_sycl//crosstool:toolchain', but this target could not be found because of: Target '@local_config_sycl//crosstool:toolchain' contains an error and its package is in error
ERROR: Analysis of target '//tensorflow/lite:libtensorflowlite.so' failed; build aborted: Analysis failed
INFO: Elapsed time: 12.664s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (23 packages loaded, 55 targets configured)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

same issue 😦 would love to get opencl working