Skip to content

Commit 4633166

Browse files
committed
ci: patch get_rows_f32 diagnostics on linux
1 parent 40b2083 commit 4633166

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/test.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,31 @@ jobs:
5656
uname -a
5757
lscpu
5858
python -c "import platform; print(platform.machine(), platform.architecture())"
59+
- name: Instrument Linux get_rows_f32 assertion
60+
run: |
61+
python - <<'PY'
62+
from pathlib import Path
63+
64+
path = Path("vendor/llama.cpp/ggml/src/ggml-cpu/ops.cpp")
65+
text = path.read_text()
66+
old = """ GGML_ASSERT(i01 >= 0 && i01 < ne01);
67+
68+
ggml_vec_cpy_f32(nc,"""
69+
new = """ if (!(i01 >= 0 && i01 < ne01)) {
70+
fprintf(stderr,
71+
"%s: invalid row index in get_rows_f32: dst=%s src0=%s src1=%s i=%lld i10=%lld i11=%lld i12=%lld i01=%lld ne01=%lld src1_ne=[%lld,%lld,%lld,%lld]\\n",
72+
__func__, dst->name, src0->name, src1->name,
73+
(long long) i, (long long) i10, (long long) i11, (long long) i12,
74+
(long long) i01, (long long) ne01,
75+
(long long) ne10, (long long) ne11, (long long) ne12, (long long) ne13);
76+
}
77+
GGML_ASSERT(i01 >= 0 && i01 < ne01);
78+
79+
ggml_vec_cpy_f32(nc,"""
80+
if old not in text:
81+
raise SystemExit("get_rows_f32 assertion pattern not found")
82+
path.write_text(text.replace(old, new, 1))
83+
PY
5984
- name: Install dependencies (Linux/MacOS)
6085
run: |
6186
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)