mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2626] [CLOSED] HIP build: honor -DGPU_TARGETS / -DAMDGPU_TARGETS when CMAKE_HIP_ARCHITECTURES is not given #4174
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4174
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2626
Author: @justincinmd
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:pr/hip-gpu-targets📝 Commits (1)
39be1eaHIP build: -DGPU_TARGETS / -DAMDGPU_TARGETS choose the architectures when CMAKE_HIP_ARCHITECTURES is not given📊 Changes
6 files changed (+479 additions, -5 deletions)
View changed files
📝
CMakeLists.txt(+8 -0)➕
cmake/hip_arch_select.cmake(+162 -0)📝
cmake/hip_backend.cmake(+6 -4)➕
cmake/tests/hip_arch_select/CMakeLists.txt(+70 -0)➕
cmake/tests/hip_arch_select_test.cmake(+228 -0)📝
docs/AMD_HIP.md(+5 -1)📄 Description
Summary
A manual HIP build with
-DGPU_TARGETS=gfx1201builds a gfx1100 engine. Configure and link give no warning. At start-up the engine refuses the card. This PR makes-DGPU_TARGETSand-DAMDGPU_TARGETSchoose the architecture whenCMAKE_HIP_ARCHITECTURESis not given.Cause:
cmake/hip_backend.cmakedefaultsCMAKE_HIP_ARCHITECTURESto gfx1100 and reads nothing else. ROCm appliesGPU_TARGETSonly tohip::device, and Strata linkship::host.What changed
cmake/hip_arch_select.cmake(new): the order isCMAKE_HIP_ARCHITECTURES,GPU_TARGETS,AMDGPU_TARGETS, then gfx1100. The default does not change. ggml-hip uses the same order.arch gfx1201 (from GPU_TARGETS). IfCMAKE_HIP_ARCHITECTURESand a target variable disagree,CMAKE_HIP_ARCHITECTURESwins and configure warns.find_package(hip)caches its ownGPU_TARGETS(amdgpu-arch's list), and ROCm 5.7 / 6.2 retype the user's entry. The selector tells them apart by CMake's-Dmarks and a record of whatfind_package(hip)left. A toolchain or parent-project variable wins over the cache, as usual in CMake.CMAKE_HIP_ARCHITECTURESto the cache. The same flags give the same result in a new or a used build folder. A 0.1.43 folder's cached default (gfx1100) is dropped; a value the user edited there is kept.cmake/hip_backend.cmakecalls the selector before and afterfind_package(hip).Not changed: setup.py and
tools/hip/build_windows.batpassCMAKE_HIP_ARCHITECTURES, so they build as before. The gfx906 path does not use this file.Testing
cmake/tests/hip_arch_select_test.cmake, in ctest aship_arch_select_testunderSTRATA_BUILD_TESTS. It runs 234 configures of a small project that replays ROCm 5.7, 6.2 and 7.2's cache declarations. It needs no HIP toolchain. It covers new and used folders,-U,-C, toolchain values (also equal to the cache), 0.1.43 folders and the conflict warning. It passes on CMake 3.24, 3.28, 4.1 and 4.4.-DGPU_TARGETS=gfx1201builds gfx1201 code only (57 code objects). v0.1.43 builds gfx1100.Extra Notes
One case stays as in 0.1.43: in a 0.1.43 folder where ROCm 5.7 / 6.2 retyped the user's
GPU_TARGETS, that value cannot be told from ROCm's own entry. Give-DGPU_TARGETSagain to use it.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.