prefetch.hpp
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #pragma once
7 
9 
10 #include <rmm/device_uvector.hpp>
11 
12 #include <atomic>
13 
14 namespace CUDF_EXPORT cudf {
15 namespace prefetch {
16 
17 namespace detail {
18 
19 std::atomic_bool& enabled();
20 
21 std::atomic_bool& debug();
22 
31 void prefetch(void const* ptr,
32  std::size_t size,
33  rmm::cuda_stream_view stream,
35 
50 cudaError_t prefetch_noexcept(
51  void const* ptr,
52  std::size_t size,
53  rmm::cuda_stream_view stream,
54  rmm::cuda_device_id device_id = rmm::get_current_cuda_device()) noexcept;
55 
66 template <typename T>
67 void prefetch(rmm::device_uvector<T> const& v,
68  rmm::cuda_stream_view stream,
69  rmm::cuda_device_id device_id = rmm::get_current_cuda_device())
70 {
71  if (v.is_empty()) { return; }
72  prefetch(v.data(), v.size(), stream, device_id);
73 }
74 
75 } // namespace detail
76 
83 void enable() noexcept;
84 
88 void disable() noexcept;
89 
95 void enable_debugging() noexcept;
96 
102 void disable_debugging() noexcept;
103 
104 } // namespace prefetch
105 } // namespace CUDF_EXPORT cudf
cuda_device_id get_current_cuda_device()
void prefetch(void const *ptr, std::size_t size, rmm::cuda_device_id device, rmm::cuda_stream_view stream)
cuDF interfaces
Definition: host_udf.hpp:26