From bb5e18c29c8ed3c02ae79f554c85a5508816ed61 Mon Sep 17 00:00:00 2001 From: Jiaming Yuan Date: Sat, 22 Oct 2022 23:13:28 +0800 Subject: [PATCH] Fix CUDA async stream. (#8380) --- src/objective/adaptive.cu | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/objective/adaptive.cu b/src/objective/adaptive.cu index aa01370b05fa..f77f4a4a858b 100644 --- a/src/objective/adaptive.cu +++ b/src/objective/adaptive.cu @@ -67,6 +67,10 @@ void EncodeTreeLeafDevice(Context const* ctx, common::Span pos auto pinned = pinned_pool.GetSpan(sizeof(size_t) + sizeof(bst_node_t)); dh::CUDAStream copy_stream; size_t* h_num_runs = reinterpret_cast(pinned.subspan(0, sizeof(size_t)).data()); + + dh::CUDAEvent e; + e.Record(dh::DefaultStream()); + copy_stream.View().Wait(e); // flag for whether there's ignored position bst_node_t* h_first_unique = reinterpret_cast(pinned.subspan(sizeof(size_t), sizeof(bst_node_t)).data());