Skip to content

Fix nodiscard hipError_t and a test predicate for ROCm 7.2#10

Open
jeffdaily wants to merge 1 commit into
ROCm-DS:release/rocmds-25.10from
jeffdaily:rocm-7.2-build-fixes
Open

Fix nodiscard hipError_t and a test predicate for ROCm 7.2#10
jeffdaily wants to merge 1 commit into
ROCm-DS:release/rocmds-25.10from
jeffdaily:rocm-7.2-build-fixes

Conversation

@jeffdaily

@jeffdaily jeffdaily commented Jun 4, 2026

Copy link
Copy Markdown

Companion to #11 (gfx1100 / RDNA3 wave32 enablement), whose full test suite needs these fixes to build on ROCm 7.2.

ROCm 7.2 marks hipError_t [[nodiscard]]. Several call sites ignore the returned status and, because the affected translation units are compiled with -Werror, fail to build under ROCm 7.2 (they built cleanly on the older ROCm this branch targets, where hipError_t is not nodiscard).

Each ignored status is wrapped in RAFT_CUDA_TRY so the result is checked, matching the surrounding idiom. One is a library header (sparse/convert/detail/adj_to_csr.cuh, an occupancy query); the rest are in the gtest sources for core, label, linalg, and sparse. Separately, the ball_cover test predicate is_nonzero took a mutable, non-const reference and so could not bind to the const value produced by a thrust transform iterator under ROCm 7.2; it is now operator()(const uint32_t&) const (a predicate must not mutate its argument). All changes are portable: a checked return and a const-correct predicate are equally correct on CUDA, so the NVIDIA build is unaffected.

Validation

Built the affected test executables for gfx1100 under ROCm 7.2.1 on an AMD Radeon Pro W7800:

cmake -DBUILD_TESTS=ON -DCMAKE_HIP_ARCHITECTURES=gfx1100 .
cmake --build . --target CORE_TEST LABEL_TEST LINALG_TEST SPARSE_TEST NEIGHBORS_TEST -j16
HIP_VISIBLE_DEVICES=<idle gpu> ctest

All previously-uncompilable executables now build and pass: CORE 269 (+1 skip), LABEL 14/14, LINALG 2070/2070, SPARSE 405 (+56 skip), NEIGHBORS 75/75.

This work was authored with the assistance of Claude, an AI assistant.

ROCm 7.2's HIP runtime marks hipError_t [[nodiscard]]. Several call sites
ignore the returned status and, because the affected translation units are
compiled with -Werror, fail to build under ROCm 7.2 (they built cleanly on
the older ROCm this branch targets, where hipError_t is not nodiscard).

Wrap each ignored status in RAFT_CUDA_TRY so the result is checked, matching
the surrounding idiom. One is a library header (sparse/convert/detail/
adj_to_csr.cuh, an occupancy query); the rest are in the gtest sources for
core, label, linalg, and sparse. Separately, the ball_cover test predicate
is_nonzero took a mutable reference and was non-const, so it could not bind
to the const value produced by a thrust transform iterator under ROCm 7.2;
make it operator()(const uint32_t&) const (a predicate must not mutate its
argument). All changes are portable: a checked return and a const-correct
predicate are equally correct on CUDA, so the NVIDIA build is unaffected.

Test Plan

Built the affected test executables for gfx1100 under ROCm 7.2.1 and ran
them on an AMD Radeon Pro W7800:

```
cmake -DBUILD_TESTS=ON -DCMAKE_HIP_ARCHITECTURES=gfx1100 .
cmake --build . --target CORE_TEST LABEL_TEST LINALG_TEST SPARSE_TEST NEIGHBORS_TEST -j16
HIP_VISIBLE_DEVICES=<idle gpu> ctest
```

All previously-uncompilable executables now build and pass: CORE 269 (+1
skip), LABEL 14/14, LINALG 2070/2070, SPARSE 405 (+56 skip), NEIGHBORS 75/75.

This work was authored with the assistance of Claude, an AI assistant.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant