已合并
remove dcache_lock_mix path #239
duanpengliang创建于 1月28日
remove dcache_lock_mix path #239
已合并
duanpengliang创建于 1月28日
20 个文件变更+140-41
Mscripts/package/module/ascend/RuntimeSo.xml+2-0
@@ -45,6 +45,8 @@
45 <file value="libhost_aicpu_scheduler.so" file_type="shared"/>45 <file value="libhost_aicpu_scheduler.so" file_type="shared"/>
46 <file value="libdatatransfer.so" file_type="shared" optional="true"/>46 <file value="libdatatransfer.so" file_type="shared" optional="true"/>
47 <file value="libindextransform.so" file_type="shared" optional="true"/>47 <file value="libindextransform.so" file_type="shared" optional="true"/>
48+ <file value="dcache_lock_mix_ascend950.o" file_type="shared" optional="true"/>
49+ <file value="dcache_lock_mix.o" file_type="shared" optional="true"/>
48 </file_info>50 </file_info>
49 <file_info value="runtime_devlib_device" copy_type="delivery" src_path="" dst_path="lib/device" install_path="$(TARGET_ENV)/devlib/device" install_mod="440">51 <file_info value="runtime_devlib_device" copy_type="delivery" src_path="" dst_path="lib/device" install_path="$(TARGET_ENV)/devlib/device" install_mod="440">
50 <file value="libc_sec.so" file_type="shared" install_softlink="$(TARGET_ENV)/lib64/device/lib64/libc_sec.so" optional="true"/>52 <file value="libc_sec.so" file_type="shared" install_softlink="$(TARGET_ENV)/lib64/device/lib64/libc_sec.so" optional="true"/>
Msrc/runtime/feature/inc/device/device_properties.h+5-5
@@ -131,10 +131,10 @@ enum class CheckArchVersionCompatibility : uint8_t {
131 Arch_Version_Compat_DEFAULT,131 Arch_Version_Compat_DEFAULT,
132};132};
133 133 
134-enum class DcacheLockMixPathSourceType : uint8_t {134+enum class DcacheLockMixType : uint8_t {
135- DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,135+ DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
136- DCACHE_LOCK_MIX_PATH_FROM_LIB,136+ DCACHE_LOCK_MIX_TYPE_FROM_910_B_93,
137- DCACHE_LOCK_MIX_PATH_FROM_ENV,137+ DCACHE_LOCK_MIX_TYPE_FROM_STARS_V2,
138};138};
139 139 
140enum class KernelFuncType : uint8_t {140enum class KernelFuncType : uint8_t {
@@ -274,7 +274,7 @@ struct DevProperties final {
274 bool opExecuteTimeout; // true for ms, false for s.274 bool opExecuteTimeout; // true for ms, false for s.
275 OMArchVersion omArchVersion;275 OMArchVersion omArchVersion;
276 CheckArchVersionCompatibility checkArchVersionCompatibility;276 CheckArchVersionCompatibility checkArchVersionCompatibility;
277- DcacheLockMixPathSourceType dcacheLockMixPathSourceType;277+ DcacheLockMixType dcacheLockMixType;
278 KernelFuncType kernelFuncType;278 KernelFuncType kernelFuncType;
279 bool taskPoolSizeFromMacroValue;279 bool taskPoolSizeFromMacroValue;
280 uint16_t taskPoolSize;280 uint16_t taskPoolSize;
Msrc/runtime/feature/platform/610_lite/dev_info_reg.cc+1-1
@@ -142,7 +142,7 @@ static const DevProperties CHIP_610LITE_PROPERTIES = {
142 .opExecuteTimeout = true,142 .opExecuteTimeout = true,
143 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,143 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
144 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,144 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
145- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,145+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
146 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,146 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
147 .taskPoolSizeFromMacroValue = false,147 .taskPoolSizeFromMacroValue = false,
148 .taskPoolSize = 0U,148 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/910_96/dev_info_reg.cc+1-1
@@ -183,7 +183,7 @@ static const DevProperties CHIP_CLOUD_V5_PROPERTIES = {
183 .opExecuteTimeout = false,183 .opExecuteTimeout = false,
184 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,184 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
185 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,185 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
186- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,186+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
187 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,187 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,
188 .taskPoolSizeFromMacroValue = true,188 .taskPoolSizeFromMacroValue = true,
189 .taskPoolSize = 0U,189 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/910_B_93/dev_info_reg.cc+1-1
@@ -232,7 +232,7 @@ static const DevProperties CHIP_CLOUD_V2_PROPERTIES = {
232 .opExecuteTimeout = false,232 .opExecuteTimeout = false,
233 .omArchVersion = OMArchVersion::omArchVersion_4,233 .omArchVersion = OMArchVersion::omArchVersion_4,
234 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_V220,234 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_V220,
235- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_LIB,235+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_910_B_93,
236 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,236 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,
237 .taskPoolSizeFromMacroValue = true,237 .taskPoolSizeFromMacroValue = true,
238 .taskPoolSize = 0U,238 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/950/dev_info_reg.cc+1-1
@@ -277,7 +277,7 @@ static const DevProperties CHIP_DAVID_PROPERTIES = {
277 .opExecuteTimeout = false,277 .opExecuteTimeout = false,
278 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,278 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
279 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,279 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
280- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_ENV,280+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_STARS_V2,
281 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,281 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,
282 .taskPoolSizeFromMacroValue = true,282 .taskPoolSizeFromMacroValue = true,
283 .taskPoolSize = 0U,283 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/adc/dev_info_reg.cc+1-1
@@ -143,7 +143,7 @@ static const DevProperties CHIP_ADC_PROPERTIES = {
143 .opExecuteTimeout = true,143 .opExecuteTimeout = true,
144 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,144 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
145 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,145 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
146- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,146+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
147 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,147 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
148 .taskPoolSizeFromMacroValue = false,148 .taskPoolSizeFromMacroValue = false,
149 .taskPoolSize = 0U,149 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/as31xm1/dev_info_reg.cc+1-1
@@ -153,7 +153,7 @@ static const DevProperties CHIP_AS31XM1_PROPERTIES = {
153 .opExecuteTimeout = false,153 .opExecuteTimeout = false,
154 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,154 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
155 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,155 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
156- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,156+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
157 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,157 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
158 .taskPoolSizeFromMacroValue = false,158 .taskPoolSizeFromMacroValue = false,
159 .taskPoolSize = 0U,159 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/cloud/dev_info_reg.cc+1-1
@@ -163,7 +163,7 @@ static const DevProperties CHIP_CLOUD_PROPERTIES = {
163 .opExecuteTimeout = false,163 .opExecuteTimeout = false,
164 .omArchVersion = OMArchVersion::omArchVersion_3,164 .omArchVersion = OMArchVersion::omArchVersion_3,
165 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_V100,165 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_V100,
166- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,166+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
167 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,167 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
168 .taskPoolSizeFromMacroValue = false,168 .taskPoolSizeFromMacroValue = false,
169 .taskPoolSize = 2048U,169 .taskPoolSize = 2048U,
Msrc/runtime/feature/platform/dc/dev_info_reg.cc+1-1
@@ -174,7 +174,7 @@ static const DevProperties CHIP_DC_PROPERTIES = {
174 .opExecuteTimeout = false,174 .opExecuteTimeout = false,
175 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,175 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
176 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,176 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
177- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,177+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
178 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,178 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
179 .taskPoolSizeFromMacroValue = false,179 .taskPoolSizeFromMacroValue = false,
180 .taskPoolSize = 1024U,180 .taskPoolSize = 1024U,
Msrc/runtime/feature/platform/kirin9030/dev_info_reg.cc+1-1
@@ -116,7 +116,7 @@ static const DevProperties CHIP_KIRIN9030_PROPERTIES = {
116 .opExecuteTimeout = false,116 .opExecuteTimeout = false,
117 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,117 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
118 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,118 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
119- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_LIB,119+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
120 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,120 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,
121 .taskPoolSizeFromMacroValue = true,121 .taskPoolSizeFromMacroValue = true,
122 .taskPoolSize = 0U,122 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/kirinx90/dev_info_reg.cc+1-1
@@ -116,7 +116,7 @@ static const DevProperties CHIP_KIRINX90_PROPERTIES = {
116 .opExecuteTimeout = false,116 .opExecuteTimeout = false,
117 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,117 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
118 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,118 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
119- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_LIB,119+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
120 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,120 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,
121 .taskPoolSizeFromMacroValue = true,121 .taskPoolSizeFromMacroValue = true,
122 .taskPoolSize = 0U,122 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/mc62cm12a/dev_info_reg.cc+1-1
@@ -174,7 +174,7 @@ static const DevProperties CHIP_MC62CM12A_PROPERTIES = {
174 .opExecuteTimeout = false,174 .opExecuteTimeout = false,
175 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,175 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
176 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,176 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
177- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,177+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
178 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,178 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_SUPP_AICORE,
179 .taskPoolSizeFromMacroValue = true,179 .taskPoolSizeFromMacroValue = true,
180 .taskPoolSize = 0U,180 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/mini/dev_info_reg.cc+1-1
@@ -114,7 +114,7 @@ static const DevProperties CHIP_MINI_PROPERTIES = {
114 .opExecuteTimeout = false,114 .opExecuteTimeout = false,
115 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,115 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
116 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,116 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
117- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,117+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
118 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,118 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
119 .taskPoolSizeFromMacroValue = false,119 .taskPoolSizeFromMacroValue = false,
120 .taskPoolSize = 0U,120 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/mini_v3/dev_info_reg.cc+1-1
@@ -156,7 +156,7 @@ static const DevProperties CHIP_MINI_V3_PROPERTIES = {
156 .opExecuteTimeout = false,156 .opExecuteTimeout = false,
157 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,157 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
158 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,158 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
159- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,159+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
160 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,160 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
161 .taskPoolSizeFromMacroValue = false,161 .taskPoolSizeFromMacroValue = false,
162 .taskPoolSize = 0U,162 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/nano/dev_info_reg.cc+1-1
@@ -135,7 +135,7 @@ static const DevProperties CHIP_NANO_PROPERTIES = {
135 .opExecuteTimeout = false,135 .opExecuteTimeout = false,
136 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,136 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
137 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,137 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
138- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,138+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
139 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,139 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
140 .taskPoolSizeFromMacroValue = false,140 .taskPoolSizeFromMacroValue = false,
141 .taskPoolSize = 0U,141 .taskPoolSize = 0U,
Msrc/runtime/feature/platform/tiny/dev_info_reg.cc+1-1
@@ -135,7 +135,7 @@ static const DevProperties CHIP_5612_PROPERTIES = {
135 .opExecuteTimeout = false,135 .opExecuteTimeout = false,
136 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,136 .omArchVersion = OMArchVersion::omArchVersion_DEFAULT,
137 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,137 .checkArchVersionCompatibility = CheckArchVersionCompatibility::Arch_Version_Compat_DEFAULT,
138- .dcacheLockMixPathSourceType = DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_DEFAULT,138+ .dcacheLockMixType = DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_DEFAULT,
139 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,139 .kernelFuncType = KernelFuncType::Kernel_FUC_TYPE_OTHER_AICORE,
140 .taskPoolSizeFromMacroValue = false,140 .taskPoolSizeFromMacroValue = false,
141 .taskPoolSize = 0U,141 .taskPoolSize = 0U,
Msrc/runtime/feature/src/runtime.cc+47-21
@@ -10,6 +10,7 @@
10 10 
11#include "runtime.hpp"11#include "runtime.hpp"
12#include <fstream>12#include <fstream>
13+#include <dlfcn.h>
13#include "mmpa/mmpa_api.h"14#include "mmpa/mmpa_api.h"
14#include "driver/ascend_hal.h"15#include "driver/ascend_hal.h"
15#include "api_impl.hpp"16#include "api_impl.hpp"
@@ -1130,10 +1131,32 @@ void Runtime::ParseHostCpuModelInfo()
1130 cpuModelFile.close();1131 cpuModelFile.close();
1131}1132}
1132 1133 
1133-static rtError_t GetDcacheLockMixPath(std::string &binaryPath)1134+static rtError_t GetDcacheLockMixPath(std::string& binaryPath, string binaryName)
1134{1135{
1136+ Dl_info info;
1137+ if (dladdr(reinterpret_cast<void*>(GetDcacheLockMixPath), &info) != 0 && info.dli_fname != nullptr) {
1138+ std::string soPath = info.dli_fname;
1139+ auto pos = soPath.find_last_of('/');
1140+ if (pos != std::string::npos) {
1141+ binaryPath = soPath.substr(0, pos) + binaryName;
1142+ std::ifstream file(binaryPath);
1143+ if (file.good()) {
1144+ file.close();
1145+ return RT_ERROR_NONE;
1146+ }
1147+ file.close();
1148+ }
1149+ }
1150+ return RT_ERROR_DEVICE_CHIPTYPE;
1151+}
1152+ 
1153+static rtError_t GetDavidDcacheLockMixPath(std::string& binaryPath)
1154+{
1155+ if (GetDcacheLockMixPath(binaryPath, "/dcache_lock_mix_ascend950.o") == RT_ERROR_NONE) {
1156+ return RT_ERROR_NONE;
1157+ }
1135 std::string libPath;1158 std::string libPath;
1136- const char_t *getPath = nullptr;1159+ const char_t* getPath = nullptr;
1137 MM_SYS_GET_ENV(MM_ENV_LD_LIBRARY_PATH, getPath);1160 MM_SYS_GET_ENV(MM_ENV_LD_LIBRARY_PATH, getPath);
1138 if (getPath == nullptr) {1161 if (getPath == nullptr) {
1139 RT_LOG(RT_LOG_ERROR, "getenv fail.");1162 RT_LOG(RT_LOG_ERROR, "getenv fail.");
@@ -1156,32 +1179,35 @@ static rtError_t GetDcacheLockMixPath(std::string &binaryPath)
1156 diff = find - findr;1179 diff = find - findr;
1157 }1180 }
1158 binaryPath = libPath.substr(findr + 1U, diff - 1U);1181 binaryPath = libPath.substr(findr + 1U, diff - 1U);
1159- binaryPath = binaryPath + "/ascend950/";1182+ binaryPath = binaryPath + "/ascend910_95/dcache_lock_mix.o";
1160- 1183+ RT_LOG(
1161- RT_LOG(RT_LOG_INFO, "path:%s, diff:%u, find:%u, findr:%u, npos:%u.", binaryPath.c_str(), diff, find, findr,1184+ RT_LOG_INFO, "path:%s, diff:%u, find:%u, findr:%u, npos:%u.", binaryPath.c_str(), diff, find, findr,
1162- libPath.npos);1185+ libPath.npos);
1163 return RT_ERROR_NONE;1186 return RT_ERROR_NONE;
1164}1187}
1165 1188 
1166-rtError_t Runtime::GetDcacheLockMixOpPath(std::string &dcacheLockMixOpPath) const1189+static void GetCloudV2DcacheLockMixPath(std::string& binaryPath)
1167{1190{
1191+ if (GetDcacheLockMixPath(binaryPath, "/dcache_lock_mix.o") == RT_ERROR_NONE) {
1192+ return;
1193+ }
1168 std::string libPath;1194 std::string libPath;
1195+ if (GetDriverPath(libPath)) {
1196+ binaryPath = libPath + "/driver/lib64/common/dcache_lock_mix.o";
1197+ } else {
1198+ binaryPath = "/usr/local/Ascend/driver/lib64/common/dcache_lock_mix.o";
1199+ }
1200+}
1201+ 
1202+rtError_t Runtime::GetDcacheLockMixOpPath(std::string& dcacheLockMixOpPath) const
1203+{
1169 DevProperties prop;1204 DevProperties prop;
1170 rtError_t ret = GET_DEV_PROPERTIES(chipType_, prop);1205 rtError_t ret = GET_DEV_PROPERTIES(chipType_, prop);
1171 COND_RETURN_ERROR_MSG_INNER(ret != RT_ERROR_NONE, ret, "GetDevProperties failed.");1206 COND_RETURN_ERROR_MSG_INNER(ret != RT_ERROR_NONE, ret, "GetDevProperties failed.");
1172- if (prop.dcacheLockMixPathSourceType == DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_LIB) {1207+ if (prop.dcacheLockMixType == DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_910_B_93) {
1173- if (GetDriverPath(libPath)) {1208+ GetCloudV2DcacheLockMixPath(dcacheLockMixOpPath);
1174- dcacheLockMixOpPath = libPath + "/driver/lib64/common/dcache_lock_mix.o";1209+ } else if (prop.dcacheLockMixType == DcacheLockMixType::DCACHE_LOCK_MIX_TYPE_FROM_STARS_V2) {
1175- } else {1210+ GetDavidDcacheLockMixPath(dcacheLockMixOpPath);
1176- dcacheLockMixOpPath = "/usr/local/Ascend/driver/lib64/common/dcache_lock_mix.o";
1177- }
1178- } else if (prop.dcacheLockMixPathSourceType == DcacheLockMixPathSourceType::DCACHE_LOCK_MIX_PATH_FROM_ENV) {
1179- const rtError_t ret = GetDcacheLockMixPath(libPath);
1180- if (ret != RT_ERROR_NONE) {
1181- RT_LOG(RT_LOG_WARNING, "get env fail.");
1182- return ret;
1183- }
1184- dcacheLockMixOpPath = libPath + "dcache_lock_mix.o";
1185 } else {1211 } else {
1186 return RT_ERROR_DEVICE_CHIPTYPE;1212 return RT_ERROR_DEVICE_CHIPTYPE;
1187 }1213 }
@@ -1229,7 +1255,7 @@ void Runtime::FindDcacheLockOp()
1229 dcacheLockMixOpData_.clear();1255 dcacheLockMixOpData_.clear();
1230 return;1256 return;
1231 }1257 }
1232- 1258+
1233 RT_LOG(RT_LOG_INFO, "read dcache lock op file success");1259 RT_LOG(RT_LOG_INFO, "read dcache lock op file success");
1234 return;1260 return;
1235}1261}
Mtests/ut/runtime/runtime/test/platform/910B/rt_utest_runtime.cc+51-0
@@ -22,6 +22,7 @@
22#include "platform/platform_info.h"22#include "platform/platform_info.h"
23#include "soc_info.h"23#include "soc_info.h"
24#include "thread_local_container.hpp"24#include "thread_local_container.hpp"
25+#include <dlfcn.h>
25 26 
26#undef private27#undef private
27 28 
@@ -632,4 +633,54 @@ TEST_F(CloudV2RuntimeTest, MacroInitCloudV2)
632 GlobalMockObject::reset();633 GlobalMockObject::reset();
633 // Restore to the initial system value634 // Restore to the initial system value
634 rtInstance->MacroInit(CHIP_910_B_93);635 rtInstance->MacroInit(CHIP_910_B_93);
636+}
637+ 
638+TEST_F(CloudV2RuntimeTest, ut_GetDcacheLockMixPath_CloudV2_FileExistsInSoDir) {
639+ std::string currentExePath;
640+ Dl_info info;
641+ if (dladdr(reinterpret_cast<void*>(this), &info) && info.dli_fname != nullptr) {
642+ currentExePath = info.dli_fname;
643+ } else {
644+ currentExePath = "/proc/self/exe"; // fallback on Linux
645+ char buf[1024];
646+ ssize_t len = readlink(currentExePath.c_str(), buf, sizeof(buf)-1);
647+ if (len != -1) {
648+ buf[len] = '\0';
649+ currentExePath = buf;
650+ }
651+ }
652+ 
653+ size_t lastSlash = currentExePath.find_last_of('/');
654+ std::string dir = (lastSlash != std::string::npos) ? currentExePath.substr(0, lastSlash + 1) : "./";
655+ std::string targetFile = dir + "dcache_lock_mix.o";
656+ // 创建文件
657+ std::ofstream file(targetFile);
658+ file.close();
659+ 
660+ // 执行测试
661+ Runtime* rtInstance = (Runtime*)Runtime::Instance();
662+ std::string binaryPath;
663+ rtError_t ret = rtInstance->GetDcacheLockMixOpPath(binaryPath);
664+ 
665+ size_t pos;
666+ while ((pos = binaryPath.find("//")) != std::string::npos) {
667+ binaryPath.replace(pos, 2, "/");
668+ }
669+ 
670+ // 清理
671+ std::remove(targetFile.c_str());
672+ 
673+ EXPECT_EQ(ret, RT_ERROR_NONE);
674+ EXPECT_EQ(binaryPath, targetFile);
675+}
676+ 
677+TEST_F(CloudV2RuntimeTest, ut_GetDcacheLockMixPath_CloudV2_FileNotExists_UseFallback) {
678+ std::string fallbackPath = "/usr/local/Ascend/driver/lib64/common/dcache_lock_mix.o";
679+ 
680+ Runtime* rtInstance = (Runtime*)Runtime::Instance();
681+ std::string binaryPath;
682+ rtError_t ret = rtInstance->GetDcacheLockMixOpPath(binaryPath);
683+ 
684+ EXPECT_EQ(ret, RT_ERROR_NONE);
685+ EXPECT_EQ(binaryPath, fallbackPath);
635}686}
Mtests/ut/runtime/runtime/test/platform/910_95/rt_utest_api_david.cc+20-0
@@ -9506,4 +9506,24 @@ TEST_F(ApiDavidTest, GROUP_INFO)
9506 rtGroupInfo_t groupInfo[count];9506 rtGroupInfo_t groupInfo[count];
9507 error = rtGetGroupInfo(-1, groupInfo, count);9507 error = rtGetGroupInfo(-1, groupInfo, count);
9508 EXPECT_EQ(error, ACL_ERROR_RT_FEATURE_NOT_SUPPORT);9508 EXPECT_EQ(error, ACL_ERROR_RT_FEATURE_NOT_SUPPORT);
9509+}
9510+ 
9511+TEST_F(ApiDavidTest, ut_GetDcacheLockMixPath_David_EnvPathValid) {
9512+ // 设置环境变量
9513+ const char* original = getenv("LD_LIBRARY_PATH");
9514+ setenv("LD_LIBRARY_PATH", "/some/path/runtime/lib64:other/path", 1);
9515+ 
9516+ Runtime* rtInstance = (Runtime*)Runtime::Instance();
9517+ std::string binaryPath;
9518+ rtError_t ret = rtInstance->GetDcacheLockMixOpPath(binaryPath);
9519+ 
9520+ // 恢复环境变量
9521+ if (original) {
9522+ setenv("LD_LIBRARY_PATH", original, 1);
9523+ } else {
9524+ unsetenv("LD_LIBRARY_PATH");
9525+ }
9526+ EXPECT_EQ(ret, RT_ERROR_NONE);
9527+ EXPECT_NE(binaryPath.find("ascend910_95/dcache_lock_mix.o"), std::string::npos);
9528+ EXPECT_NE(binaryPath.find("/some/path/runtime/lib64"), std::string::npos);
9509}9529}