aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/sycl/crosstool/computecpp.tpl
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sycl/crosstool/computecpp.tpl')
-rwxr-xr-xthird_party/sycl/crosstool/computecpp.tpl42
1 files changed, 25 insertions, 17 deletions
diff --git a/third_party/sycl/crosstool/computecpp.tpl b/third_party/sycl/crosstool/computecpp.tpl
index 0c7611d298..e90d51bf87 100755
--- a/third_party/sycl/crosstool/computecpp.tpl
+++ b/third_party/sycl/crosstool/computecpp.tpl
@@ -13,22 +13,28 @@ COMPUTECPP_DRIVER= COMPUTECPP_ROOT + 'bin/compute++'
COMPUTECPP_INCLUDE = COMPUTECPP_ROOT + 'include'
def main():
- computecpp_compiler_flags = [flag for flag in sys.argv[1:]]
+ compiler_flags = []
- output_file_index = computecpp_compiler_flags.index('-o') + 1
- output_file_name = computecpp_compiler_flags[output_file_index]
+ # remove -fsamotoze-coverage from string
+ if CPU_CXX_COMPILER.find("g++") != -1:
+ compiler_flags = [flag for flag in sys.argv[1:] if not flag.startswith(('-Wl,--no-undefined', '-fsanitize-coverage', '-Wno-unused-but-set-variable', '-Wignored-attributes'))]
+ else:
+ compiler_flags = [flag for flag in sys.argv[1:] if not flag.startswith(('-Wl,--no-undefined', '-Wno-unused-but-set-variable', '-Wignored-attributes'))]
+
+ output_file_index = compiler_flags.index('-o') + 1
+ output_file_name = compiler_flags[output_file_index]
if(output_file_index == 1):
# we are linking
- return subprocess.call([CPU_CXX_COMPILER] + computecpp_compiler_flags)
+ return subprocess.call([CPU_CXX_COMPILER] + compiler_flags)
- computecpp_compiler_flags = computecpp_compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0']
+ compiler_flags = compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DEIGEN_USE_SYCL=1']
# find what we compile
compiling_cpp = 0
- if('-c' in computecpp_compiler_flags):
- compiled_file_index = computecpp_compiler_flags.index('-c') + 1
- compited_file_name = computecpp_compiler_flags[compiled_file_index]
+ if('-c' in compiler_flags):
+ compiled_file_index = compiler_flags.index('-c') + 1
+ compited_file_name = compiler_flags[compiled_file_index]
if(compited_file_name.endswith(('.cc', '.c++', '.cpp', '.CPP', '.C', '.cxx'))):
compiling_cpp = 1;
@@ -36,22 +42,24 @@ def main():
filename, file_extension = os.path.splitext(output_file_name)
bc_out = filename + '.sycl'
- computecpp_compiler_flags = ['--sycl-no-diags', '-sycl-compress-name', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '-isystem',
- COMPUTECPP_INCLUDE, '-std=c++11', '-sycl', '-emit-llvm', '-no-serial-memop'] + computecpp_compiler_flags
+ # strip asan for the device
+ computecpp_device_compiler_flags = [flag for flag in compiler_flags if not flag.startswith(('-fsanitize'))]
+ computecpp_device_compiler_flags = ['-sycl-compress-name', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '-isystem',
+ COMPUTECPP_INCLUDE, '-std=c++11', '-sycl', '-emit-llvm', '-no-serial-memop'] + computecpp_device_compiler_flags
- # dont want that in case of compiling with computecpp first
- host_compiler_flags = [flag for flag in sys.argv[1:]
- if not flag.startswith(('-MF', '-MD',))
- if not '.d' in flag]
-
- x = subprocess.call([COMPUTECPP_DRIVER] + computecpp_compiler_flags )
+ x = subprocess.call([COMPUTECPP_DRIVER] + computecpp_device_compiler_flags )
if(x == 0):
+ # 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]
+
host_compiler_flags = ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, '--include', bc_out] + host_compiler_flags
x = subprocess.call([CPU_CXX_COMPILER] + host_compiler_flags)
return x
else:
# compile for C
- return subprocess.call([CPU_C_COMPILER] + computecpp_compiler_flags)
+ return subprocess.call([CPU_C_COMPILER] + compiler_flags)
if __name__ == '__main__':
sys.exit(main())