MCPcopy Index your code
hub / github.com/apache/tvm / _target_enabled

Function _target_enabled

python/tvm/testing/env.py:130–146  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

128
129@functools.cache
130def _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

Callers 2

_device_usableFunction · 0.85
has_llvmFunction · 0.85

Calls 3

_tvm_test_targetsFunction · 0.90
strFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…