diff --git a/cmake/hrx.cmake b/cmake/hrx.cmake index 6d3bd2690..bc7a6e4b6 100644 --- a/cmake/hrx.cmake +++ b/cmake/hrx.cmake @@ -158,8 +158,11 @@ if(NOT ONEBIT_HRX_DEVICE_LIB) endif() endif() endif() +# It goes to the HIP kernel compile only (ONEBIT_HRX_HIP_FLAGS below), never into CMAKE_C/CXX_FLAGS: +# those reach every host object of the hrx-system deps build, which compiles with -Werror, and a host C +# file has no device code to link, so clang rejects the flag as unused (-Wunused-command-line-argument). +# A cold HRX build failed on it here, and so did hrx-build whenever the deps rebuilt (runs 42524820160, 42526921955). if(ONEBIT_HRX_DEVICE_LIB) - string(APPEND ONEBIT_HRX_EXTRA_FLAGS " --rocm-device-lib-path=${ONEBIT_HRX_DEVICE_LIB}") message(STATUS "ONEBIT_HRX: device library ${ONEBIT_HRX_DEVICE_LIB}") else() message(STATUS "ONEBIT_HRX: no device library under ${ONEBIT_HRX_TOOLCHAIN}; hipcc's default is used") diff --git a/docs/hrx.md b/docs/hrx.md index 0dd2f8a38..9056bdd1e 100644 --- a/docs/hrx.md +++ b/docs/hrx.md @@ -1044,7 +1044,9 @@ cmake --build build --target onebit a fresh box needs only this repository. `-DONEBIT_HRX_TOOLCHAIN` / `ROCM_PATH` still override it, and an existing `/opt/rocm-therock` is used when the tree copy is absent. The device library (the `amdgcn` bitcode) is read from the toolchain itself, so no `HIP_DEVICE_LIB_PATH`, - `ROCM_PATH` or `HIP_PATH` is needed in the environment. + `ROCM_PATH` or `HIP_PATH` is needed in the environment. It is passed to the HIP kernel compile only + (`GGML_HRX_HIP_FLAGS`), not to the host C/C++ flags: the hrx-system build uses `-Werror`, and + clang rejects the flag as unused on a host object. - **One external project.** llama.cpp's ggml-hrx builds hrx-system itself (`HRX_SOURCE_DIR`) with TheRock's `amdclang`. diff --git a/tests/hrx_toolchain_pin.sh b/tests/hrx_toolchain_pin.sh index 95d047673..6aefeb4ec 100755 --- a/tests/hrx_toolchain_pin.sh +++ b/tests/hrx_toolchain_pin.sh @@ -86,6 +86,11 @@ grep -q "removing stale toolchain" "$root/scripts/fetch-rocm-sdk.sh" && ok "the # environment and takes the compiler from /opt (the gap pi-prs found in review) grep -q "GGML_HRX_HIP_FLAGS" "$root/cmake/hrx.cmake" && ok "the HIP kernel flags are passed (GGML_HRX_HIP_FLAGS)" || bad "cmake/hrx.cmake does not pass GGML_HRX_HIP_FLAGS: the HIP kernel compile needs the device library in the environment" +# the device library must not reach the host C/C++ flags: the hrx-system deps build compiles with -Werror, +# and on a host object clang rejects the flag as unused, so every cold HRX build failed on it +grep -Eq 'APPEND ONEBIT_HRX_EXTRA_FLAGS[^)]*rocm-device-lib-path' "$root/cmake/hrx.cmake" && + bad "cmake/hrx.cmake puts --rocm-device-lib-path into the host C/C++ flags (-Werror fails host objects on it)" || + ok "the device library goes to the HIP kernel compile only, not the host C/C++ flags" grep -q "GGML_HRX_HIP_COMPILER" "$root/cmake/hrx.cmake" && ok "the HIP kernel compiler comes from the toolchain" || bad "cmake/hrx.cmake does not set GGML_HRX_HIP_COMPILER: ggml-hrx-hip.cmake would find /opt/rocm-therock first" grep -q "config/hrx-toolchain.config" "$root/cmake/hrx.cmake" "$root/scripts/fetch-rocm-sdk.sh" "$root/scripts/weekly.sh" &&