Skip to content

Commit a0da2c4

Browse files
CANN: Switch to stream synchronization
Switch to stream synchronization because events are not effective. Co-authored-by: hipudding <[email protected]>
1 parent 5d6688d commit a0da2c4

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

ggml/src/ggml-cann/ggml-cann.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2092,16 +2092,7 @@ static bool ggml_backend_cann_cpy_tensor_async(
20922092
ACL_CHECK(aclrtMemcpyAsync(dst->data, copy_size, src->data, copy_size,
20932093
ACL_MEMCPY_DEVICE_TO_DEVICE,
20942094
cann_ctx_src->stream()));
2095-
2096-
// record event on src stream after the copy
2097-
if (!cann_ctx_src->copy_event) {
2098-
ACL_CHECK(aclrtCreateEventWithFlag(&cann_ctx_src->copy_event, ACL_EVENT_SYNC));
2099-
}
2100-
ACL_CHECK(aclrtRecordEvent(cann_ctx_src->copy_event, cann_ctx_src->stream()));
2101-
2102-
// wait on dst stream for the copy to complete
2103-
ggml_cann_set_device(cann_ctx_dst->device);
2104-
ACL_CHECK(aclrtStreamWaitEvent(cann_ctx_dst->stream(), cann_ctx_src->copy_event));
2095+
ACL_CHECK(aclrtSynchronizeStream(cann_ctx_src->stream()));
21052096
} else {
21062097
// src and dst are on the same backend
21072098
ACL_CHECK(aclrtMemcpyAsync(dst->data, copy_size, src->data, copy_size,

0 commit comments

Comments
 (0)