Don't add branch prediction hints when compiling under nvcc.
authorCraig Citro <craigcitro@google.com>
Thu, 17 May 2018 23:06:21 +0000 (16:06 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 17 May 2018 23:09:11 +0000 (16:09 -0700)
commitf506183dd148d97e3378eb994b2ac9c948ef0ada
tree375447e7dcf56867e052263382a237deb0ea3488
parent9249edb7758cc3e14aa3bfce0a0c98d49c0487b1
Don't add branch prediction hints when compiling under nvcc.

As seen in #19203, the `__builtin_expect` compiler builtin isn't recognized as
a builtin in nvcc8, leading to compilation failures of the form

    ./tensorflow/core/kernels/gather_functor_gpu.cu.h(57): error: calling a __host__ function("__builtin_
expect") from a __global__ function("tensorflow::GatherOpKernel< ::Eigen::half, int, (bool)1> ") is n
ot allowed

when attempting to build TensorFlow.

This change fixes things by adding an additional check for `__NVCC__`, and
avoiding any branch prediction hints in that case.

PiperOrigin-RevId: 197067418
tensorflow/core/platform/macros.h