tensorflow/compiler/xla/service/gpu/nvptx_compiler.cc
// Try to load ptx from files defined in the FLAGS. If successful, return true.
Try to load ptx from files defined in the FLAGS. If successful, return true.
Try to load ptx from files defined in the FLAGS . If successful return true .
bool MaybeLoadPtxFromFile(const HloModuleConfig module_config,
                          const HloModule* module, std::string* ptx) {
  std::string prefix = xla::FilenameFor(*module, "", *ptx);
  std::string matched_filename;
  for (const std::string& full_filename :
       module_config.debug_options().xla_gpu_ptx_file()) {
    auto filename = tensorflow::io::Basename(full_filename);
    if (absl::StartsWith(filename, prefix)) {
      matched_filename = full_filename;
      VLOG(1) << "RunBackend() - Will load PTX from file: " << full_filename;
      break;
    }
  }
  if (!module_config.debug_options().xla_gpu_ptx_file().empty() &&
      matched_filename.empty()) {
    VLOG(1) << "RunBackend() - For module with prefix '" << prefix
            << "', we did not found a PTX file to load.";
  }
  if (!matched_filename.empty()) {
    std::ifstream ifs(matched_filename, std::ifstream::in);
    *ptx = std::string(std::istreambuf_iterator<char>(ifs),
                       std::istreambuf_iterator<char>());
    CHECK(!ptx->empty()) << "Empty or non existing PTX file: "
                         << matched_filename;
    return true;
  }
  return false;
}
bool MaybeLoadPtxFromFile ( const HloModuleConfig module_config , const HloModule * module , std :: string * ptx ) { std :: string prefix = xla :: FilenameFor ( * module , " " , * ptx ) ; std :: string matched_filename ; for ( const std :: string & full_filename : module_config . debug_options ( ) . xla_gpu_ptx_file ( ) ) { auto filename = tensorflow :: io :: Basename ( full_filename ) ; if ( absl :: StartsWith ( filename , prefix ) ) { matched_filename = full_filename ; VLOG ( 1 ) << " " << full_filename ; break ; } } if ( ! module_config . debug_options ( ) . xla_gpu_ptx_file ( ) . empty ( ) && matched_filename . empty ( ) ) { VLOG ( 1 ) << " " << prefix << " " ; } if ( ! matched_filename . empty ( ) ) { std :: ifstream ifs ( matched_filename , std :: ifstream :: in ) ; * ptx = std :: string ( std :: istreambuf_iterator < char > ( ifs ) , std :: istreambuf_iterator < char > ( ) ) ; CHECK ( ! ptx -> empty ( ) ) << " " << matched_filename ; return true ; } return false ; }
Try to load ptx from files defined in the FLAGS.
Try to load ptx from files defined in the FLAGS .
// If the xla_gpu_ptx_file option is set, be explicit if a file is used // and warn when a file is not used to ease catching typo in filename. // To ease comparing many PTX versions, accept different suffixes then // the original filename.