Repository navigation
Description
Summary
tests/test_package_windows_cuda_runtime.py fails 2 of its 25 tests on any host that exports CUDNN_PATH. parse_args reads the --cudnn-path default from that variable, and the tests' run_main does not pass --cudnn-path, so main looks for cuDNN at the host path instead of in the synthetic toolkit the test built. This makes make verify-python-tooling (and make verify with it) fail on exactly the Windows CUDA build hosts the script targets. The script is correct; the tests inherit the variable.
Background
The module docstring states each case builds a synthetic toolkit "so the suite needs no toolkit, GPU or Windows". parse_args sets --cudnn-path to default=env.get("CUDNN_PATH") or None (scripts/package_windows_cuda_runtime.py:397). run_main (tests/test_package_windows_cuda_runtime.py:261) invokes pkg.main with --cuda-path, --deps-dir and --arch only. With CUDNN_PATH exported, main resolves cuDNN from the host root and reports the bundle files as missing, so test_stage_dir and test_zip_is_named_by_version_and_wrapped_in_one_folder return exit code 1. The script mirrors the build (windows_cuda.rs reads cuDNN from CUDNN_PATH when it is set), so the script behaviour is the intended one.
Proposed Solution
Isolate the tests from the environment the parser reads defaults from: run_main should invoke main with CUDNN_PATH (and the other default-source variables) cleared, so each case exercises only the flags it passes. Add cases that pin what those environment defaults do, so the default behaviour stays covered.
Implementation Notes
scripts/package_windows_cuda_runtime.py:397:--cudnn-pathdefault fromCUDNN_PATH. The same parser readsCUDA_HOME/CUDA_PATHat:392andCARGO_TARGET_DIRat:407, but the tests already pass--cuda-pathand--deps-dir/--archthat override those.tests/test_package_windows_cuda_runtime.py:261run_main: passes--cuda-path,--deps-dir,--arch. The two failing cases aretest_zip_is_named_by_version_and_wrapped_in_one_folderandtest_stage_dir.- Clearing the variable in the harness (for example
unittest.mock.patch.dict(os.environ, ...)) keeps the suite host-independent.
Acceptance Criteria
CUDNN_PATH=/anywhere python3 -m unittest tests/test_package_windows_cuda_runtime.pypasses all 25 tests.- The suite passes with
CUDNN_PATH,CUDA_PATH,CUDA_HOMEandCARGO_TARGET_DIRset to non-existent directories. make verify-python-toolingpasses on a host that exportsCUDNN_PATH.
Original Suggestion
Title: fix(cuda): the Windows runtime packager tests fail when CUDNN_PATH is exported
Summary
tests/test_package_windows_cuda_runtime.py fails 2 of its 25 tests on a host whose environment exports CUDNN_PATH. That is what docs/installation.md asks of a Windows CUDA build with a separate cuDNN install, so make verify-python-tooling, and make verify with it, fails on the hosts the script is for. The script is right. The tests inherit the variable.
Reproduction steps
CUDNN_PATH=/anywhere python3 -m unittest tests/test_package_windows_cuda_runtime.pyAny value does it; the directory does not have to exist.
Expected behavior
25 tests pass. The module's docstring says each case builds a synthetic toolkit, "so the suite needs no toolkit, GPU or Windows".
Actual behavior
FAIL: test_stage_dir (tests.test_package_windows_cuda_runtime.PackageTest.test_stage_dir)
File "tests/test_package_windows_cuda_runtime.py", line 283, in test_stage_dir
self.assertEqual(code, 0)
AssertionError: 1 != 0
FAIL: test_zip_is_named_by_version_and_wrapped_in_one_folder (tests.test_package_windows_cuda_runtime.PackageTest.test_zip_is_named_by_version_and_wrapped_in_one_folder)
File "tests/test_package_windows_cuda_runtime.py", line 272, in test_zip_is_named_by_version_and_wrapped_in_one_folder
self.assertEqual(code, 0)
AssertionError: 1 != 0
Ran 25 tests in 0.245s
FAILED (failures=2)
mlxcel version
main @ ce6855b
Install method
Built from source
Platform
Linux + CUDA (gb10)
Model checkpoint
None.
Relevant logs
What the script prints in those two cases, with CUDNN_PATH=/anywhere:
package_windows_cuda_runtime: the inputs lack files the bundle needs:
/anywhere/bin/x64/cudnn64_*.dll
/anywhere/bin/x64/cudnn_adv64_*.dll
...
/anywhere/LICENSE or /anywhere/LICENSE.txt (cudnn license, a file containing 'cuDNN'; pass --cudnn-license)
Additional context
- Cause.
parse_argstakes the--cudnn-pathdefault from the environment (scripts/package_windows_cuda_runtime.py:397,default=env.get("CUDNN_PATH") or None). The tests'run_mainpasses--cuda-path,--deps-dirand--archand not--cudnn-path(tests/test_package_windows_cuda_runtime.py:261), so with the variable exportedmainlooks for cuDNN in the host's root and not in the synthetic toolkit that has it. The script mirrors the build here (windows_cuda.rsreads cuDNN fromCUDNN_PATHalone when it is set), so its behaviour is the intended one. - Where I met it. A DGX Spark whose build environment exports
CUDNN_PATH(cuDNN is not in the toolkit directory there). The same two tests fail on macOS with the variable set, and pass on both without it. Hosted CI does not export it, which is whypython tooling testsis green. - Nothing else in the suite is exposed. I ran all of
tests/test_*.pywithCUDNN_PATH,CUDA_PATH,CUDA_HOME,ROCM_PATH,HIP_PATHandCARGO_TARGET_DIRset to directories that do not exist: these two tests are the only failures.CUDA_HOME/CUDA_PATHandCARGO_TARGET_DIRare defaults of the same parser, but the tests pass the flags that override them. The ROCm packager tests always pass--rocm-path. - A fix is ready on a branch:
run_mainrunsmainwithout the variablesparse_argsreads a default from, and three new cases pin what those defaults do.
Pre-submission checks
- I searched existing issues and did not find a duplicate
- This is not a security vulnerability (those go to SECURITY.md instead)
Activity
[-]fix(cuda): the Windows runtime packager tests fail when CUDNN_PATH is exported[/-][+]test(cuda): isolate the Windows runtime packager tests from an exported CUDNN_PATH[/+]test(cuda): isolate the Windows packager tests from an exported CUDNN…