Use -O3 for cuda compiles in opt, as significant cuda optimizations in

cuda-clang only get enabled at -O3.

PiperOrigin-RevId: 302467718
Change-Id: I7f6448c83762a9fb38d0ce47dd9b9850f89ba22d
This commit is contained in:
A. Unique TensorFlower 2020-03-23 10:44:39 -07:00 committed by TensorFlower Gardener
parent ac4bcb72fa
commit d9d7827dd2

View File

@ -24,9 +24,28 @@ def if_cuda_clang(if_true, if_false = []):
"//conditions:default": if_false
})
def if_cuda_clang_opt(if_true, if_false = []):
"""Shorthand for select()'ing on wheteher we're building with cuda-clang
in opt mode.
Returns a select statement which evaluates to if_true if we're building
with cuda-clang in opt mode. Otherwise, the select statement evaluates to
if_false.
"""
return select({
"@local_config_cuda//cuda:using_clang_opt": if_true,
"//conditions:default": if_false
})
def cuda_default_copts():
"""Default options for all CUDA compilations."""
return if_cuda(["-x", "cuda", "-DGOOGLE_CUDA=1"]) + %{cuda_extra_copts}
return if_cuda(
["-x", "cuda", "-DGOOGLE_CUDA=1"]
) + if_cuda_clang_opt(
# Some important CUDA optimizations are only enabled at O3.
["-O3"]
) + %{cuda_extra_copts}
def cuda_is_configured():
"""Returns true if CUDA was enabled during the configure process."""