Skip to content

fix(ggml): compile error on centos 7.9 and gcc7 - #227

Closed
tpoisonooo wants to merge 1 commit into
ggml-org:masterfrom
tpoisonooo:fix-centos79
Closed

tpoisonooo wants to merge 1 commit into
ggml-org:masterfrom
tpoisonooo:fix-centos79

Conversation

@tpoisonooo

@tpoisonooo tpoisonooo commented Mar 17, 2023 •

Copy link
Copy Markdown

fix build error on CentOS 7.9 and gcc7/gcc9

ggml.c:309:19: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)
     clock_gettime(CLOCK_MONOTONIC, &ts);

Here is my OS version

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.9.2009 (Core)
Release:        7.9.2009
Codename:       Core

After fix it works.

I llama.cpp build info: 
I UNAME_S:  Linux
I UNAME_P:  x86_64
I UNAME_M:  x86_64
I CFLAGS:   -I.              -O3 -DNDEBUG -std=c11   -fPIC -pthread -mavx -mavx2 -mfma -mf16c -msse3
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread
I LDFLAGS:  
I CC:       cc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
I CXX:      g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)

@tpoisonooo tpoisonooo closed this Mar 17, 2023
AAbushady pushed a commit to AAbushady/llama.cpp that referenced this pull request Jan 27, 2024
merging this, please let me know if anything breaks.
kiljoy001 pushed a commit to kiljoy001/llama.cpp that referenced this pull request Oct 26, 2026
…-org#227)

* gguf : guard legacy Q2_0 layout hint against non-divisible rows

ggml_row_size(GGML_TYPE_PQ2_0, ne) asserts ne % QK_PQ2_0 == 0, but a group-64
Q2_0 row only guarantees ne % QK2_0 == 0. Fall back to the real padded size
for rows the hint cannot size, so the hint no longer depends on asserts.

Assisted-by: Kimi Code

* tests : add Q2_0 odd-block case to test-gguf

Regression case for the legacy Q2_0 layout hint: a group-64 row that is
not PQ2_0-divisible must parse without depending on ggml_row_size
asserts. Aborts before the gguf fix, passes after.

Assisted-by: Kimi Code
jammm pushed a commit to jammm/llama.cpp that referenced this pull request Nov 19, 2026
## Overview

The validated change adds SmolLM3 to the existing HRX row64 architecture preference and policy test matrix. Two source lines added on merged origin/hrx-graph-develop-v2 at 5ab7ff3, including ggml-org#226. Existing matchers, kernels and tolerances are preserved. Related issue ROCm/ggml-staging-automation#171 and bead lemonade-ws-bpes.10.

Only the staging bb769c0 manifest-listed SmolLM3-3B-128K-UD-Q4_K_XL.gguf was tested. Verified 1,940,419,168 bytes and SHA-256 0e4e576593099b672b02ee5b516983d35db56ed29eeef5f9135633d339bf1e74, repository revision 3d9d3591996644952b74d2efb7b433450fd3da82. It has 156 Q4_K, 52 Q6_K, 25 Q5_K, 20 IQ4_XS and 73 F32 tensors, a tied Q6_K token embedding/output and 36 attention layers. The source audit and tensor inventory describe eligible and fallback consumers.

GPU Radeon 8065S gfx1151, ROCR_VISIBLE_DEVICES=0. Release clang/ROCm 10.1.0a20260822-1151, hrx-system b859a32e, four CPU threads, full offload, flash attention. Previous family dependency sources, compiled HRX/loomc, Loom tools and corpus are reused read-only. Both llama.cpp variants were built and snapshotted here. Corpus SHA-256 173c87a53759e0201f33e0ccf978e510c2042d7f2cb78229d9a50d79b9e7dd08. Final configuration, binary hashes, commands and environment are retained.

Both established staging perplexity regimes pass the unchanged HRX/Vulkan ratio tolerance 1.1.

| Regime | Baseline HRX | Candidate HRX | Vulkan both |
|---|---|---|---|
| ctx512/b512/ub512/chunks32 | 8.9931 +/- 0.26299 | 8.9931 +/- 0.26299 | 9.0002 +/- 0.26314 |
| ctx512/b512/ub1/chunks2 | 7.4655 +/- 0.93595 | 7.4655 +/- 0.93595 | 7.4646 +/- 0.9359 |

