-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Related: nvbug 5932944
Situation
Currently (main @ eabaf4b) we have these enum explanations and related health checks :
-
cuda-python/cuda_core/tests/test_cuda_utils.py
Lines 11 to 40 in eabaf4b
def test_driver_cu_result_explanations_health(): expl_dict = cuda_utils.DRIVER_CU_RESULT_EXPLANATIONS # Ensure all CUresult enums are in expl_dict known_codes = set() for error in driver.CUresult: code = int(error) assert code in expl_dict known_codes.add(code) if cuda_utils.get_binding_version() >= (13, 0): # Ensure expl_dict has no codes not known as a CUresult enum extra_expl = sorted(set(expl_dict.keys()) - known_codes) assert not extra_expl def test_runtime_cuda_error_explanations_health(): expl_dict = cuda_utils.RUNTIME_CUDA_ERROR_EXPLANATIONS # Ensure all cudaError_t enums are in expl_dict known_codes = set() for error in runtime.cudaError_t: code = int(error) assert code in expl_dict known_codes.add(code) if cuda_utils.get_binding_version() >= (13, 0): # Ensure expl_dict has no codes not known as a cudaError_t enum extra_expl = sorted(set(expl_dict.keys()) - known_codes) assert not extra_expl
Problem
The tests succeed only for the matching cuda-bindings release.
If cuda_core is tests are run against an older or newer version of cuda-bindings, they will fail (that's nvbug 5932944).
Solution
The explanations dicts are fundamentally directly tied to the bindings, therefore they should be moved to cuda_bindings (maybe a new cuda_bindings/cuda/bindings/_utils/ directory). Accordingly, the tests should be moved, too.
Backward compatibility
When the explanations dicts are moved, the cuda_core code using them needs to be made tolerant to not finding them in existing releases of cuda-bindings. I.e. the explanations will be used if available in cuda_bindings, or otherwise simply not be added when generating error messages at runtime. This is considered to be a minor loss that will become a non-issue over time as old cuda-bindings releases fall out of use.