Actually performs the work of ROCM initialization. Wrapped up in one-time execution guard.
| 292 | // Actually performs the work of ROCM initialization. Wrapped up in one-time |
| 293 | // execution guard. |
| 294 | static port::Status InternalInit() { |
| 295 | hipError_t res = hipErrorNoDevice; |
| 296 | if (FLAGS_gpuexec_rocm_driver_inject_init_error) { |
| 297 | LOG(ERROR) << "injecting ROCM init error; initialization will fail"; |
| 298 | } else { |
| 299 | res = tensorflow::wrap::hipInit(0 /* = flags */); |
| 300 | } |
| 301 | |
| 302 | if (res == hipSuccess) { |
| 303 | return port::Status::OK(); |
| 304 | } |
| 305 | |
| 306 | LOG(ERROR) << "failed call to hipInit: " << ToString(res); |
| 307 | Diagnostician::LogDiagnosticInformation(); |
| 308 | return port::Status{port::error::ABORTED, |
| 309 | absl::StrCat("failed call to hipInit: ", ToString(res))}; |
| 310 | } |
| 311 | |
| 312 | } // namespace |
| 313 |