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
5 changes: 4 additions & 1 deletion cmake/hrx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion docs/hrx.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
5 changes: 5 additions & 0 deletions tests/hrx_toolchain_pin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" &&
Expand Down
Loading