[FEA]: Explore pathfinder "scoped search" feature

Aperta
#1,038 10 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@rwgk ci sta già lavorando.

Dal 26/9/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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.

Lingua principale
Cython
Stelle
3.4k
Fork
329
Merge medio
1g 21h
PR unite (30g)
113

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NVIDIA/cuda-python

Tutte le issue di NVIDIA/cuda-python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.