Skip to content

Commit

Permalink
remove impl namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
vuule committed Oct 1, 2024
1 parent d584fcc commit f6a9266
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
28 changes: 11 additions & 17 deletions cpp/include/cudf/detail/utilities/cuda_memcpy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@
namespace CUDF_EXPORT cudf {
namespace detail {

namespace impl {

enum class host_memory_kind : uint8_t { PINNED, PAGEABLE };

void cuda_memcpy_async(
void cuda_memcpy_async_impl(
void* dst, void const* src, size_t size, host_memory_kind kind, rmm::cuda_stream_view stream);

} // namespace impl

/**
* @brief Asynchronously copies data from host to device memory.
*
Expand All @@ -47,12 +43,11 @@ void cuda_memcpy_async(device_span<T> dst, host_span<T const> src, rmm::cuda_str
{
CUDF_EXPECTS(dst.size() == src.size(), "Mismatched sizes in cuda_memcpy_async");
auto const is_pinned = src.is_device_accessible();
impl::cuda_memcpy_async(
dst.data(),
src.data(),
src.size_bytes(),
is_pinned ? impl::host_memory_kind::PINNED : impl::host_memory_kind::PAGEABLE,
stream);
cuda_memcpy_async_impl(dst.data(),
src.data(),
src.size_bytes(),
is_pinned ? host_memory_kind::PINNED : host_memory_kind::PAGEABLE,
stream);
}

/**
Expand All @@ -69,12 +64,11 @@ void cuda_memcpy_async(host_span<T> dst, device_span<T const> src, rmm::cuda_str
{
CUDF_EXPECTS(dst.size() == src.size(), "Mismatched sizes in cuda_memcpy_async");
auto const is_pinned = dst.is_device_accessible();
impl::cuda_memcpy_async(
dst.data(),
src.data(),
src.size_bytes(),
is_pinned ? impl::host_memory_kind::PINNED : impl::host_memory_kind::PAGEABLE,
stream);
cuda_memcpy_async_impl(dst.data(),
src.data(),
src.size_bytes(),
is_pinned ? host_memory_kind::PINNED : host_memory_kind::PAGEABLE,
stream);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/utilities/cuda_memcpy.cu
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

#include <thrust/copy.h>

namespace cudf::detail::impl {
namespace cudf::detail {

namespace {

// Simple kernel to copy between device buffers
CUDF_KERNEL void copy_kernel(char const* src, char* dst, size_t n)
CUDF_KERNEL void copy_kernel(char const* __restrict__ src, char* __restrict__ dst, size_t n)
{
auto const idx = cudf::detail::grid_1d::global_thread_id();
if (idx < n) { dst[idx] = src[idx]; }
Expand Down Expand Up @@ -61,7 +61,7 @@ void copy_pageable(void* dst, void const* src, std::size_t size, rmm::cuda_strea

}; // namespace

void cuda_memcpy_async(
void cuda_memcpy_async_impl(
void* dst, void const* src, size_t size, host_memory_kind kind, rmm::cuda_stream_view stream)
{
if (kind == host_memory_kind::PINNED) {
Expand All @@ -73,4 +73,4 @@ void cuda_memcpy_async(
}
}

} // namespace cudf::detail::impl
} // namespace cudf::detail

0 comments on commit f6a9266

Please sign in to comment.