diff --git a/clang/runtime/dpct-rt/include/dpct/codepin/codepin.hpp b/clang/runtime/dpct-rt/include/dpct/codepin/codepin.hpp index f3382c7cf70e..99c845c0d18a 100644 --- a/clang/runtime/dpct-rt/include/dpct/codepin/codepin.hpp +++ b/clang/runtime/dpct-rt/include/dpct/codepin/codepin.hpp @@ -241,6 +241,7 @@ void gen_prolog_API_CP(const std::string &cp_id, template void gen_epilog_API_CP(const std::string &cp_id, queue_t queue, Args&&... args) { + synchronize(queue); std::string epilog_tag = cp_id + ":" + "epilog"; std::string event_id = cp_id + ":" + std::to_string(api_index[cp_id]);