@@ -802,21 +802,23 @@ def _broken():
802802
803803def test_make_program_cache_key_driver_probe_failure_taints_ptx_under_cuLink (monkeypatch ):
804804 """When the driver linker is active, _linker_backend_and_version
805- invokes _driver_version internally; a failing driver probe propagates
806- through the linker probe and must perturb the PTX key."""
805+ invokes _driver_version internally; a failing driver probe must (a)
806+ perturb the PTX key away from the success key, AND (b) be stable
807+ across repeated calls so the persistent cache stays usable in the
808+ failed environment."""
809+ from cuda .core import _linker
807810 from cuda .core .utils import _program_cache
808811
809812 def _broken ():
810813 raise RuntimeError ("driver probe failed" )
811814
812- # Force the cuLink driver path so _linker_backend_and_version reads driver_version.
813- from cuda .core import _linker
814-
815815 monkeypatch .setattr (_linker , "_decide_nvjitlink_or_driver" , lambda : True )
816816 k_ok = _make_key (code = ".ptx" , code_type = "ptx" )
817817 monkeypatch .setattr (_program_cache , "_driver_version" , _broken )
818- k_broken = _make_key (code = ".ptx" , code_type = "ptx" )
819- assert k_ok != k_broken
818+ k_broken1 = _make_key (code = ".ptx" , code_type = "ptx" )
819+ k_broken2 = _make_key (code = ".ptx" , code_type = "ptx" )
820+ assert k_ok != k_broken1
821+ assert k_broken1 == k_broken2 # stable: same failure -> same key
820822
821823
822824# ---------------------------------------------------------------------------
0 commit comments