Add support for AMD GPUs#619
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
@jakurzak Can you please add a PR description ? @sergeisakov Can you take a look at this PR? |
Yes, I'll take a look at this PR. |
sergeisakov
left a comment
There was a problem hiding this comment.
Thank you for adding support for AMD GPUs. I can't really test if it works or not. Nevertheless the PR looks good to me. Could you fix a few formatting issues? Could you also add some doc?
| sizeof(fp_type) * Impl::MinSize(dest.num_qubits()), | ||
| cudaMemcpyHostToDevice); | ||
| ErrorCheck( | ||
| cudaMemcpy(dest.get(), src, |
There was a problem hiding this comment.
There should be a four space indent if the line breaks after (.
|
Thank you for taking the time to look at the PR! |
|
I fixed the style issues and commented on the use of HIPCC for CPU code when compiling Python bindings. |
|
I added basic documentation for AMD GPU support. |
Thank you. Could you replace Qsim with qsim in |
done |
|
Looks like it's getting hung up on the kokoro test. |
|
The cuQuantum test failed during bringup: LogsFrom the logs, it's possible this was a network error. I'll re-trigger the test, but in the meantime check the logs to see if this PR could have caused the issue. |
|
Hmm. Doesn't look like I can re-trigger the kokoro test specifically. Could you push a commit so Github picks up on it? |
|
No cuQuantum support in the AMD port, BTW, as there's no AMD equivalent. |
|
@sergeisakov, @95-martin-orion, can you help move this forward? |
Overview
This pull request adds support for AMD Instinct GPUs.
Changes
CMakeLists.txtMakefileHIPCC=hipccandHIPCCFLAGS = -O3variables, similarly to the existingNVCC=nvccandHIPCCFLAGS = -O3variables..PHONY: qsim-hip,.PHONY: hip-tests, and.PHONY: run-hip-testssections, similarly to the existing.PHONY: qsim-cuda,.PHONY: cuda-tests, and.PHONY: run-cuda-testssections.apps/MakefileHIP_TARGETSwih the.hip.xsuffix from all files with the.cuda.cusuffix, similarly to how the list ofCUDA_TARGETSis generated..PHONY: qsim-hipand the%hip.x: %cuda.cusection, similarly to the existing.PHONY: qsim-cudaand%cuda.x: %cuda.cusections.apps/make.shdocs/_book.yamldocs/tutorials/amd_gpu.mdlib/cuda2hip.h__shfl_down_sync(), as a wrapper around HIP's__shfl_down()function, since the former is not currently available in HIP.lib/fuser_mqubit.hlib/simulator_cuda_kernels.hlib/statespace_cuda.hcudaMemset().lib/statespace_cuda_kernels.hlib/util_cuda.hlib/vectorspace_cuda.hcudaFree(),cudaMemcpy(), andcudaDeviceSynchronize().pybind_interface/MakefileQSIMLIB_HIP, similar to the existingQSIMLIB_CUDA.pybind-gpuanddecide-gputopybind-cudaanddecide-cuda.pybind-hipanddecide-hip.cleansection.pybind_interface/decide/CMakeLists.txtHIPas one of the project languages. The CMake file then adjusts the build process to use HIP-specific commands (hip_add_library) and properties for compiling the relevant source files. It also includes the necessary directories and sets the module properties for creating a Python extension module with HIP support, allowing the same build system to work across both CUDA and HIP platforms depending on the available compiler.pybind_interface/decide/decide.cppHIP = 2toenum GPUCapabilities.GPUCapabilities gpu = HIPif HIP compiler is detected.pybind_interface/hip/CMakeLists.txtpybind_interface/hip/pybind_main_hip.cpppybind_interface/hip/pybind_main_hip.hqsim_hipusing Pybind11.pybind_interface/pybind_main.cppcircuit,ncircuit, andstate_space.qsimcirq/__init__.pyqsim_decide.detect_gpu()returns 2, import the HIP-compatible moduleqsimcirq.qsim_hip.setup.pyimport shutil.cmake_argslist to specify hipcc as the C and C++ compiler.qsim_hipdirectory contains a CMake project to be built as a Python extension with support for HIP.tests/Makefiletests/make.shBuilding
Testing
Simulator
or
Python bindings
or