Skip to content

Commit ac63e83

Browse files
author
luyuhong
committed
[CANN]:Replace aclrtMemsetSync with aclnnInplaceZero operator to create zero tensors more efficiently and consistently within the computation graph
1 parent 3a7ffd8 commit ac63e83

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

ggml/src/ggml-cann/aclnn_ops.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#include <aclnnop/aclnn_pow.h>
6868
#include <aclnnop/aclnn_grouped_matmul_v2.h>
6969
#include <aclnnop/aclnn_fused_infer_attention_score_v2.h>
70-
#include "aclnnop/aclnn_zero.h"
70+
#include <aclnnop/aclnn_zero.h>
7171
#include <float.h>
7272

7373
#include <cmath>
@@ -807,10 +807,9 @@ static aclTensor* aclnn_zero(ggml_backend_cann_context& ctx, void* buffer,
807807

808808
aclTensor* zero =
809809
ggml_cann_create_tensor(buffer, type, type_size, ne, nb, dims);
810-
811810
GGML_CANN_CALL_ACLNN_OP(ctx, InplaceZero, zero);
812-
813811
return zero;
812+
GGML_UNUSED(n_bytes);
814813
}
815814

816815
/**
@@ -837,7 +836,6 @@ static aclTensor* aclnn_values(ggml_backend_cann_context& ctx, void* buffer,
837836
float value = 1.0f) {
838837
aclTensor* acl_tensor =
839838
aclnn_zero(ctx, buffer, n_bytes, ne, dims, type, type_size);
840-
841839
float alpha_host = 1.0f;
842840
aclScalar* alpha = aclCreateScalar(&alpha_host, aclDataType::ACL_FLOAT);
843841
aclScalar* other = aclCreateScalar(&value, aclDataType::ACL_FLOAT);

0 commit comments

Comments
 (0)