Skip to content

Commit bf21885

Browse files
ChuBoningit-is-a-robot
authored andcommitted
!14760 Expand kernel name string size
Merge pull request !14760 from chuboning/master
1 parent 6aae5c7 commit bf21885

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

torch_npu/csrc/framework/NPUDefine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace at_npu
7373
struct ExecuteParas
7474
{
7575
using PROCESS_FUNC = std::function<int()>;
76-
char opType[50]{};
76+
char opType[100]{};
7777
bool isJitDisable = false;
7878
ACL_PARAMS paras;
7979
CONST_PARAMS constParams;

torch_npu/csrc/framework/OpParamMaker.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,11 @@ class OpCommandImpl {
238238
// export op execute params
239239
void ExportParams(ExecuteParas &params)
240240
{
241-
TORCH_CHECK(sizeof(ExecuteParas::opType) >= opName.length() + 1, "Too long Ascend IR Name: ", opName,
242-
OPS_ERROR(ErrCode::PARAM));
243-
memset(params.opType, '\0', sizeof(params.opType));
244-
opName.copy(params.opType, opName.length() + 1);
241+
if (opName.length() + 1 < sizeof(ExecuteParas::opType)) {
242+
opName.copy(params.opType, opName.length() + 1);
243+
} else {
244+
opName.copy(params.opType, sizeof(ExecuteParas::opType) - 1);
245+
}
245246
params.attr = execParam.attr;
246247
// make params
247248
int inputNum = static_cast<int>(execParam.inDesc.size());

0 commit comments

Comments
 (0)