-
Notifications
You must be signed in to change notification settings - Fork 28
Adopt any_resource in BufferResource and RmmResourceAdaptor #772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
741df47
f3ad65c
b190afa
c61499c
a1e553a
747a677
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /** | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. | ||
| * SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
|
|
@@ -126,19 +126,19 @@ bool RmmResourceAdaptor::do_is_equal( | |
| if (cast == nullptr) { | ||
| return false; | ||
| } | ||
| // Manual comparison of optionals to avoid recursive constraint satisfaction in | ||
| // CCCL 3.2. std::optional::operator== triggers infinite concept checking when the | ||
| // wrapped type (rmm::device_async_resource_ref) inherits from CCCL's concept-based | ||
| // resource_ref. | ||
| // TODO: Revert this after the RMM resource ref types are replaced with | ||
| // plain cuda::mr ref types. This depends on | ||
| // https://github.com/rapidsai/rmm/issues/2011. | ||
| auto this_fallback = get_fallback_resource(); | ||
| auto other_fallback = cast->get_fallback_resource(); | ||
| bool fallbacks_equal = | ||
| (this_fallback.has_value() == other_fallback.has_value()) | ||
| && (!this_fallback.has_value() || (*this_fallback == *other_fallback)); | ||
| return get_upstream_resource() == cast->get_upstream_resource() && fallbacks_equal; | ||
| // Compare the owned any_resource members directly. | ||
| // Note: We must extract values from std::optional before comparing to avoid | ||
| // recursive constraint satisfaction in CCCL 3.2's concept checking when using | ||
| // std::optional::operator== with any_resource. | ||
| bool fallbacks_equal; | ||
| if (fallback_mr_.has_value() != cast->fallback_mr_.has_value()) { | ||
| fallbacks_equal = false; | ||
| } else if (!fallback_mr_.has_value()) { | ||
| fallbacks_equal = true; | ||
| } else { | ||
| fallbacks_equal = (*fallback_mr_ == *cast->fallback_mr_); | ||
| } | ||
|
Comment on lines
+133
to
+140
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer the old logic that initialises
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ll investigate but I think it was failing that way. |
||
| return (primary_mr_ == cast->primary_mr_) && fallbacks_equal; | ||
| } | ||
|
|
||
| } // namespace rapidsmpf | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why this "return
device_mr_asresource_refcannot be const?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s discuss on this RMM PR thread, it is the same question: rapidsai/rmm#2201 (comment)