[FEA]Expose a pooled pinned host memory resource in the C API
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start from the existing host allocation pair cuvsRMMHostAlloc / cuvsRMMHostFree in the C API and from the device-side cuvsRMMPoolMemoryResourceEnable, which is the pattern to copy for the new Enable/Disable functions. Then read the regenerated Rust bindings in cuvs-sys (bindings.rs). Done means the two new functions exist, the alloc/free calls route through a mutex-protected process-wide pinned pool when enabled, and the default path is unchanged.
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
In C++, pinned host memory can be pooled by composing RMM resources
(pool_memory_resource over pinned_host_memory_resource). The C API has no equivalent. It only
offers cuvsRMMHostAlloc / cuvsRMMHostFree, which bypass any pool and perform one cudaMallocHost /
cudaFreeHost per call. Callers that reach cuVS through the C API, including the language bindings
(Rust, Python, Go, Java), cannot get a pinned host pool, and must register memory themselves or write
their own allocator.
The device side already exposes a pooled resource through cuvsRMMPoolMemoryResourceEnable. This
proposes the host-side counterpart.
Describe the solution you'd like
Add a process-wide pinned host pool to the C API:
cuvsError_t cuvsRMMPinnedHostPoolEnable(size_t pool_size_bytes);
cuvsError_t cuvsRMMPinnedHostPoolDisable();
cuvsRMMPinnedHostPoolEnable(pool_size_bytes)creates onepool_memory_resourceover
pinned_host_memory_resource, with initial size == maximum size, so the pinning cost is paid once, up
front.- While the pool is enabled,
cuvsRMMHostAlloc/cuvsRMMHostFreeuse it. If the pool is exhausted,
cuvsRMMHostAllocreturns an error and does not fall back silently, so the caller decides what to do. - The pool is held process-wide (mutex-protected) rather than
thread_local. A pool is stateful, so a
per-thread pool would multiply the pinned memory by the number of threads, and memory freed on a
different thread than the one that allocated it would be returned to the wrong pool. - With the pool disabled (the default), behaviour is unchanged: one
cudaMallocHostper call.
Regenerated Rust bindings in cuvs-sys (bindings.rs).
Because the pool is opt-in, these costs only apply to callers that enable it:
- Pinning cost.
Enablepins the whole pool up front, which we measured at about 0.3 s per GiB, so the
pool should be sized to the peak amount in use at once.
Describe alternatives you've considered
- Change
cuvsRMMHostAllocinternally, with no new function. The caller then cannot choose the pool
size, and existing callers would start holding pinned memory for the life of the process. We prefer an
explicit opt-in function. - Expose the C++ API only. C API users and the bindings still cannot reach it.
Additional context
We have a working patch (C API + Rust bindings) and will open a new PR.
- 主要语言
- Cuda
- 星标
- 902
- 派生
- 267
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 57
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/cuvs 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
[BUG] CAGRA multi-CTA and multi-kernel search over-allocate the hashmap they use可能已有人在做 @mc8max 于 12 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
[BUG] cuVS Bench Faiss CAGRA b_ratio reads the wrong JSON key可能已有人在做 @arcusbuilds 于 55 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
doc
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Upgrade faiss to v1.16.0可能已有人在做 @aamijar 于 8 天前认领。 未关闭faiss improvement
难度 1/5 1 小时以内 新手友好度 86/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
vllm-project/vllm#70030 ·
维护者通常 1 天内回复
-
help wanted small extra
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
t: bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
Retry an empty final answer when Gemini reports MALFORMED_RESPONSE (gemini-4-hydrogen)可能已有人在做 @waleedkadous 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复