From 1cb96893a64f59b7265f9def9968f7bed1e57662 Mon Sep 17 00:00:00 2001 From: Andrew Harp Date: Thu, 8 Dec 2016 20:05:49 -0800 Subject: Merge changes from github. Additionally: - change single quotes to double quotes to make path rewriting easier - guard windows lib reference with PLATFORM_WINDOWS - fixed failing kmeans test Change: 141515942 --- third_party/sycl/crosstool/CROSSTOOL.tpl | 21 ++++++++++++++++ third_party/sycl/crosstool/computecpp.tpl | 40 ++++++++++++++----------------- 2 files changed, 39 insertions(+), 22 deletions(-) (limited to 'third_party/sycl') diff --git a/third_party/sycl/crosstool/CROSSTOOL.tpl b/third_party/sycl/crosstool/CROSSTOOL.tpl index 2108a5b9f0..d767b8ca4a 100755 --- a/third_party/sycl/crosstool/CROSSTOOL.tpl +++ b/third_party/sycl/crosstool/CROSSTOOL.tpl @@ -72,6 +72,9 @@ toolchain { # All warnings are enabled. Maybe enable -Werror as well? compiler_flag: "-Wall" + # Enable SSE instructions by default + compiler_flag: "-msse3" + # Anticipated future default. linker_flag: "-Wl,-no-as-needed" # Stamp the binary with a unique identifier. @@ -79,4 +82,22 @@ toolchain { linker_flag: "-Wl,--hash-style=gnu" linking_mode_flags { mode: DYNAMIC } + + compilation_mode_flags { + mode: FASTBUILD + compiler_flag: "-O0" + } + + compilation_mode_flags { + mode: DBG + compiler_flag: "-g" + } + + compilation_mode_flags { + mode: OPT + compiler_flag: "-g0" + compiler_flag: "-O2" + compiler_flag: "-DNDEBUG" + } } + diff --git a/third_party/sycl/crosstool/computecpp.tpl b/third_party/sycl/crosstool/computecpp.tpl index d319a1eb75..0c7611d298 100755 --- a/third_party/sycl/crosstool/computecpp.tpl +++ b/third_party/sycl/crosstool/computecpp.tpl @@ -1,61 +1,57 @@ #!/usr/bin/env python -from argparse import ArgumentParser import os import subprocess -import re import sys -import pipes CPU_CXX_COMPILER = ('%{host_cxx_compiler}') CPU_C_COMPILER = ('%{host_c_compiler}') CURRENT_DIR = os.path.dirname(sys.argv[0]) -COMPUTECPP_ROOT = CURRENT_DIR +"/../sycl/" -COMPUTECPP_DRIVER= COMPUTECPP_ROOT+"bin/compute++" -COMPUTECPP_INCLUDE = COMPUTECPP_ROOT+"include" +COMPUTECPP_ROOT = CURRENT_DIR + '/../sycl/' +COMPUTECPP_DRIVER= COMPUTECPP_ROOT + 'bin/compute++' +COMPUTECPP_INCLUDE = COMPUTECPP_ROOT + 'include' def main(): - computecpp_compiler_flags = [""] computecpp_compiler_flags = [flag for flag in sys.argv[1:]] - computecpp_compiler_flags = computecpp_compiler_flags + ["-D_GLIBCXX_USE_CXX11_ABI=0"] - output_file_index = computecpp_compiler_flags.index("-o") +1 + output_file_index = computecpp_compiler_flags.index('-o') + 1 output_file_name = computecpp_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] + computecpp_compiler_flags) + + computecpp_compiler_flags = computecpp_compiler_flags + ['-D_GLIBCXX_USE_CXX11_ABI=0'] # find what we compile compiling_cpp = 0 - if("-c" in computecpp_compiler_flags): - compiled_file_index = computecpp_compiler_flags.index("-c") +1 + 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(compited_file_name.endswith(('.cc', '.c++', '.cpp', '.CPP', '.C', '.cxx'))): compiling_cpp = 1; if(compiling_cpp == 1): filename, file_extension = os.path.splitext(output_file_name) - bc_out = filename + ".sycl" + bc_out = filename + '.sycl' - computecpp_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_compiler_flags + 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 # dont want that in case of compiling with computecpp first - host_compiler_flags = [""] host_compiler_flags = [flag for flag in sys.argv[1:] - if not flag.startswith(('-MF','-MD',)) - if not ".d" in flag] + 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_compiler_flags ) if(x == 0): - host_compiler_flags = ['-D_GLIBCXX_USE_CXX11_ABI=0', '-DTENSORFLOW_USE_SYCL', '-Wno-unused-variable', '-I', COMPUTECPP_INCLUDE, "--include",bc_out] + host_compiler_flags - return subprocess.call([CPU_CXX_COMPILER] +host_compiler_flags ) + 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] + computecpp_compiler_flags) if __name__ == '__main__': sys.exit(main()) -- cgit v1.2.3