diff --git a/sycl/include/sycl/reduction.hpp b/sycl/include/sycl/reduction.hpp index ddac3e9b4aca8..9916cd5c8ffd9 100644 --- a/sycl/include/sycl/reduction.hpp +++ b/sycl/include/sycl/reduction.hpp @@ -821,8 +821,9 @@ auto make_reduction(RedOutVar RedVar, RestTy &&...Rest) { namespace reduction { inline void finalizeHandler(handler &CGH) { CGH.finalize(); } template void withAuxHandler(handler &CGH, FunctorTy Func) { - CGH.finalize(); + event E = CGH.finalize(); handler AuxHandler(CGH.MQueue, CGH.MIsHost); + AuxHandler.depends_on(E); AuxHandler.saveCodeLoc(CGH.MCodeLoc); Func(AuxHandler); CGH.MLastEvent = AuxHandler.finalize();