message: Use -O3 for cuda compiles in opt, as significant cuda optimizations in
  cuda-clang only get enabled at -O3.
diff: @@ -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."""
  