Only print the ptxas not found if the error code is NOT_FOUND.

In other error cases, print the error status instead.

PiperOrigin-RevId: 308996376
Change-Id: I707cd9e3627523bad446604b6a2842f1f14e3254
This commit is contained in:
Adrian Kuegel 2020-04-29 04:07:04 -07:00 committed by TensorFlower Gardener
parent e7d4c55123
commit 277fa1bbd1

View File

@ -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