HIP build fails for networks with no intermediate reactions with libstdc++ >= 13 (std::array<int, 0> in locate_intermediate_rate_index)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 69/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- cpp
- Área
- backend, build-system
Línea de trabajo
Empieza en networks/rhs.H, en locate_intermediate_rate_index, donde el issue señala un amrex::Array de tamaño cero y el acceso que falla. Comprueba cómo gestiona la función las redes sin reacciones intermedias y luego compila la red de prueba triple_alpha_plus_cago usando el comando make HIP del issue con libstdc++ 13 o posterior. El trabajo está terminado cuando la compilación HIP se complete correctamente; el issue sugiere dar al array al menos un elemento.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
HIP builds of networks with no intermediate reactions (e.g. triple_alpha_plus_cago) fail to compile when the host C++ standard library is libstdc++ 13 or newer. libstdc++ 13 is the default on Ubuntu 24.04.
Error
On current development (60562512):
cd unit_test/test_react
make USE_HIP=TRUE AMD_ARCH=gfx90a NETWORK_DIR=triple_alpha_plus_cago
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/array:209:9: error: reference to __host__ function 'operator[]' in __host__ __device__ function
209 | return _M_elems[__n];
| ^
/usr/lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/array:74:13: note: 'operator[]' declared here
74 | _Tp& operator[](size_t) const noexcept { __builtin_trap(); }
| ^
../../networks/rhs.H:142:28: note: called by 'locate_intermediate_rate_index'
142 | if (indices[n-1] == data.additional_reaction_1) {
Environment: Ubuntu 24.04, ROCm 10.1 (hipcc: HIP 7.16, AMD clang 24.0.0git), libstdc++ 13.3 and 14.
Cause
locate_intermediate_rate_index in networks/rhs.H declares
amrex::Array<int, num_intermediate> indices = {};
which is a std::array<int, 0> when the network has no intermediate reactions. Starting with GCC 13, libstdc++ implements the zero-size std::array storage as an empty struct whose operator[] is a plain, non-constexpr host function that just traps. hipcc rejects any reference to it from a __host__ __device__ function, even inside a loop that never executes (n <= num_intermediate with num_intermediate == 0). libstdc++ 11 used a constexpr static helper there, so this compiled before.
CI doesn't catch it because .github/workflows/hip.yml only builds iso7 and URCA-simple, which both have intermediate reactions.
Minimal reproducer (no Microphysics)
// repro.cpp
#include <hip/hip_runtime.h>
#include <array>
__host__ __device__ constexpr int find_index (int x)
{
constexpr int n_items = 0;
std::array<int, n_items> a = {};
for (int n = 1; n <= n_items; ++n) {
if (a[n-1] == x) {
return n;
}
}
return -1;
}
__global__ void kernel (int* out) { *out = find_index(3); }
hipcc --offload-arch=gfx90a -std=c++20 --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/11 -c repro.cpp # compiles
hipcc --offload-arch=gfx90a -std=c++20 --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/13 -c repro.cpp # error above
hipcc --offload-arch=gfx90a -std=c++20 --gcc-install-dir=/usr/lib/gcc/x86_64-linux-gnu/14 -c repro.cpp # error above
Possible fix
Give the array at least one element, e.g. int indices[num_intermediate > 0 ? num_intermediate : 1] = {};. The loops only touch the first num_intermediate elements, so the results don't change.
This was found while porting triple_alpha_plus_cago to Loom, but it is a stock HIP build failure with no Loom code involved. CUDA builds against libstdc++ 13+ probably fail the same way, but that is untested.
- Lenguaje dominante
- C++
- Estrellas
- 44
- Forks
- 47
- Merge medio
- 5 d 5 h
- PR fusionados (30 d)
- 6
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AMReX-Astro/Microphysics
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
AMReX-Astro/Microphysics#2104 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
ai-code-audit screening
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
AMReX-Astro/Microphysics#2097 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
ai-code-audit screening
Dificultad 4/5 3-5 días Aptitud para principiantes 72/100
AMReX-Astro/Microphysics#2096 ·
Los mantenedores suelen responder en 1 día
-
ai-code-audit screening
Dificultad 4/5 3-5 días Aptitud para principiantes 66/100
AMReX-Astro/Microphysics#2095 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
ai-code-audit nse
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
AMReX-Astro/Microphysics#2075 ·
Los mantenedores suelen responder en 1 día
Todos los issues de AMReX-Astro/Microphysics
Issues similares
-
Linux npm packaging leaves workspace files that block subsequent CI checkoutPosiblemente ocupada @Spockkk0225 la tomó hoy. Abiertoci
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
alibaba/neug#1195 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días
-
QA/No release-notes/exclude tests tests/missing-coverage tests/test-quality
Dificultad 2/5 1-3 horas Aptitud para principiantes 71/100
brave/brave-browser#61019 ·
Los mantenedores suelen responder en 1 día
-
? - Needs Triage bug CUTLASS C++
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 4 días