Browse Source

!13259 adapter profiling function with ascendcl lib

From: @ms_yan
Reviewed-by: 
Signed-off-by:
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
dcf57e7f61
3 changed files with 43 additions and 6 deletions
  1. +3
    -2
      mindspore/ccsrc/CMakeLists.txt
  2. +39
    -3
      mindspore/ccsrc/runtime/device/ascend/profiling/profiling_callback_register.cc
  3. +1
    -1
      tests/ut/cpp/stub/profiling/profiling_stub.cc

+ 3
- 2
mindspore/ccsrc/CMakeLists.txt View File

@@ -285,7 +285,8 @@ if(ENABLE_D)
${ASCEND_DRIVER_BACK_PATH})
find_library(DATATRANSFER datatransfer HINTS ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH}
${ASCEND_DRIVER_BACK_PATH})
find_library(PROFILING msprofiler_fwk ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(PROFILING msprofiler_fwkacl ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(ACL ascendcl ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(REGISTER register ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(PLATFORM platform ${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
find_library(OPTILING optiling ${ASCEND_OPP_PATH} ${ASCEND_TOOLKIT_OPP_PATH})
@@ -303,7 +304,7 @@ if(ENABLE_D)
mindspore::protobuf -Wl,--end-group)
target_link_libraries(mindspore ge_runtime ${CCE_LIB} ${RUNTIME_LIB} ${TSDCLIENT} ${HCCL} ${DATATRANSFER}
${HCCL_ADPTER} ${REGISTER} -Wl,--no-as-needed ${OPTILING} ${HCCL_BUILDER}
${HCCL_RA} ${PLATFORM})
${HCCL_RA} ${PLATFORM} ${ACL})
target_link_libraries(mindspore -Wl,--start-group proto_input mindspore::protobuf -Wl,--end-group)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
target_link_libraries(mindspore -Wl,--start-group proto_input mindspore::protobuf mindspore::sentencepiece


+ 39
- 3
mindspore/ccsrc/runtime/device/ascend/profiling/profiling_callback_register.cc View File

@@ -19,9 +19,9 @@

namespace Analysis {
namespace Dvvp {
namespace ProfilerCommon {
namespace ProfilerSpecial {
extern int32_t MsprofilerInit();
} // namespace ProfilerCommon
} // namespace ProfilerSpecial
} // namespace Dvvp
} // namespace Analysis

@@ -30,6 +30,42 @@ constexpr Status PROF_SUCCESS = 0;
constexpr Status PROF_FAILED = 0xFFFFFFFF;
} // namespace

int32_t _aclprofGetDeviceByModelId(uint32_t modelId, uint32_t &deviceId) { return 0; }

bool _aclprofGetInitFlag() { return true; }

int32_t _aclprofRegisterCtrlCallback(MsprofCtrlCallback callback) {
if (VMCallbackRegister::GetInstance().registered()) {
return VMCallbackRegister::GetInstance().DoRegProfCtrlCallback(callback);
} else {
return PROF_SUCCESS;
}
}

int32_t _aclprofRegisterSetDeviceCallback(MsprofSetDeviceCallback callback) {
if (VMCallbackRegister::GetInstance().registered()) {
return VMCallbackRegister::GetInstance().DoRegProfSetDeviceCallback(callback);
} else {
return PROF_SUCCESS;
}
}

int32_t _aclprofRegisterReporterCallback(MsprofReporterCallback callback) {
if (VMCallbackRegister::GetInstance().registered()) {
return VMCallbackRegister::GetInstance().DoRegProfReporterCallback(callback);
} else {
return PROF_SUCCESS;
}
}

int32_t _aclprofCommandHandle(uint32_t type, void *data, uint32_t len) {
if (VMCallbackRegister::GetInstance().registered()) {
return VMCallbackRegister::GetInstance().DoProfCommandHandle((ProfCommandHandleType)type, data, len);
} else {
return PROF_SUCCESS;
}
}

Status RegProfCtrlCallback(MsprofCtrlCallback func) {
if (VMCallbackRegister::GetInstance().registered()) {
return VMCallbackRegister::GetInstance().DoRegProfCtrlCallback(func);
@@ -87,7 +123,7 @@ bool VMCallbackRegister::Register(Status (*pRegProfCtrlCallback)(MsprofCtrlCallb

void VMCallbackRegister::ForceMsprofilerInit() {
if (!ms_profile_inited_) {
Analysis::Dvvp::ProfilerCommon::MsprofilerInit();
Analysis::Dvvp::ProfilerSpecial::MsprofilerInit();
ms_profile_inited_ = true;
}
}

+ 1
- 1
tests/ut/cpp/stub/profiling/profiling_stub.cc View File

@@ -51,6 +51,6 @@ void* ProfMgrStartUp(const ProfMgrCfg* cfg) { return const_cast<void*>(reinterpr
*/
int ProfMgrStop(void* handle) { return 0; }

namespace Analysis::Dvvp::ProfilerCommon {
namespace Analysis::Dvvp::ProfilerSpecial {
uint32_t MsprofilerInit() { return 0; }
}

Loading…
Cancel
Save