Compile bug: Vulkan backend fails to build since #27512 (`signbit`/`isnan`/`isinf` undeclared in `ggml_fp32_to_f8_e4m3`), GCC 16.2 and clang 22 with libstdc++ 16

Aperta Adatta ai principianti
#31,445 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@huyndao ci sta già lavorando.

Dal 31/10/2026.

  • #31454 di @huyndao — aperta

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
85/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cmake, cpp
Ambito
backend

Direzione di ricerca

L'errore è in ggml-impl.h nella funzione ggml_fp32_to_f8_e4m3 alle righe 593, 596 e 603, dove signbit, isnan e isinf necessitano della qualificazione std::. Riproduci con cmake -B build -DGGML_VULKAN=ON && cmake --build build -j; completato quando le tre unità di traduzione Vulkan compilano senza gli errori di identificatore non dichiarato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug-unconfirmed
Git commit

master at 5047748f (ggml version: 0.28.0, llama.cpp version: 0.8.0-dev), built from source.

Operating systems

Linux

GGML backends

Vulkan

Problem description & steps to reproduce

Since #27512 the Vulkan backend no longer compiles. Three translation units fail, ggml-vulkan.cpp, ggml-vulkan-buffers.cpp and ggml-vulkan-debug.cpp, each with:

ggml-impl.h:593:26: error: 'signbit' was not declared in this scope; did you mean 'std::signbit'?
ggml-impl.h:596:9:  error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
ggml-impl.h:603:9:  error: 'isinf' was not declared in this scope; did you mean 'std::isinf'?

Reproduced with GCC 16.2.0 and with clang 22.0.0 (ROCm 7.2.4, C and C++ compilers both clang). Both use libstdc++ 16 (.../c++/16/cmath appears in the notes). I did not test other standard library versions or libc++.

Steps: cmake -B build -DGGML_VULKAN=ON && cmake --build build -j

First Bad Commit

68d20b88, "Quant: OCP FP8 E4M3 support (#27512)", 2026-10-29.

Bisected by building both sides with identical configuration (GCC 16.2.0, Vulkan and HIP enabled):

  • 68d20b88~1 (ggml commit: 0893ec98): builds successfully to 100%.
  • 68d20b88: fails in the three Vulkan files above.

git log -L on ggml_fp32_to_f8_e4m3 shows the function, with its unqualified signbit/isnan/isinf calls, was introduced by this commit. The clang 22 failure was observed on master, not bisected.

Compile command
cmake -B build -DGGML_VULKAN=ON && cmake --build build -j


- The clang run used `-DCMAKE_C_COMPILER=$(hipconfig -l)/clang -DCMAKE_CXX_COMPILER=$(hipconfig -l)/clang++`
Relevant log output
#### GCC


