chore: import upstream snapshot with attribution
Lint / lint (push) Has been cancelled
Build Docs / Deploy Docs (push) Has been cancelled
Windows CI / Windows (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:23:58 +08:00
commit 770d92cb1f
694 changed files with 114634 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
"""Check if a device exists."""
import os
import sys
from tvm.runtime import Device
from tvm.runtime import device as as_device
def _check_device(device: Device) -> bool:
try:
return bool(device.exist)
except Exception:
return False
def main():
"""Entrypoint for device check."""
device_str = sys.argv[1]
device_ids = []
i = 0
while True:
if _check_device(as_device(device_str, i)):
device_ids.append(i)
i += 1
if device_str in ["cpu", "llvm"] and i > os.cpu_count() / 2:
break
else:
break
print(f"check_device:{','.join(str(i) for i in device_ids)}")
if __name__ == "__main__":
main()