diff --git a/CMakeLists.txt b/CMakeLists.txt index 3aac1d2e74..442f87b8ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,6 @@ set(_dpctl_sycl_target_link_options) set(_dpctl_sycl_targets) set(_dpctl_cuda_arch) -set(_dpctl_amd_targets) - if ("x${DPCTL_SYCL_TARGETS}" STREQUAL "x") if (NOT "x${DPCTL_TARGET_CUDA}" STREQUAL "x") if(DPCTL_TARGET_CUDA MATCHES "^sm_") @@ -76,41 +74,33 @@ if ("x${DPCTL_SYCL_TARGETS}" STREQUAL "x") endif() if (NOT "x${DPCTL_TARGET_HIP}" STREQUAL "x") - set(_dpctl_amd_targets ${DPCTL_TARGET_HIP}) - if(_dpctl_sycl_targets) - set(_dpctl_sycl_targets "amdgcn-amd-amdhsa,${_dpctl_sycl_targets}") - else() - set(_dpctl_sycl_targets "amdgcn-amd-amdhsa,spir64-unknown-unknown") - endif() - else() - if (DEFINED ENV{DPCTL_TARGET_HIP}) - set(_dpctl_amd_targets $ENV{DPCTL_TARGET_HIP}) + if(DPCTL_TARGET_HIP MATCHES "^gfx") if(_dpctl_sycl_targets) - set(_dpctl_sycl_targets "amdgcn-amd-amdhsa,${_dpctl_sycl_targets}") + set(_dpctl_sycl_targets "amd_gpu_${DPCTL_TARGET_HIP},${_dpctl_sycl_targets}") else() - set(_dpctl_sycl_targets "amdgcn-amd-amdhsa,spir64-unknown-unknown") + set(_dpctl_sycl_targets "amd_gpu_${DPCTL_TARGET_HIP},spir64-unknown-unknown") endif() + else() + message(FATAL_ERROR + "Invalid value for DPCTL_TARGET_HIP: \"${DPCTL_TARGET_HIP}\". " + "Expected something starting with 'gfx', e.g. 'gfx1030'." + ) endif() endif() else() - set(_dpctl_sycl_targets ${DPCTL_SYCL_TARGETS}) - if (NOT "x${DPCTL_TARGET_HIP}" STREQUAL "x") - set(_dpctl_amd_targets ${DPCTL_TARGET_HIP}) - else() - if (DEFINED ENV{DPCTL_TARGET_HIP}) - set(_dpctl_amd_targets $ENV{DPCTL_TARGET_HIP}) - endif() + if ("${DPCTL_SYCL_TARGETS}" MATCHES "amdgcn-amd-amdhsa") + message(FATAL_ERROR + "Legacy target 'amdgcn-amd-amdhsa' is not supported. " + "Use alias form 'amd_gpu_' instead." + ) endif() + set(_dpctl_sycl_targets ${DPCTL_SYCL_TARGETS}) endif() if (_dpctl_sycl_targets) message(STATUS "Compiling for -fsycl-targets=${_dpctl_sycl_targets}") list(APPEND _dpctl_sycl_target_compile_options -fsycl-targets=${_dpctl_sycl_targets}) list(APPEND _dpctl_sycl_target_link_options -fsycl-targets=${_dpctl_sycl_targets}) - if(_dpctl_amd_targets) - list(APPEND _dpctl_sycl_target_compile_options -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=${_dpctl_amd_targets}) - list(APPEND _dpctl_sycl_target_link_options -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=${_dpctl_amd_targets}) - endif() endif() add_subdirectory(libsyclinterface) diff --git a/docs/doc_sources/beginners_guides/installation.rst b/docs/doc_sources/beginners_guides/installation.rst index 44d46797ba..a6cd3dfd7a 100644 --- a/docs/doc_sources/beginners_guides/installation.rst +++ b/docs/doc_sources/beginners_guides/installation.rst @@ -189,11 +189,24 @@ To build for AMD devices, use: .. code-block:: bash - python scripts/build_locally.py --verbose --cmake-opts="-DDPCTL_TARGET_HIP=gfx1030" + python scripts/build_locally.py --verbose --cmake-opts="-DDPCTL_TARGET_HIP=" -Note that the `oneAPI for AMD GPUs` plugin requires the architecture be specified and only +Note that the `oneAPI for AMD GPUs` plugin requires the architecture be specified and only one architecture can be specified at a time. +To determine the architecture code (````) for your AMD GPU, run: + +.. code-block:: bash + rocminfo | grep 'Name: *gfx.*' + +This will print names like ``gfx90a``, ``gfx1030``, etc. +You can then use one of them as the argument to ``-DDPCTL_TARGET_HIP``. + +For example: + +.. code-block:: bash + python scripts/build_locally.py --verbose --cmake-opts="-DDPCTL_TARGET_HIP=gfx1030" + It is, however, possible to build for Intel devices, CUDA devices, and an AMD device architecture all at once: