True if ``kind`` is selected by ``TVM_TEST_TARGETS`` (or the default set). Honors the ``TVM_TEST_TARGETS`` opt-out, so CI can exclude a flaky backend (e.g. opencl) via ``TVM_TEST_TARGETS`` and have its tests skip even when a device is physically present.
(kind: str)
| 128 | |
| 129 | @functools.cache |
| 130 | def _target_enabled(kind: str) -> bool: |
| 131 | """True if ``kind`` is selected by ``TVM_TEST_TARGETS`` (or the default set). |
| 132 | |
| 133 | Honors the ``TVM_TEST_TARGETS`` opt-out, so CI can exclude a flaky |
| 134 | backend (e.g. opencl) via ``TVM_TEST_TARGETS`` and have its tests skip |
| 135 | even when a device is physically present. |
| 136 | """ |
| 137 | try: |
| 138 | from tvm.testing.utils import _tvm_test_targets # pylint: disable=import-outside-toplevel |
| 139 | |
| 140 | for target in _tvm_test_targets(): |
| 141 | k = target["kind"] if isinstance(target, dict) else str(target).split()[0] |
| 142 | if k == kind: |
| 143 | return True |
| 144 | return False |
| 145 | except Exception: # pylint: disable=broad-except |
| 146 | return True # fail open: the device check still gates |
| 147 | |
| 148 | |
| 149 | @functools.cache |
no test coverage detected
searching dependent graphs…