@@ -382,8 +382,10 @@ def test_make_program_cache_key_ptx_linker_equivalent_options_hash_same(a, b, mo
382382 presence-only (``time``), ``is True`` (``no_cache``). Semantically
383383 equivalent inputs under those gates must hash to the same key."""
384384 # Pin the linker probe so the only variable is the options gate.
385+ from cuda .core import _linker
385386 from cuda .core .utils import _program_cache
386387
388+ monkeypatch .setattr (_linker , "_choose_backend" , lambda * _args , ** _kwargs : "nvjitlink" )
387389 monkeypatch .setattr (_program_cache ._keys , "_linker_backend_and_version" , lambda _use_driver : ("nvJitLink" , "12030" ))
388390 k_a = _make_key (code = ".version 7.0" , code_type = "ptx" , options = _opts (** a ))
389391 k_b = _make_key (code = ".version 7.0" , code_type = "ptx" , options = _opts (** b ))
@@ -999,9 +1001,12 @@ def test_make_program_cache_key_rejects_side_effect_options_nvrtc(option_kw, ext
9991001 pytest .param ({"time" : "whatever.csv" }, id = "time_path" ),
10001002 ],
10011003)
1002- def test_make_program_cache_key_accepts_side_effect_options_for_ptx (option_kw ):
1004+ def test_make_program_cache_key_accepts_side_effect_options_for_ptx (option_kw , monkeypatch ):
10031005 """The side-effect guard is NVRTC-specific: PTX (linker) and NVVM must
10041006 not be blocked by options whose side effects only apply under NVRTC."""
1007+ from cuda .core import _linker
1008+
1009+ monkeypatch .setattr (_linker , "_choose_backend" , lambda * _args , ** _kwargs : "nvjitlink" )
10051010 _make_key (code = ".version 7.0" , code_type = "ptx" , options = _opts (** option_kw )) # no raise
10061011
10071012
0 commit comments