All 212 existing focused policy/reference cases pass, covering both target policies, row64 Q4_K/Q6_K readers, tied embeddings, Q5_K/IQ4_XS metadata/fallback readers and head128 attention. Automatic codex review reports no findings and independently passes 124 host route checks. Changed-file EditorConfig, 174 model mappings and diff whitespace checks pass.

Two default-warmed standalone llama-bench ABBA blocks, five repeats per invocation, 240 timed samples. Both variants use b512/ub512. Each case has 20 timed samples per variant. Diagnostic runs follow the throughput runs. All samples, including invocation-level output, remain in the raw JSON files and main-samples.csv.

| Case | Baseline median t/s | Candidate median t/s | Pooled change | Block1 | Block2 |
|---|---|---|---|---|---|
| pp66 | 1044.88 | 1187.24 | +13.63% | +13.52% | +17.36% |
| pp128 | 1783.17 | 2416.75 | +35.53% | +35.25% | +34.49% |
| pp256 | 3472.57 | 3517.98 | +1.31% | +0.72% | +2.08% |
| pp512 | 3863.43 | 3857.96 | -0.14% | -0.66% | -0.12% |
| pp1024 | 3683.51 | 3691.51 | +0.22% | +0.61% | +0.26% |
| tg128 | 90.05 | 89.95 | -0.11% | -0.42% | +0.07% |

The measured costs are pp512 pooled -0.14% and decode pooled -0.11%. Individual block pp512 changes are -0.66% and -0.12%, and decode changes are -0.42% and +0.07%. No material throughput regression appeared in these samples. Coverage is this model, GPU and settings. pp1024 executes in two ub512 chunks. Long-context performance and other GGUF formats were outside this validation.

Synchronized measurements after prefill and through 128-token decode show candidate cached weights remain at 327 allocations and 2,148,044,800 bytes for prompts 66/128/256/512/1024. There are zero additional decode materializations and zero duplicate-layout warnings. Baseline reaches 529 allocations/202 warnings at pp66/128, and 373 allocations/46 warnings at pp256/512/1024. Shared weight-cache savings are 1,239,834,624 bytes (1182.40 MiB) and 215,900,160 bytes (205.90 MiB), respectively. The 327 candidate allocations include existing metadata representations for fallback formats.

Separately measured device residency comes from synchronized DRM fdinfo snapshots, deduplicated by client ID. These UMA resident GTT/VRAM values include model mappings, KV, activations and runtime allocations beyond the weight cache.

| Prompt | Variant | Weight cache bytes after decode | Resident GTT bytes | Resident VRAM bytes |
|---|---|---|---|---|
| 66 | baseline | 3387879424 | 3639926784 | 1875968 |
| 66 | candidate | 2148044800 | 2400120832 | 1114112 |
| 128 | baseline | 3387879424 | 3681832960 | 1875968 |
| 128 | candidate | 2148044800 | 2441998336 | 1114112 |
| 256 | baseline | 2363944960 | 2760925184 | 1257472 |
| 256 | candidate | 2148044800 | 2545025024 | 1118208 |
| 512 | baseline | 2363944960 | 2876911616 | 1249280 |
| 512 | candidate | 2148044800 | 2661011456 | 1126400 |
| 1024 | baseline | 2363944960 | 2916884480 | 1290240 |
| 1024 | candidate | 2148044800 | 2700984320 | 1110016 |

Captured pp512 production programs have 542 commands in each variant, with identical kernel names and transient plans. Fifty Q6 prefill and one Q6 vector command change compile parameters to the row64 representation. Decode has 326 commands in each variant, with the same kernel names and transient plan, and five Q6 vector commands change format parameters. The pp512 graph includes 36 flash-attention commands, 27 query RoPE and 27 key RoPE/set-rows commands, exercising nine no-RoPE layers as well as 27 RoPE layers. Both phases include the tied embedding reader. Q5_K/IQ4_XS fallback command records retain their existing routes.

Evidence includes summary.json, main-samples.csv, model-identity.json, tensor-inventory.json, source-audit.md, pins.json, configure-command.json, binary-identity.json, commands.jsonl, execution.jsonl, focused-tests.log, automatic-review.log, production graph programs, synchronized residency counters and DRM fdinfo. Parent performs independent review, the user owns merge and the parent closes the bead/ticket after acceptance.

## Requirements

- I have read the contributing guidelines. This PR targets the AMD-Ecosystem fork under explicit publication authorization.
- AI usage disclosure YES. Codex implemented the preference and matrix opt-in, ran validation and automatic review, and prepared this evidence and PR. The submitting contributor owns the changes. Parent reviews independently and the user merges.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant