feat(kernels) fix HIPRTC build error ROCm 6/7#9382
Merged
Conversation
`const bool odd{ _ind.size() & 1 };` triggered a hard compile error under
clang/HIPRTC:
> non-constant-expression cannot be narrowed from type ‘ptrdiff\_t’ to ‘bool’ in initializer list \[-Wc++11-narrowing]
C++11 **list-initialization** (`{...}`) forbids implicit narrowing conversions.
Here `_ind.size()` returns an integral type (e.g., `ptrdiff_t`), and brace-
initializing a `bool` from a non-constant integral expression is ill-formed.
Change the expression to produce a real `bool`:
```cpp
const bool odd{ (_ind.size() & 1) != 0 }; // (or: _ind.size() % 2 != 0)
```
This avoids narrowing, keeps brace-init, and restores compatibility with
HIPRTC/clang and other strict compilers/flags.
We have also updated kernels to use the default hipRTC compilation standard (14).
This enables cepstrum tests on ROCm 7.0
Member
|
/test mini |
kmaehashi
approved these changes
Sep 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
const bool odd{ _ind.size() & 1 };triggered a hard compile error under clang/HIPRTC:C++11 list-initialization (
{...}) forbids implicit narrowing conversions. Here_ind.size()returns an integral type (e.g.,ptrdiff_t), and brace- initializing aboolfrom a non-constant integral expression is ill-formed.Change the expression to produce a real
bool:This avoids narrowing, keeps brace-init, and restores compatibility with HIPRTC/clang and other strict compilers/flags.
We have also updated kernels to use the default hipRTC compilation standard (14). This enables cepstrum tests on ROCm 7.0
@kmaehashi It would be great to get this backported to v13 since this doesn't break any behavior