True if the runtime was built with support for target ``kind``. Used for kinds whose device existence does not imply the backend was compiled in -- notably ``llvm``, which maps to the always-present CPU device, so ``tvm.device("llvm").exist`` is True even on ``USE_LLVM=OFF``.
(kind: str)
| 148 | |
| 149 | @functools.cache |
| 150 | def _runtime_enabled(kind: str) -> bool: |
| 151 | """True if the runtime was built with support for target ``kind``. |
| 152 | |
| 153 | Used for kinds whose device existence does not imply the backend was |
| 154 | compiled in -- notably ``llvm``, which maps to the always-present CPU |
| 155 | device, so ``tvm.device("llvm").exist`` is True even on ``USE_LLVM=OFF``. |
| 156 | """ |
| 157 | try: |
| 158 | return bool(tvm.runtime.enabled(kind)) |
| 159 | except Exception: # pylint: disable=broad-except |
| 160 | return False |
| 161 | |
| 162 | |
| 163 | def _device_usable(kind: str) -> bool: |