From cc952b2b9234589daba28bf567ae6336b90f5294 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 4 Sep 2020 14:25:04 +0800 Subject: [PATCH] fix(rocm): fix rocm megdnntest sleep and a cut code GitOrigin-RevId: 26de5ca98b28bf93da5c3e9f30c0197eda6d9077 --- dnn/src/rocm/sleep/opr_impl.cpp | 2 +- src/core/impl/utils/persistent_cache.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dnn/src/rocm/sleep/opr_impl.cpp b/dnn/src/rocm/sleep/opr_impl.cpp index ce2a95210..71aa3c044 100644 --- a/dnn/src/rocm/sleep/opr_impl.cpp +++ b/dnn/src/rocm/sleep/opr_impl.cpp @@ -22,7 +22,7 @@ void SleepForwardImpl::exec() { double seconds = m_param.time; megdnn_assert(seconds > 0); auto hdl = static_cast(handle()); - sleep(hdl->stream(), hdl->device_prop().clockRate * 18.01 * seconds); + sleep(hdl->stream(), hdl->device_prop().clockRate * 1000 * seconds); } } // namespace rocm diff --git a/src/core/impl/utils/persistent_cache.cpp b/src/core/impl/utils/persistent_cache.cpp index ec6651e86..98e3dc2ad 100644 --- a/src/core/impl/utils/persistent_cache.cpp +++ b/src/core/impl/utils/persistent_cache.cpp @@ -121,6 +121,17 @@ std::string PersistentCache::make_category_from_comp_node(CompNode comp_node) { prop.name, prop.major, prop.minor, drv, cuda_rt); break; } +#endif +#if MGB_ROCM + case CompNode::DeviceType::ROCM: { + int drv = -1, hip_rt = -1; + MGB_ROCM_CHECK(hipDriverGetVersion(&drv)); + MGB_ROCM_CHECK(hipRuntimeGetVersion(&hip_rt)); + auto&& prop = env.rocm_env().device_prop; + return ssprintf("plat=rocm;dev=%s;cap=%d.%d,drv=%d;runtime=%d", + prop.name, prop.major, prop.minor, drv, hip_rt); + break; + } #endif case CompNode::DeviceType::CPU: return "plat=cpu"; -- GitLab