| 4567 | } // namespace gpu |
| 4568 | |
| 4569 | void initialize_miopen() { |
| 4570 | auto miopenAlreadyRegistered = PluginRegistry::Instance()->HasFactory( |
| 4571 | rocm::kROCmPlatformId, PluginKind::kDnn, gpu::kMIOpenPlugin); |
| 4572 | |
| 4573 | if (!miopenAlreadyRegistered) { |
| 4574 | port::Status status = |
| 4575 | PluginRegistry::Instance()->RegisterFactory<PluginRegistry::DnnFactory>( |
| 4576 | rocm::kROCmPlatformId, gpu::kMIOpenPlugin, "MIOpen", |
| 4577 | [](internal::StreamExecutorInterface* parent) -> dnn::DnnSupport* { |
| 4578 | gpu::GpuExecutor* rocm_executor = |
| 4579 | dynamic_cast<gpu::GpuExecutor*>(parent); |
| 4580 | if (rocm_executor == nullptr) { |
| 4581 | LOG(ERROR) |
| 4582 | << "Attempting to initialize an instance of the MIOpen " |
| 4583 | << "support library with a non-ROCM StreamExecutor"; |
| 4584 | return nullptr; |
| 4585 | } |
| 4586 | |
| 4587 | gpu::MIOpenSupport* dnn = new gpu::MIOpenSupport(rocm_executor); |
| 4588 | if (!dnn->Init().ok()) { |
| 4589 | // Note: Init() will log a more specific error. |
| 4590 | delete dnn; |
| 4591 | return nullptr; |
| 4592 | } |
| 4593 | return dnn; |
| 4594 | }); |
| 4595 | |
| 4596 | if (!status.ok()) { |
| 4597 | LOG(ERROR) << "Unable to register MIOpen factory: " |
| 4598 | << status.error_message(); |
| 4599 | } |
| 4600 | |
| 4601 | PluginRegistry::Instance()->SetDefaultFactory( |
| 4602 | rocm::kROCmPlatformId, PluginKind::kDnn, gpu::kMIOpenPlugin); |
| 4603 | } |
| 4604 | } |
| 4605 | |
| 4606 | } // namespace stream_executor |
| 4607 |
no test coverage detected