+
    –°³j
  ã                   ó`   a € R	 t
0 t R t^ RIt^RIHt R
.tR R ltR R lt/ t] ^ k R R lt	R# )aà  Shared helpers for native ops backed by nvmath-python / cuSOLVER.

Centralizes nvmath availability checks, cuSOLVER version gating, and cuSOLVER
handle management so multiple native ops (e.g. linalg.polar, and upcoming
matmul-family ops) don't each reimplement them.

All functions here are import-light at module load (nvmath is only imported
inside the function bodies, lazily, on first use) so importing this module does
not pull in the nvmath/cuda runtime or initialize CUDA.
N)Ú_unavailable_reasonc                ó2   € V ^8„  d   QhR\         R,          /# ©é   ÚreturnN)Ústr)Úformats   "Ú[/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/_native/nvmath_utils.pyÚ__annotate__r
      s   € ÷ -ñ -¤3¨¥:ñ -ó    c                 ó    € \        \        4      # )z’Return a human-readable reason nvmath is unavailable, or None if present.

Does not import nvmath (uses importlib.util.find_spec under the hood).
)r   Ú_NVMATH_DEPS© r   r	   Únvmath_unavailable_reasonr      s   € ô
 œ|Ó,Ð,r   c                ó2   € V ^8„  d   QhR\         R,          /# r   )Úint)r   s   "r	   r
   r
      s   € ÷ ñ œ# �*ñ r   c                 óT   €  ^ RI Hp  V P                  4       #   \         d     R# i ; i)a«  cuSOLVER runtime version as major*1000 + minor*100 + patch, or None.

Queries cusolverGetVersion through nvmath, against the exact cuSOLVER
library nvmath dlopens (which is whatever the loader resolves -- the system
CUDA install or the nvidia-cu* wheels a torch build depends on). The encoded
value does not include the build number, so it can gate out runtimes that
lack a symbol entirely but cannot distinguish patch builds.
©ÚcusolverN)Únvmath.bindingsr   Úget_versionÚ	Exceptionr   s    r	   Úcusolver_versionr      s+   € ðÝ,à×#Ñ#Ó%Ð%øÜô Úðús   ‚ ˜'¦'c                óD   € V ^8„  d   QhR\         P                  R\        /# )r   Údevicer   )Útorchr   r   )r   s   "r	   r
   r
   :   s   € ÷ 
ñ 
¤§¡ð 
´ñ 
r   c                óü   € ^ RI Hp \        P                  V 4      pVfJ   \        P
                  P                  V 4      ;_uu_ 4        VP                  4       pRRR4       V\        V &   V#   + '       g   i     L; i)z7Return a cached cuSOLVER Dn handle bound to ``device``.)Ú
cusolverDnN)r   r   Ú_handlesÚgetr   Úcudar   Úcreate)r   ÚcsÚhandles   &  r	   Úget_cusolver_handler$   :   sU   € å0ä�\‰\˜&Ó!€FØ‚~ä�Z‰Z×Ñ˜v×&Õ&Ø—Y‘Y“[ˆF÷ 'à!Œ�ÑØ€M÷ '×&ús   ÁA+Á+A;	c                óv   € V ^8„  d   Qh/ ^ \         9   d%   \        \        P                  \        3,          ;R&   # )r   r   )Ú__conditional_annotations__Údictr   r   r   )r   s   "r	   r
   r
      s.   € ÷ 	ñ 	÷l 'Ò &Œ$Œu�|‰|œSÐ Õ
!Ñ &òm	r   )znvmath-pythonznvmath.bindings)r&   Ú__doc__r   Úcommon_utilsr   r   r   r   r   r$   r
   )r&   s   @r	   Ú<module>r*      s8   øðö	ó å -ð
 )ð€õ
-õð0 %'€Ó &÷
r   