Closed Bug 2006241 Opened 7 months ago Closed 7 months ago

llama.cpp needs to include <algorithm> for std::max when compiled as C++23

Categories

(Core :: Machine Learning: On Device, task)

task

Tracking

()

RESOLVED FIXED
148 Branch
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));
| ~~~~~^

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));
| ~~~~~^

Attachment #9533240 - Attachment is obsolete: true

Since this is a fix that could benefit other llama.cpp users, I submitted a PR to llama.cpp upstream:

https://github.com/ggml-org/llama.cpp/pull/18078

Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch
QA Whiteboard: [qa-triage-done-c149/b148]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: