Returns the directory containing ROCm-Device-Libs files. This function is called in AMDGPUCompiler's constructor, so can't return an error. But AMDGPUCompiler::Compile will return an error when the wanted rocdl file doesn't exist in the folder this function returns.
| 46 | // AMDGPUCompiler::Compile will return an error when the wanted rocdl file |
| 47 | // doesn't exist in the folder this function returns. |
| 48 | string GetROCDLDir(const HloModuleConfig& config) { |
| 49 | std::vector<string> potential_rocdl_dirs; |
| 50 | const string datadir = config.debug_options().xla_gpu_cuda_data_dir(); |
| 51 | if (!datadir.empty()) { |
| 52 | potential_rocdl_dirs.push_back(datadir); |
| 53 | } |
| 54 | potential_rocdl_dirs.push_back(tensorflow::RocdlRoot()); |
| 55 | |
| 56 | // Tries all potential ROCDL directories in the order they are inserted. |
| 57 | // Returns the first directory that exists in the file system. |
| 58 | for (const string& potential_rocdl_dir : potential_rocdl_dirs) { |
| 59 | if (tensorflow::Env::Default()->IsDirectory(potential_rocdl_dir).ok()) { |
| 60 | VLOG(2) << "Found ROCm-Device-Libs dir " << potential_rocdl_dir; |
| 61 | return potential_rocdl_dir; |
| 62 | } |
| 63 | VLOG(2) << "Unable to find potential ROCm-Device-Libs dir " |
| 64 | << potential_rocdl_dir; |
| 65 | } |
| 66 | |
| 67 | // Last resort: maybe in the current folder. |
| 68 | return "."; |
| 69 | } |
| 70 | |
| 71 | } // namespace |
| 72 |
no test coverage detected