aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/sycl
diff options
context:
space:
mode:
authorGravatar Andrew Harp <andrewharp@google.com>2017-03-01 17:59:22 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-01 18:08:24 -0800
commit3e975ea978bac4d861bb09328b06f3c316212611 (patch)
tree79bac044c9723df8443495eb962c2dd98a2ed421 /third_party/sycl
parent8043a27ed77f59bb68409070f2bfa01df0e04b89 (diff)
Merge changes from github.
Change: 148954491
Diffstat (limited to 'third_party/sycl')
-rwxr-xr-xthird_party/sycl/crosstool/computecpp.tpl33
1 files changed, 28 insertions, 5 deletions
diff --git a/third_party/sycl/crosstool/computecpp.tpl b/third_party/sycl/crosstool/computecpp.tpl
index a5e6b9fe93..66dd9aea7b 100755
--- a/third_party/sycl/crosstool/computecpp.tpl
+++ b/third_party/sycl/crosstool/computecpp.tpl
@@ -26,9 +26,7 @@ def main():
if(output_file_index == 1):
# we are linking
- return subprocess.call([CPU_CXX_COMPILER] + compiler_flags)
-
- compiler_flags = compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DEIGEN_USE_SYCL=1']
+ return subprocess.call([CPU_CXX_COMPILER] + compiler_flags + ['-Wl,--no-undefined'])
# find what we compile
compiling_cpp = 0
@@ -38,6 +36,28 @@ def main():
if(compited_file_name.endswith(('.cc', '.c++', '.cpp', '.CPP', '.C', '.cxx'))):
compiling_cpp = 1;
+ compiler_flags = compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DEIGEN_USE_SYCL=1', '-DTENSORFLOW_USE_SYCL', '-DEIGEN_HAS_C99_MATH']
+
+ if(compiling_cpp == 1):
+ # create a blacklist of folders that will be skipped when compiling with ComputeCpp
+ _skip = ["external", "llvm", ".cu.cc"]
+ # if compiling external project skip computecpp
+ if any(_folder in _skip for _folder in output_file_name):
+ return subprocess.call([CPU_CXX_COMPILER] + compiler_flags)
+
+ if(compiling_cpp == 1):
+ # this is an optimisation that will check if compiled file has to be compiled with ComputeCpp
+
+ _tmp_flags = [flag for flag in compiler_flags if not flag.startswith(('-o', output_file_name))]
+ # create preprocessed of the file
+ _cmd = " ".join([CPU_CXX_COMPILER] + _tmp_flags + ["-E"])
+ # check if it has parallel_for< in it
+ _cmd += " | grep \".parallel_for\" > /dev/null"
+ ps = subprocess.call(_cmd, shell=True)
+ # if not call CXX compiler
+ if(ps != 0):
+ return subprocess.call([CPU_CXX_COMPILER] + compiler_flags)
+
if(compiling_cpp == 1):
filename, file_extension = os.path.splitext(output_file_name)
bc_out = filename + '.sycl'
@@ -52,9 +72,12 @@ def main():
# dont want that in case of compiling with computecpp first
host_compiler_flags = [flag for flag in compiler_flags
if not flag.startswith(('-MF', '-MD',))
- if not '.d' in flag]
+ if not '.d' in flag
+ ]
+
+ host_compiler_flags[host_compiler_flags.index('-c')] = "--include"
- host_compiler_flags = ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '--include', bc_out] + host_compiler_flags
+ host_compiler_flags = ['-xc++', '-D_GLIBCXX_USE_CXX11_ABI=0', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '-c', bc_out] + host_compiler_flags
x = subprocess.call([CPU_CXX_COMPILER] + host_compiler_flags)
return x
else: