Skip to content

Commit de19f0a

Browse files
CANN: fix acl_rstd allocation size in ggml_cann_rms_norm
Fixes #15330 Adjust the allocation size of acl_rstd. The parameter `dims` is set to 3 according to the CANN documentation. Co-authored-by: Yuchuan <yuchuan-cao@users.noreply.github.com>
1 parent 8a2234e commit de19f0a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ggml/src/ggml-cann/aclnn_ops.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ void ggml_cann_rms_norm(ggml_backend_cann_context& ctx, ggml_tensor* dst) {
975975
);
976976

977977
// build rstd, zero...
978+
int64_t acl_rstd_ne[] = {src->ne[1], src->ne[2], src->ne[3]};
978979
size_t acl_rstd_nb[GGML_MAX_DIMS];
979980
acl_rstd_nb[0] = sizeof(float);
980981
for (int i = 1; i < GGML_MAX_DIMS; i++) {
@@ -984,9 +985,9 @@ void ggml_cann_rms_norm(ggml_backend_cann_context& ctx, ggml_tensor* dst) {
984985
ctx,
985986
&ctx.rms_norm_zero_tensor_cache.cache,
986987
ctx.rms_norm_zero_tensor_cache.size,
987-
src->ne,
988+
acl_rstd_ne,
988989
acl_rstd_nb,
989-
GGML_MAX_DIMS,
990+
GGML_MAX_DIMS - 1,
990991
0.0f // value
991992
);
992993

0 commit comments

Comments
 (0)