-
Notifications
You must be signed in to change notification settings - Fork 7
doc: High-level overview of the IO paths #250
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
Closed
Closed
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| IO Path | ||
| ======= | ||
|
|
||
| Currently, there are two IO paths in hipFile: the fastpath, where data is | ||
| transferred directly between the GPU and the storage device, and the fallback path, where | ||
| data is staged through a CPU bounce buffer. hipFile selects the path best suited | ||
| for each IO request based on the characteristics of the operation and the | ||
| capabilities of the underlying system. | ||
|
|
||
| Fastpath | ||
| -------- | ||
|
|
||
| If an IO request meets the criteria for the fastpath, data will be transferred | ||
| directly between the GPU and the storage device. The fastpath is the most | ||
| efficient path for IO requests that can use it, as it eliminates the overhead of | ||
| staging data through CPU memory. However, not all IO requests will be eligible | ||
| for the fastpath. | ||
|
|
||
| The following criteria must be met for the fastpath to be used for an IO request: | ||
| * The storage device backing the file must be able to perform peer-to-peer DMA directly to the GPU | ||
| * the filesystem backing the file must support direct IO | ||
| * the memory type of the buffer must be ``hipMemoryTypeDevice`` | ||
| * The IO operation's file offset, buffer offset, and size must satisfy direct IO | ||
| alignment requirements (see statx(2)). | ||
|
|
||
| When these criteria are met, the IO request uses hipFile's fastpath. The IO | ||
| request passes through HIP Runtime, ROCR Runtime, HSA, and THUNK layers before | ||
| being handled by the amdgpu kernel driver. The amdgpu driver validates the | ||
| request, pins the GPU buffer, and then submits the IO request to the virtual | ||
| filesystem layer. | ||
|
|
||
| Fallback Path | ||
| ------------- | ||
|
|
||
| If an IO request does not meet the criteria for the fastpath, hipFile uses the | ||
| fallback path. The fallback path stages IO requests through a CPU bounce buffer. | ||
| The fallback path is less efficient than the fastpath due to the additional data | ||
| copy between GPU and CPU memory, but it is universally supported for all device | ||
| memory IO requests regardless of file, buffer, or alignment characteristics. | ||
|
|
||
| In the case of a read operation, hipFile first reads data from the file into a | ||
| CPU buffer and then copies the CPU buffer into the GPU buffer. For a write | ||
| operation, hipFile first copies data from the GPU buffer into a CPU buffer and | ||
| then writes the CPU buffer to the file. | ||
Oops, something went wrong.
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.
fastpath or fast path?