From 06bd12ecd4c7fbefef94943194f816c9f5a292d1 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Fri, 26 Jan 2024 02:06:52 +0000 Subject: [PATCH] simple comgr test --- generate_hip.sh | 7 +++++-- test/test_hip.py | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/generate_hip.sh b/generate_hip.sh index c53e548..74d7bfe 100755 --- a/generate_hip.sh +++ b/generate_hip.sh @@ -1,5 +1,7 @@ #!/bin/bash -e -clang2py /opt/rocm/include/hip/hip_ext.h /opt/rocm/include/hip/hiprtc.h /opt/rocm/include/hip/hip_runtime_api.h /opt/rocm/include/hip/driver_types.h --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include -x c++" -o gpuctypes/hip.py -l /opt/rocm/lib/libamdhip64.so +clang2py /opt/rocm/include/hip/hip_ext.h /opt/rocm/include/hip/hiprtc.h \ + /opt/rocm/include/hip/hip_runtime_api.h /opt/rocm/include/hip/driver_types.h \ + --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include -x c++" -o gpuctypes/hip.py -l /opt/rocm/lib/libamdhip64.so echo "hipDeviceProp_t = hipDeviceProp_tR0600" >> gpuctypes/hip.py echo "hipGetDeviceProperties = hipGetDevicePropertiesR0600" >> gpuctypes/hip.py grep FIXME_STUB gpuctypes/hip.py || true @@ -9,6 +11,7 @@ grep FIXME_STUB gpuctypes/hip.py || true #sed -i "s\ctypes.CDLL('/opt/rocm/lib/libamdhip64.so')\ctypes.CDLL(ctypes.util.find_library('amdhip64'))\g" gpuctypes/hip.py python3 -c "import gpuctypes.hip" -clang2py /opt/rocm/include/amd_comgr/amd_comgr.h --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include -x c++" -o gpuctypes/comgr.py -l /opt/rocm/lib/libamd_comgr.so +clang2py /opt/rocm/include/amd_comgr/amd_comgr.h \ + --clang-args="-D__HIP_PLATFORM_AMD__ -I/opt/rocm/include -x c++" -o gpuctypes/comgr.py -l /opt/rocm/lib/libamd_comgr.so grep FIXME_STUB gpuctypes/comgr.py || true python3 -c "import gpuctypes.comgr" diff --git a/test/test_hip.py b/test/test_hip.py index 57aca33..ea88b24 100644 --- a/test/test_hip.py +++ b/test/test_hip.py @@ -1,6 +1,7 @@ import unittest import ctypes import gpuctypes.hip as hip +import gpuctypes.comgr as comgr from helpers import CI, expectedFailureIf, cuda_compile def check(status): @@ -29,6 +30,10 @@ def test_compile(self): prg = cuda_compile("int test() { return 42; }", ["--offload-arch=gfx1100"], HIPCompile, check) assert len(prg) > 10 + def test_comgr(self): + status = comgr.amd_comgr_create_action_info(ctypes.byref(action_info := comgr.amd_comgr_action_info_t())) + assert status == 0 + class TestHIPDevice(unittest.TestCase): @expectedFailureIf(CI) def test_malloc(self):