llama.cpp needs to include <algorithm> for std::max when compiled as C++23
Categories
(Core :: Machine Learning: On Device, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox148 | --- | fixed |
People
(Reporter: cpeterson, Assigned: cpeterson)
References
Details
Attachments
(1 file, 1 obsolete file)
When compiling with -std=c++23, clang defines _LIBCPP_REMOVE_TRANSITIVE_INCLUDES, causing the <algorithm> header to no longer be included in llama-hparams.cpp. Until this issue is fixed in upstream llama.cpp, we can include the <algorithm> header in moz-overrides.h.
https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html
llama.cpp/src/llama-hparams.cpp:99:20: error: no member named 'max' in namespace 'std'
99 | val = std::max(val, n_embd_k_gqa(il));
| ~~~~~^
llama.cpp/src/llama-hparams.cpp:108:20: error: no member named 'max' in namespace 'std'
108 | val = std::max(val, n_embd_v_gqa(il));
| ~~~~~^
| Assignee | ||
Comment 1•7 months ago
|
||
When compiling with -std=c++23, clang defines _LIBCPP_REMOVE_TRANSITIVE_INCLUDES, causing the <algorithm> header to no longer be included in llama-hparams.cpp. Until this issue is fixed in upstream llama.cpp, we can include the <algorithm> header in moz-overrides.h.
https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html
llama.cpp/src/llama-hparams.cpp:99:20: error: no member named 'max' in namespace 'std'
99 | val = std::max(val, n_embd_k_gqa(il));
| ~~~~~^
llama.cpp/src/llama-hparams.cpp:108:20: error: no member named 'max' in namespace 'std'
108 | val = std::max(val, n_embd_v_gqa(il));
| ~~~~~^
Updated•7 months ago
|
| Assignee | ||
Comment 2•7 months ago
|
||
Since this is a fix that could benefit other llama.cpp users, I submitted a PR to llama.cpp upstream:
Comment 3•7 months ago
|
||
Comment 4•7 months ago
|
||
@cpeterson : patch backported, and https://treeherder.mozilla.org/jobs?repo=try&revision=5b560c7596fed92c7e1e25bd8022b1e251a72d96 looks good, Bug 2005997 seems unblocked!
Updated•6 months ago
|
Description
•