diff --git a/CHANGELOG.md b/CHANGELOG.md index 26e9d091c0f..f370cb27b67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Adjusted the `pre-commit` configuration to run autoupdate weekly [#2479](https://github.com/IntelPython/dpnp/pull/2479) +* Improved validation of `--target-hip` build option to only accept a gfx-prefixed value [#2481](https://github.com/IntelPython/dpnp/pull/2481) ### Fixed diff --git a/CMakeLists.txt b/CMakeLists.txt index 33bd9efd47c..43b4ba0bd67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,13 +106,19 @@ if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x") set(_use_onemkl_interfaces_cuda ON) endif() - if (NOT "x${HIP_TARGETS}" STREQUAL "x") - set(_use_onemkl_interfaces_hip ON) - - if ("x${_dpnp_sycl_targets}" STREQUAL "x") - set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},spir64-unknown-unknown") + if (HIP_TARGETS) + if (HIP_TARGETS MATCHES "^gfx") + if ("x${_dpnp_sycl_targets}" STREQUAL "x") + set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},spir64-unknown-unknown") + else() + set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},${_dpnp_sycl_targets}") + endif() + set(_use_onemkl_interfaces_hip ON) else() - set(_dpnp_sycl_targets "amd_gpu_${HIP_TARGETS},${_dpnp_sycl_targets}") + message(FATAL_ERROR + "Invalid value for HIP_TARGETS: \"${HIP_TARGETS}\". " + "Expected an architecture name starting with 'gfx', e.g. 'gfx1030'." + ) endif() endif() else()