mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-13 08:28:55 +08:00
hotfix: amd works on arch linux w/o rocm
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
PYTHON_PATH=$(readlink -f $(which python3))
|
||||
sudo setcap 'cap_dac_override,cap_sys_rawio,cap_sys_admin=ep' $PYTHON_PATH
|
||||
sudo setcap 'cap_dac_override,cap_sys_rawio,cap_sys_admin,cap_ipc_lock=ep' $PYTHON_PATH
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import ctypes, subprocess
|
||||
import tinygrad.runtime.autogen.comgr as comgr
|
||||
comgr.amd_comgr_get_version(ctypes.byref(major:=ctypes.c_uint64()), ctypes.byref(minor:=ctypes.c_uint64()))
|
||||
assert comgr.AMD_COMGR_LANGUAGE_HIP == 4
|
||||
if major.value >= 3:
|
||||
# in comgr 3 the values of enums in headers were changed: https://github.com/ROCm/llvm-project/issues/272
|
||||
import tinygrad.runtime.autogen.comgr_3 as comgr # type: ignore[no-redef]
|
||||
assert comgr.AMD_COMGR_LANGUAGE_HIP == 3
|
||||
try:
|
||||
comgr.amd_comgr_get_version(ctypes.byref(major:=ctypes.c_uint64()), ctypes.byref(minor:=ctypes.c_uint64()))
|
||||
if major.value >= 3:
|
||||
# in comgr 3 the values of enums in headers were changed: https://github.com/ROCm/llvm-project/issues/272
|
||||
import tinygrad.runtime.autogen.comgr_3 as comgr # type: ignore[no-redef]
|
||||
assert comgr.AMD_COMGR_LANGUAGE_HIP == 3
|
||||
except AttributeError: pass # ignore if ROCm isn't installed
|
||||
from tinygrad.device import Compiler, CompileError
|
||||
from tinygrad.runtime.ops_llvm import LLVMCompiler
|
||||
from tinygrad.helpers import OSX, to_char_p_p
|
||||
|
||||
Reference in New Issue
Block a user