diff --git a/tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc b/tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc index b4ec6b92e45..0906c71064e 100644 --- a/tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc +++ b/tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc @@ -383,7 +383,6 @@ std::vector<uint8> NVPTXCompiler::CompileGpuAsmOrGetCachedResult( VLOG(2) << "Compiled PTX size:" << ptx.size() << " CUBIN size: " << cache_value->cubin_data.size(); } else { - bool log_warning = true; if (maybe_cubin.status().code() == tensorflow::error::Code::NOT_FOUND) { // Missing ptxas is expected in some environments where CUDA SDK @@ -393,15 +392,20 @@ std::vector<uint8> NVPTXCompiler::CompileGpuAsmOrGetCachedResult( // TODO(jlebar): we should implement a LOG_FIRST_N and LOG_EVERY_N // for more general usage. static std::atomic<bool> warning_done(false); - log_warning = !warning_done.exchange(true); - } - if (log_warning) { - PrintCantFindCudaMessage( - "Can't find ptxas binary in ${CUDA_DIR}/bin. Will back to the " - "GPU driver for PTX -> sass compilation. This is OK so long " - "as you don't see a warning below about an out-of-date driver " - "version. Custom ptxas location can be specified using $PATH.", - hlo_module_config); + bool log_warning = !warning_done.exchange(true); + if (log_warning) { + PrintCantFindCudaMessage( + "Can't find ptxas binary in ${CUDA_DIR}/bin. Will back to " + "the GPU driver for PTX -> sass compilation. This is OK so " + "long as you don't see a warning below about an out-of-date " + "driver version. Custom ptxas location can be specified " + "using $PATH.", + hlo_module_config); + } + } else { + LOG(ERROR) << "Error during compilation of ptx to sass: " + << maybe_cubin.status() + << ". Falling back to the GPU driver."; } // We're going to use the driver to JIT our PTX->SASS, so warn if