From 4589a87bf166278a1a5985d8d6b1e385e0940213 Mon Sep 17 00:00:00 2001 From: fis Date: Sat, 22 Oct 2022 04:53:43 +0800 Subject: [PATCH] Fix CUDA async stream. --- 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());