From d8175a4380513f00f7f1f16553290ef45af082f0 Mon Sep 17 00:00:00 2001 From: George Hotz <72895+geohot@users.noreply.github.com> Date: Fri, 1 Dec 2023 09:42:15 -0800 Subject: [PATCH] simple fix (#2543) --- .github/workflows/test.yml | 4 ++-- tinygrad/runtime/ops_cuda.py | 2 +- tinygrad/runtime/ops_hip.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a6b7d1c02..44e539b00e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -328,9 +328,9 @@ jobs: # Prefer packages from the rocm repository over system packages echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' | sudo tee /etc/apt/preferences.d/rocm-pin-600 sudo apt update - sudo apt install --allow-unauthenticated -y rocm-hip-libraries hip-dev + sudo apt install --no-install-recommends --allow-unauthenticated -y rocm-hip-libraries hip-dev - name: Install Python Dependencies - run: pip install -e '.[testing]' + run: pip install -e '.[testing]' --extra-index-url https://download.pytorch.org/whl/cpu - name: Test HIP compilation on RDNA3 [gfx1100] run: | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/rocm/hip/lib diff --git a/tinygrad/runtime/ops_cuda.py b/tinygrad/runtime/ops_cuda.py index dca792cbb9..05d5b70aa6 100644 --- a/tinygrad/runtime/ops_cuda.py +++ b/tinygrad/runtime/ops_cuda.py @@ -32,7 +32,7 @@ class CUDAProgram: subprocess.run(["ptxas", f"-arch={CUDADevice.default_arch_name}", "-o", fn, fn+".ptx"], check=True) print(subprocess.check_output(['nvdisasm', fn]).decode('utf-8')) except Exception as e: print("failed to generate SASS", str(e)) - + if not CUDACPU: self.module = init_c_var(cuda.CUmodule(), lambda x: check(cuda.cuModuleLoadData(ctypes.byref(x), prg))) check(cuda.cuModuleGetFunction(ctypes.byref(prg := cuda.CUfunction()), self.module, name.encode("utf-8"))) diff --git a/tinygrad/runtime/ops_hip.py b/tinygrad/runtime/ops_hip.py index 92e79d4e2f..6c54f734f1 100644 --- a/tinygrad/runtime/ops_hip.py +++ b/tinygrad/runtime/ops_hip.py @@ -68,7 +68,7 @@ class HIPDevice(Compiled): def __init__(self, device:str): self.device = int(device.split(":")[1]) if ":" in device else 0 if self.device == 0 and not MOCKHIP: HIPDevice.default_arch_name = init_c_var(hip.hipDeviceProp_t(), lambda x: check(hip.hipGetDeviceProperties(x, self.device))).gcnArchName.decode() - + from tinygrad.runtime.graph.hip import HIPGraph super().__init__(MallocAllocator if MOCKHIP else HIPAllocator(self.device), LinearizerOptions(device="HIP"), HIPRenderer, compile_hip, functools.partial(HIPProgram, self.device), HIPGraph) def synchronize(self): hip.hipDeviceSynchronize() \ No newline at end of file