Skip to content

Commit

Permalink
Merge branch 'branch-24.04' into python-3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Feb 26, 2024
2 parents 344288d + 1226ef0 commit 2b69b59
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
32 changes: 32 additions & 0 deletions include/rmm/resource_ref.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,43 @@ namespace rmm {
* @file
*/

/**
* @brief Alias for a `cuda::mr::resource_ref` with the property
* `cuda::mr::device_accessible`.
*/
using device_resource_ref = cuda::mr::resource_ref<cuda::mr::device_accessible>;

/**
* @brief Alias for a `cuda::mr::async_resource_ref` with the property
* `cuda::mr::device_accessible`.
*/
using device_async_resource_ref = cuda::mr::async_resource_ref<cuda::mr::device_accessible>;

/**
* @brief Alias for a `cuda::mr::resource_ref` with the property
* `cuda::mr::host_accessible`.
*/
using host_resource_ref = cuda::mr::resource_ref<cuda::mr::host_accessible>;

/**
* @brief Alias for a `cuda::mr::async_resource_ref` with the property
* `cuda::mr::host_accessible`.
*/
using host_async_resource_ref = cuda::mr::async_resource_ref<cuda::mr::host_accessible>;

/**
* @brief Alias for a `cuda::mr::resource_ref` with the properties
* `cuda::mr::host_accessible` and `cuda::mr::device_accessible`.
*/
using host_device_resource_ref =
cuda::mr::resource_ref<cuda::mr::host_accessible, cuda::mr::device_accessible>;

/**
* @brief Alias for a `cuda::mr::async_resource_ref` with the properties
* `cuda::mr::host_accessible` and `cuda::mr::device_accessible`.
*/
using host_device_async_resource_ref =
cuda::mr::async_resource_ref<cuda::mr::host_accessible, cuda::mr::device_accessible>;

/** @} */ // end of group
} // namespace rmm
5 changes: 3 additions & 2 deletions tests/mr/host/mr_ref_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <rmm/mr/host/host_memory_resource.hpp>
#include <rmm/mr/host/new_delete_resource.hpp>
#include <rmm/mr/host/pinned_memory_resource.hpp>
#include <rmm/resource_ref.hpp>

#include <cuda/memory_resource>
#include <cuda_runtime_api.h>
Expand Down Expand Up @@ -72,7 +73,7 @@ struct allocation {
template <typename MemoryResourceType>
struct MRRefTest : public ::testing::Test {
MemoryResourceType mr;
cuda::mr::resource_ref<cuda::mr::host_accessible> ref;
rmm::host_resource_ref ref;

MRRefTest() : mr{}, ref{mr} {}
};
Expand Down Expand Up @@ -248,7 +249,7 @@ TYPED_TEST(MRRefTest, UnsupportedAlignmentTest)
TEST(PinnedResource, isPinned)
{
rmm::mr::pinned_memory_resource mr;
cuda::mr::resource_ref<cuda::mr::host_accessible> ref{mr};
rmm::host_resource_ref ref{mr};
void* ptr{nullptr};
EXPECT_NO_THROW(ptr = ref.allocate(100));
EXPECT_TRUE(is_pinned_memory(ptr));
Expand Down

0 comments on commit 2b69b59

Please sign in to comment.