|
2 | 2 | #
|
3 | 3 | # SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
|
4 | 4 |
|
5 |
| -from contextlib import contextmanager, nullcontext |
6 |
| - |
7 | 5 | import pytest
|
8 | 6 |
|
9 | 7 | from cuda.core.experimental import Linker, LinkerOptions, Program, _linker
|
|
20 | 18 | device_function_c = "__device__ int C(int a, int b) { return a + b; }"
|
21 | 19 |
|
22 | 20 | culink_backend = _linker._decide_nvjitlink_or_driver()
|
23 |
| -skip_options = nullcontext |
24 |
| -if not culink_backend: |
25 |
| - from cuda.bindings import nvjitlink |
26 |
| - |
27 |
| - @contextmanager |
28 |
| - def skip_version_specific_linker_options(): |
29 |
| - if culink_backend: |
30 |
| - return |
31 |
| - try: |
32 |
| - yield |
33 |
| - except nvjitlink.nvJitLinkError as e: |
34 |
| - if e.status == nvjitlink.Result.ERROR_UNRECOGNIZED_OPTION: |
35 |
| - pytest.skip("current nvjitlink version does not support the option provided") |
36 |
| - else: |
37 |
| - raise |
38 |
| - |
39 |
| - skip_options = skip_version_specific_linker_options |
40 | 21 |
|
41 | 22 |
|
42 | 23 | @pytest.fixture(scope="function")
|
@@ -91,11 +72,9 @@ def compile_ltoir_functions(init_cuda):
|
91 | 72 | ],
|
92 | 73 | )
|
93 | 74 | def test_linker_init(compile_ptx_functions, options):
|
94 |
| - with skip_options(): |
95 |
| - linker = Linker(*compile_ptx_functions, options=options) |
96 |
| - |
97 |
| - object_code = linker.link("cubin") |
98 |
| - assert isinstance(object_code, ObjectCode) |
| 75 | + linker = Linker(*compile_ptx_functions, options=options) |
| 76 | + object_code = linker.link("cubin") |
| 77 | + assert isinstance(object_code, ObjectCode) |
99 | 78 |
|
100 | 79 |
|
101 | 80 | def test_linker_init_invalid_arch():
|
|
0 commit comments