[ 54%] Building CXX object ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/unary.comp.cpp.o
[ 54%] Building CXX object ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/tri.comp.cpp.o
[ 54%] Building CXX object ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/upscale.comp.cpp.o
[ 55%] Building CXX object ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/wkv6.comp.cpp.o
[ 55%] Building CXX object ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/wkv7.comp.cpp.o
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-buffers.cpp:1:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h: In function ‘uint8_t ggml_fp32_to_f8_e4m3(float)’:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:593:26: error: ‘signbit’ was not declared in this scope; did you mean ‘std::signbit’?
  593 |     const uint8_t sign = signbit(x) ? 0x80 : 0;
      |                          ^~~~~~~
      |                          std::signbit
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:51:
/usr/include/c++/16/cmath:1248:5: note: ‘std::signbit’ declared here
 1248 |     signbit(_Tp __x)
      |     ^~~~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:596:9: error: ‘isnan’ was not declared in this scope; did you mean ‘std::isnan’?
  596 |     if (isnan(x)) {
      |         ^~~~~
      |         std::isnan
/usr/include/c++/16/cmath:1203:5: note: ‘std::isnan’ declared here
 1203 |     isnan(_Tp)
      |     ^~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:603:9: error: ‘isinf’ was not declared in this scope; did you mean ‘std::isinf’?
  603 |     if (isinf(x) || x >= 448.0f) {
      |         ^~~~~
      |         std::isinf
/usr/include/c++/16/cmath:1176:5: note: ‘std::isinf’ declared here
 1176 |     isinf(_Tp)
      |     ^~~~~
gmake[2]: *** [ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/build.make:1027: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/ggml-vulkan-buffers.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-debug.cpp:1:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h: In function ‘uint8_t ggml_fp32_to_f8_e4m3(float)’:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:593:26: error: ‘signbit’ was not declared in this scope; did you mean ‘std::signbit’?
  593 |     const uint8_t sign = signbit(x) ? 0x80 : 0;
      |                          ^~~~~~~
      |                          std::signbit
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:51:
/usr/include/c++/16/cmath:1248:5: note: ‘std::signbit’ declared here
 1248 |     signbit(_Tp __x)
      |     ^~~~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:596:9: error: ‘isnan’ was not declared in this scope; did you mean ‘std::isnan’?
  596 |     if (isnan(x)) {
      |         ^~~~~
      |         std::isnan
/usr/include/c++/16/cmath:1203:5: note: ‘std::isnan’ declared here
 1203 |     isnan(_Tp)
      |     ^~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:603:9: error: ‘isinf’ was not declared in this scope; did you mean ‘std::isinf’?
  603 |     if (isinf(x) || x >= 448.0f) {
      |         ^~~~~
      |         std::isinf
/usr/include/c++/16/cmath:1176:5: note: ‘std::isinf’ declared here
 1176 |     isinf(_Tp)
      |     ^~~~~
gmake[2]: *** [ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/build.make:1041: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/ggml-vulkan-debug.cpp.o] Error 1
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2,
                 from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp:1:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h: In function ‘uint8_t ggml_fp32_to_f8_e4m3(float)’:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:593:26: error: ‘signbit’ was not declared in this scope; did you mean ‘std::signbit’?
  593 |     const uint8_t sign = signbit(x) ? 0x80 : 0;
      |                          ^~~~~~~
      |                          std::signbit
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:51:
/usr/include/c++/16/cmath:1248:5: note: ‘std::signbit’ declared here
 1248 |     signbit(_Tp __x)
      |     ^~~~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:596:9: error: ‘isnan’ was not declared in this scope; did you mean ‘std::isnan’?
  596 |     if (isnan(x)) {
      |         ^~~~~
      |         std::isnan
/usr/include/c++/16/cmath:1203:5: note: ‘std::isnan’ declared here
 1203 |     isnan(_Tp)
      |     ^~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:603:9: error: ‘isinf’ was not declared in this scope; did you mean ‘std::isinf’?
  603 |     if (isinf(x) || x >= 448.0f) {
      |         ^~~~~
      |         std::isinf
/usr/include/c++/16/cmath:1176:5: note: ‘std::isinf’ declared here
 1176 |     isinf(_Tp)
      |     ^~~~~
gmake[2]: *** [ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/build.make:1013: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/ggml-vulkan.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:2663: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2


#### Clang


[ 48%] Building CXX object ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/wkv7.comp.cpp.o
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-buffers.cpp:1:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:593:26: error: use of undeclared identifier 'signbit'; did you mean 'std::signbit'?
  593 |     const uint8_t sign = signbit(x) ? 0x80 : 0;
      |                          ^~~~~~~
      |                          std::signbit
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/cmath:1232:3: note: 'std::signbit' declared here
 1232 |   signbit(float __x)
      |   ^
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-buffers.cpp:1:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:596:9: error: use of undeclared identifier 'isnan'
  596 |     if (isnan(x)) {
      |         ^~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:603:9: error: use of undeclared identifier 'isinf'
  603 |     if (isinf(x) || x >= 448.0f) {
      |         ^~~~~
3 errors generated.
gmake[2]: *** [ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/build.make:1027: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/ggml-vulkan-buffers.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-debug.cpp:1:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:593:26: error: use of undeclared identifier 'signbit'; did you mean 'std::signbit'?
  593 |     const uint8_t sign = signbit(x) ? 0x80 : 0;
      |                          ^~~~~~~
      |                          std::signbit
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/cmath:1232:3: note: 'std::signbit' declared here
 1232 |   signbit(float __x)
      |   ^
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-debug.cpp:1:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:596:9: error: use of undeclared identifier 'isnan'
  596 |     if (isnan(x)) {
      |         ^~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:603:9: error: use of undeclared identifier 'isinf'
  603 |     if (isinf(x) || x >= 448.0f) {
      |         ^~~~~
3 errors generated.
gmake[2]: *** [ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/build.make:1041: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/ggml-vulkan-debug.cpp.o] Error 1
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp:1:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:593:26: error: use of undeclared identifier 'signbit'; did you mean 'std::signbit'?
  593 |     const uint8_t sign = signbit(x) ? 0x80 : 0;
      |                          ^~~~~~~
      |                          std::signbit
/usr/lib/gcc/x86_64-linux-gnu/16/../../../../include/c++/16/cmath:1232:3: note: 'std::signbit' declared here
 1232 |   signbit(float __x)
      |   ^
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp:1:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-common.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-push-constants.h:2:
In file included from /home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan-types.h:93:
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:596:9: error: use of undeclared identifier 'isnan'
  596 |     if (isnan(x)) {
      |         ^~~~~
/home/user/notebooks/llama.cpp/ggml/src/ggml-vulkan/../ggml-impl.h:603:9: error: use of undeclared identifier 'isinf'
  603 |     if (isinf(x) || x >= 448.0f) {
      |         ^~~~~
3 errors generated.
gmake[2]: *** [ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/build.make:1013: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/ggml-vulkan.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:2607: ggml/src/ggml-vulkan/CMakeFiles/ggml-vulkan.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
Lingua principale
C++
Stelle
133k
Fork
24.9k
Merge medio
2g 1h
PR unite (30g)
475

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ggml-org/llama.cpp

Tutte le issue di ggml-org/llama.cpp

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.