[FEA]: Explore pathfinder "scoped search" feature

未关闭
#1,038 10 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@rwgk 已经在做这个了。

开始于 2025年9月26日。

评估

这个 Issue 还没有评估数据。

描述

cuda.pathfinder feature P0

Problem to solve

The searches implemented in load_nvidia_dynamic_lib() and find_nvidia_header_directory() are completely independent from each other. For example, load_nvidia_dynamic_lib("nvrtc") might resolve to a site-packages path, while load_nvidia_dynamic_lib("nvJitLink") finds a Conda path, and find_nvidia_header_directory("nvvm") locates headers under /usr/local/cuda. This can lead to surprising inconsistencies and confusing behavior deep in the call stack.

Potential approach (with low maintenance as a goal in mind)

Core idea: Introduce the concept of a pivot library that defines the scope for all subsequent searches.

Here, package system means, for example:

  • /usr/local/cuda (or another "standard" CTK installation)
  • Conda (including pixi)
  • site-packages (wheels, PyPI)

How it would work in practice:

  • A client code author decides which library is most pivotal and loads it first.

  • search_scope = cuda.pathfinder.determine_search_scope(pivot_libname="nvrtc") — Loads the pivot library and returns it in a wrapper object.

  • loaded_dl = search_scope.load_nvidia_dynamic_lib("nvJitLink") — Only succeeds if the target library exists in the same package system, otherwise fails with a helpful error.

  • hdr_dir = search_scope.find_nvidia_header_directory("nvvm") — Similarly constrained to the same package system.

This design shifts responsibility for consistency to package managers, which already provide version alignment via pinning. We avoid duplicating those mechanisms and instead ensure our tooling surfaces clear, consistent results.

主要语言
Cython
星标
3.4k
派生
329
平均合并
1 天 21 小时
30 天内合并 PR
113

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/cuda-python 的其他 Issue

查看 NVIDIA/cuda-python 的全部 Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。