hipFile: Limit IO size to MAX_RW_COUNT on fastpath#165
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses an ILLEGAL SEEK error that occurs when processing files larger than MAX_RW_COUNT (0x7ffff000 bytes) in the AIS fastpath. The fix limits IO operations to MAX_RW_COUNT, matching POSIX read/write behavior, and updates the aiscp example to handle large files through chunked transfers.
Changes:
- Limits IO size to MAX_RW_COUNT in the fastpath backend to prevent kernel driver errors
- Updates aiscp to perform chunk-based copying for files larger than MAX_RW_COUNT
- Adds handling for zero-size files in aiscp
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/amd_detail/backend/fastpath.cpp | Adds MAX_RW_COUNT size limitation to prevent ILLEGAL SEEK errors |
| test/amd_detail/fastpath.cpp | Adds test to verify IO size is properly truncated to MAX_RW_COUNT |
| examples/aiscp/aiscp.cpp | Implements chunked file copying with alignment support and zero-size file handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…oMaxRWCount Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| // Copy the file chunk-by-chunk until we hit EOF | ||
| do { | ||
| nread = hipFileRead(src_handle, devbuf, buffer_size, ncopy, 0); |
There was a problem hiding this comment.
ncopy is of type ssize_t and the parameter is an offset of type hoff_t, which is confusing. I would probably rename ncopy and use the correct type.
Reduce the rate at which we burn NVMe drives on CI systems.
Motivation
When testing aiscp with files larger than MAX_RW_COUNT amdgpu/kfd would return an ILLEGAL SEEK error. To address this, the AIS path (fastpath) will the limit IO size to MAX_RW_COUNT. This matches the behavior of POSIX read/write (see man pages).
aiscp is also updated to handle files larger than MAX_RW_COUNT.
Finally, since I was in the area, aiscp now handles files with zero size.
AIHIPFILE-111