[BUG]: system.Device.bar1_memory_info.reserved raises AttributeError on None
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- Une demi-journée
- Accessibilité débutants
- 62/100
Piste de recherche
Start by reading cuda_core/cuda/core/system/_memory.pxi around lines 36-51, where MemoryInfo._memory_info and its reserved getter live, then look at BAR1MemoryInfo in the same file to see the shadowing slot. Reproduce with the snippet in the issue to confirm bar1.reserved raises while total/free/used work. The fix is one of the two options the reporter lists (drop the inheritance or override reserved with a clear error) plus removing the duplicate slot; done means the repro prints or raises a documented exception and existing memory-info tests still pass.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
Type of Bug
Runtime Error
Component
cuda.core
Describe the bug
BAR1MemoryInfo subclasses MemoryInfo but declares its own cdef object _memory_info. The subclass methods use the new slot. The reserved property it inherits from MemoryInfo reads the base class's slot, which is never set. So Device.bar1_memory_info.reserved exists (it's in dir(), and isinstance(bar1, MemoryInfo) is true) but raises an internal AttributeError on None:
Code that handles a MemoryInfo generically (for example, logging total/used/free/reserved for both memory_info and bar1_memory_info) crashes on the BAR1 object.
How to Reproduce
from cuda.core import system
dev = system.Device(index=0)
bar1 = dev.bar1_memory_info
print(type(bar1).__mro__)
print("total:", bar1.total, "free:", bar1.free, "used:", bar1.used)
print("reserved:", bar1.reserved)
Output:
(<class 'cuda.core.system._device.BAR1MemoryInfo'>, <class 'cuda.core.system._device.MemoryInfo'>, <class 'object'>)
total: 8589934592 free: 8589934592 used: 0
Traceback (most recent call last):
File "repro.py", line 7, in <module>
print("reserved:", bar1.reserved)
^^^^^^^^^^^^^
File "cuda/core/system/_memory.pxi", line 41, in cuda.core.system._device.MemoryInfo.reserved.__get__
AttributeError: 'NoneType' object has no attribute 'reserved'
Expected behavior
BAR1MemoryInfo shouldn't expose a reserved attribute that can only crash. nvmlBAR1Memory_t has no reserved field, so either BAR1MemoryInfo stops inheriting from MemoryInfo, or it overrides reserved with a clear NotSupportedError/AttributeError. Either way, the shadowed _memory_info slot should go.
Operating System
Linux container (python:3.12-slim) on Windows 11 / WSL2 with the NVIDIA container runtime. The bug is in the Cython class layout, so the OS shouldn't matter.
nvidia-smi output
| NVIDIA-SMI 610.59 KMD Version: 610.91 CUDA UMD Version: 13.3 |
| 0 NVIDIA GeForce RTX 3050 ... On | 00000000:01:00.0 Off | N/A |
Python 3.12.16. Packages:
cuda-bindings 13.5.0
cuda-core 1.3.0
cuda-pathfinder 1.9.0
cuda-toolkit 13.5.0
cupy-cuda13x 14.2.0
numpy 2.5.4
nvidia-cuda-nvrtc 13.5.37
nvidia-cufile 1.20.0.107
nvidia-nvfatbin 13.5.37
nvidia-nvjitlink 13.5.37
nvidia-nvvm 13.5.37
The file is unchanged between cuda-core-v1.3.0 and current main (ba7dcd0).
Happy to send a fix if that helps.
- Langage dominant
- Cython
- Étoiles
- 3.4k
- Forks
- 353
- Merge moyen
- 2 j 3 h
- PR mergées (30 j)
- 163
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NVIDIA/cuda-python
-
[BUG]: the `__cuda_stream__` deprecation warning points to `Stream(obj)`, which always raisesPeut-être pris @Iamsohungrynow l’a pris il y a 5 jours. Ouvertebug cuda.core P1
Difficulté 1/5 Moins d'une heure Accessibilité débutants 86/100
NVIDIA/cuda-python#3505 · 3 commentaires · 1 réaction · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: ProcessInfo.used_gpu_memory returns the NVML_VALUE_NOT_AVAILABLE sentinel as a byte countOuvertetriage
Difficulté 2/5 1-3 heures Accessibilité débutants 80/100
NVIDIA/cuda-python#3468 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
triage
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
NVIDIA/cuda-python#3409 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: cleanup-pr-previews never removes previews of deleted PRsPeut-être à nouveau libre @rwgk l’a pris il y a 48 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
NVIDIA/cuda-python#2952 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG]: LocatedHeaderDir is mutable, so callers can poison the cached header-directory lookupPeut-être pris @rwgk l’a pris il y a 62 jours. Ouvertetriage
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
NVIDIA/cuda-python#2646 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de NVIDIA/cuda-python
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
vllm-project/vllm#70030 ·
Les mainteneurs répondent en général sous 1 jour
-
help wanted small extra
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
t: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 3 jours
-
Retry an empty final answer when Gemini reports MALFORMED_RESPONSE (gemini-4-hydrogen)Peut-être pris @waleedkadous l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
iaser-ai/ansari#444 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
Les mainteneurs répondent en général sous 1 jour