Relax mmap read requirement. Improve error message.#781
Merged
rapids-bot[bot] merged 5 commits intorapidsai:branch-25.10from Jul 25, 2025
Merged
Relax mmap read requirement. Improve error message.#781rapids-bot[bot] merged 5 commits intorapidsai:branch-25.10from
rapids-bot[bot] merged 5 commits intorapidsai:branch-25.10from
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
3 tasks
madsbk
approved these changes
Jul 25, 2025
Member
madsbk
left a comment
There was a problem hiding this comment.
Looks good, I only have a minor style suggestion
cpp/src/mmap.cpp
Outdated
| auto actual_size = size.has_value() ? size.value() : _file_size - offset; | ||
| KVIKIO_EXPECT(actual_size > 0, "Read size must be greater than 0", std::invalid_argument); | ||
|
|
||
| ss.str(""); |
Contributor
Author
There was a problem hiding this comment.
Done. Once the C++20 build issue was solved (#749), I'll clean up the repo a bit using std::format.
Contributor
Author
|
/merge |
rapids-bot bot
pushed a commit
to rapidsai/cudf
that referenced
this pull request
Aug 25, 2025
### Background Libcudf 25.04 and earlier use `memory_mapped_source` by default. For host read it uses memory mmaped I/O, and for device read it uses standard I/O. Libcudf 25.06 uses standard I/O by default. For host read, `memory_mapped_source` still uses memory mmaped I/O, while the device read is no longer allowed (runtime exception if used). Parquet/ORC readers fall back to the host read + H2D copy to emulate device read for the mapped source. ### This PR Now that the file-backed memory mapping (C++) is supported by KvikIO (rapidsai/kvikio#740), this PR updates libcudf to reinvigorate `memory_mapped_source` using KvikIO's implementation. This re-enables device read and brings performance improvement (e.g. through parallel prefault). ### Notes `memory_mapped_source` is an implementation detail in `datasource.cpp`. Currently testing was conducted on C2C (arm) and PCIe (x86) systems by manually setting `LIBCUDF_MMAP_ENABLED=ON` and running the tests. Refer to rapidsai/kvikio#530 (comment) for benchmark results. ### Dependency This PR depends on KvikIO PR rapidsai/kvikio#781 to fix unit test errors. Authors: - Tianyu Liu (https://github.com/kingcrimsontianyu) - Vukasin Milovanovic (https://github.com/vuule) Approvers: - Vukasin Milovanovic (https://github.com/vuule) URL: #19164
galipremsagar
pushed a commit
to galipremsagar/cudf
that referenced
this pull request
Aug 27, 2025
…9164) ### Background Libcudf 25.04 and earlier use `memory_mapped_source` by default. For host read it uses memory mmaped I/O, and for device read it uses standard I/O. Libcudf 25.06 uses standard I/O by default. For host read, `memory_mapped_source` still uses memory mmaped I/O, while the device read is no longer allowed (runtime exception if used). Parquet/ORC readers fall back to the host read + H2D copy to emulate device read for the mapped source. ### This PR Now that the file-backed memory mapping (C++) is supported by KvikIO (rapidsai/kvikio#740), this PR updates libcudf to reinvigorate `memory_mapped_source` using KvikIO's implementation. This re-enables device read and brings performance improvement (e.g. through parallel prefault). ### Notes `memory_mapped_source` is an implementation detail in `datasource.cpp`. Currently testing was conducted on C2C (arm) and PCIe (x86) systems by manually setting `LIBCUDF_MMAP_ENABLED=ON` and running the tests. Refer to rapidsai/kvikio#530 (comment) for benchmark results. ### Dependency This PR depends on KvikIO PR rapidsai/kvikio#781 to fix unit test errors. Authors: - Tianyu Liu (https://github.com/kingcrimsontianyu) - Vukasin Milovanovic (https://github.com/vuule) Approvers: - Vukasin Milovanovic (https://github.com/vuule) URL: rapidsai#19164
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
cuDF PR rapidsai/cudf#19164 currently has 4 failed unit tests when
LIBCUDF_MMAP_ENABLED=ON:The fix entails code changes on both the KvikIO and cuDF sides.
On the KvikIO side, the
MmapHandle::read()andMmapHandle::pread()methods need to:offsetto be equal toinitial_map_offset(when the read size is 0)This PR makes this change. In addition, this PR adds more detailed error messages when out-of-range exception occurs.