Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 15 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,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 (DPCTL_TARGET_CUDA)
Expand All @@ -73,42 +72,34 @@ if ("x${DPCTL_SYCL_TARGETS}" STREQUAL "x")
set(_dpctl_sycl_targets "nvidia_gpu_${_dpctl_cuda_arch},spir64-unknown-unknown")
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)
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_<arch>' 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)
Expand Down
17 changes: 15 additions & 2 deletions docs/doc_sources/beginners_guides/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,24 @@ which requires specifying a compute architecture string:

.. 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=<arch>"

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 (``<arch>``) 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"

Multi-target build
~~~~~~~~~~~~~~~~~~

Expand Down
Loading