-
Notifications
You must be signed in to change notification settings - Fork 85
Expose cuFile stream register API to Python #893
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
rapids-bot
merged 9 commits into
rapidsai:main
from
kingcrimsontianyu:add-stream-reg-python-api
Jan 13, 2026
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
56dc2d0
Expose cuFile stream register API to Python
kingcrimsontianyu 20c6c9e
Add unit test
kingcrimsontianyu 18f48d5
Update test
kingcrimsontianyu 94548ca
Update
kingcrimsontianyu 56f207c
Update python/kvikio/kvikio/stream.py
kingcrimsontianyu f2a62fa
Update python/kvikio/kvikio/stream.py
kingcrimsontianyu c490cf2
Update stream parameter name
kingcrimsontianyu fabb3d1
Update stream parameter in cufile.py for better clarity
kingcrimsontianyu 67eeb09
Add NVTX annotation
kingcrimsontianyu 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # distutils: language = c++ | ||
| # cython: language_level=3 | ||
|
|
||
| from libc.stdint cimport uintptr_t | ||
|
|
||
|
|
||
| cdef extern from "cuda.h": | ||
| ctypedef void* CUstream | ||
|
|
||
|
|
||
| cdef extern from "<kvikio/stream.hpp>" nogil: | ||
| void cpp_stream_register "kvikio::stream_register"(CUstream stream, unsigned flags) except + | ||
| void cpp_stream_deregister "kvikio::stream_deregister"(CUstream stream) except + | ||
|
|
||
|
|
||
| def stream_register(stream: uintptr_t, flags: int) -> None: | ||
| cdef CUstream cpp_stream = <CUstream>stream | ||
| cdef unsigned int cpp_flags = flags | ||
| with nogil: | ||
| cpp_stream_register(cpp_stream, cpp_flags) | ||
|
|
||
|
|
||
| def stream_deregister(stream) -> None: | ||
| cdef CUstream cpp_stream = <CUstream>stream | ||
| with nogil: | ||
| cpp_stream_deregister(cpp_stream) |
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,30 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| from kvikio._lib import stream as stream_module # type: ignore | ||
|
|
||
|
|
||
| def stream_register(stream, flags: int) -> None: | ||
kingcrimsontianyu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """Registers the CUDA stream to the cuFile subsystem. | ||
| Parameters | ||
| ---------- | ||
| stream: | ||
| CUDA stream which queues the async I/O operations | ||
| flags: int | ||
| Specifies when the I/O parameters become valid (submission time or execution | ||
| time) and what I/O parameters are page-aligned. For details, refer to | ||
| https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html#cufilestreamregister | ||
| """ | ||
| stream_module.stream_register(stream, flags) | ||
|
|
||
|
|
||
| def stream_deregister(stream) -> None: | ||
kingcrimsontianyu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| """Deregisters the CUDA stream from the cuFile subsystem. | ||
| Parameters | ||
| ---------- | ||
| stream: | ||
| CUDA stream which queues the async I/O operations | ||
| """ | ||
| stream_module.stream_deregister(stream) | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.