From e9e2b9085ef4a1e0703da292aea7290aacd0a76d Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Mon, 16 Jun 2025 05:59:46 -0700 Subject: [PATCH 1/4] Validate HIP_TARGETS format and allow negative values --- CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33bd9efd47cc..70af38f7d6db 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', such as 'gfx90a' or 'gfx1030'." + ) endif() endif() else() From 4219633bb7e026909a15abee16929c501109d155 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Mon, 16 Jun 2025 06:12:47 -0700 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26e9d091c0f6..d53fcf4332ed 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 `--target-hip` handling to accept only gfx-prefixed values and allow disabling HIP build [#2479](https://github.com/IntelPython/dpnp/pull/2479) ### Fixed From 3f3f48dbe277d86cceb25bad6898fc71766946de Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Mon, 16 Jun 2025 06:26:05 -0700 Subject: [PATCH 3/4] Update FATAL_ERROR message --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70af38f7d6db..43b4ba0bd67e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,7 +117,7 @@ if ("x${DPNP_SYCL_TARGETS}" STREQUAL "x") else() message(FATAL_ERROR "Invalid value for HIP_TARGETS: \"${HIP_TARGETS}\". " - "Expected an architecture name starting with 'gfx', such as 'gfx90a' or 'gfx1030'." + "Expected an architecture name starting with 'gfx', e.g. 'gfx1030'." ) endif() endif() From 3609217e89c64c010872b889d7569948c95f7889 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Mon, 16 Jun 2025 06:42:14 -0700 Subject: [PATCH 4/4] Apply remark --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d53fcf4332ed..f370cb27b673 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +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 `--target-hip` handling to accept only gfx-prefixed values and allow disabling HIP build [#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