-
Notifications
You must be signed in to change notification settings - Fork 260
Move more implementations to precompiled shared library (part 2) #1983
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7205263
Migrate error, exec_policy, logger to precompiled library.
bdice eb1c17a
Migrate prefetch to precompiled library.
bdice dff3450
Merge remote-tracking branch 'upstream/branch-25.08' into more-precom…
bdice d5665a6
Document exec_policy_nosync constructor
bdice 3778523
Add rapids-logger in host.
bdice 9074974
Remove PTDS logs.
bdice 8712a44
Merge branch 'branch-25.10' into more-precompilation
bdice File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright (c) 2020-2025, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <rmm/error.hpp> | ||
|
|
||
| #include <string> | ||
|
|
||
| namespace rmm { | ||
|
|
||
| bad_alloc::bad_alloc(const char* msg) : _what{std::string{std::bad_alloc::what()} + ": " + msg} {} | ||
|
|
||
| bad_alloc::bad_alloc(std::string const& msg) : bad_alloc{msg.c_str()} {} | ||
|
|
||
| const char* bad_alloc::what() const noexcept { return _what.c_str(); } | ||
|
|
||
| out_of_memory::out_of_memory(const char* msg) : bad_alloc{std::string{"out_of_memory: "} + msg} {} | ||
|
|
||
| out_of_memory::out_of_memory(std::string const& msg) : out_of_memory{msg.c_str()} {} | ||
|
|
||
| } // namespace rmm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright (c) 2020-2025, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <rmm/exec_policy.hpp> | ||
|
|
||
| namespace rmm { | ||
|
|
||
| exec_policy::exec_policy(cuda_stream_view stream, device_async_resource_ref mr) | ||
| : thrust_exec_policy_t( | ||
| thrust::cuda::par(mr::thrust_allocator<char>(stream, mr)).on(stream.value())) | ||
| { | ||
| } | ||
|
|
||
| exec_policy_nosync::exec_policy_nosync(cuda_stream_view stream, device_async_resource_ref mr) | ||
| : thrust_exec_policy_nosync_t( | ||
| thrust::cuda::par_nosync(mr::thrust_allocator<char>(stream, mr)).on(stream.value())) | ||
| { | ||
| } | ||
|
|
||
| } // namespace rmm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright (c) 2025, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <rmm/logger.hpp> | ||
|
|
||
| #include <cstdlib> | ||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| namespace rmm { | ||
|
|
||
| rapids_logger::sink_ptr default_sink() | ||
| { | ||
| auto* filename = std::getenv("RMM_DEBUG_LOG_FILE"); | ||
| if (filename != nullptr) { | ||
| return std::make_shared<rapids_logger::basic_file_sink_mt>(filename, true); | ||
| } | ||
| return std::make_shared<rapids_logger::stderr_sink_mt>(); | ||
| } | ||
|
|
||
| std::string default_pattern() { return "[%6t][%H:%M:%S:%f][%-6l] %v"; } | ||
|
|
||
| rapids_logger::logger& default_logger() | ||
| { | ||
| static rapids_logger::logger logger_ = [] { | ||
| rapids_logger::logger logger_{"RMM", {default_sink()}}; | ||
| logger_.set_pattern(default_pattern()); | ||
| return logger_; | ||
| }(); | ||
| return logger_; | ||
| } | ||
|
|
||
| } // namespace rmm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright (c) 2024-2025, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <rmm/prefetch.hpp> | ||
|
|
||
| #include <cuda_runtime_api.h> | ||
|
|
||
| namespace rmm { | ||
|
|
||
| void prefetch(void const* ptr, | ||
| std::size_t size, | ||
| rmm::cuda_device_id device, | ||
| rmm::cuda_stream_view stream) | ||
| { | ||
| auto result = cudaMemPrefetchAsync(ptr, size, device.value(), stream.value()); | ||
| // cudaErrorInvalidValue is returned when non-managed memory is passed to | ||
| // cudaMemPrefetchAsync. We treat this as a no-op. | ||
| if (result != cudaErrorInvalidValue && result != cudaSuccess) { RMM_CUDA_TRY(result); } | ||
| } | ||
|
|
||
| } // namespace rmm | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is it possible if the result is still
cudaErrorInvalidValuein the situations other than "non-managed memory is passed to"?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.
Prefetching is safe to ignore on errors like this. We aren't aware of any other situations that trigger this error, but even if there were, it's okay to do nothing.
(Also this is only code movement, not a change in the behavior or comments from what we had in the header before.)