Skip to content

Commit cf94767

Browse files
committed
squash! ci : add ccache to build-wasm
Debugging...
1 parent 9501831 commit cf94767

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

.github/workflows/build-wasm.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,50 @@ jobs:
5555
- name: Build
5656
env:
5757
CCACHE_SLOPPINESS: time_macros
58+
CCACHE_LOGFILE: /tmp/ccache.log
5859
run: |
5960
emcmake cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build }} \
6061
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
6162
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
6263
cmake --build build -j $(nproc)
64+
65+
- name: ccache log (ggml.cpp first miss)
66+
run: |
67+
echo "=== ccache stats ==="
68+
ccache -s
69+
echo "=== all Result lines ==="
70+
grep "Result:" /tmp/ccache.log | head -20
71+
echo "=== first ggml.cpp invocation ==="
72+
awk '/ggml\.cpp\.o/{found=1} found{print; if(/Result:/) exit}' /tmp/ccache.log | head -80
73+
74+
- name: emcc -E determinism check
75+
run: |
76+
# Use real flags from cmake's compile_commands.json for ggml.cpp
77+
FLAGS=$(python3 -c "
78+
import json, sys
79+
db = json.load(open('build/compile_commands.json'))
80+
for e in db:
81+
if 'ggml.cpp.o' in e['output'] and 'ggml-base' in e['output']:
82+
# extract flags, drop -o/-c/-MD/-MF/-MT and their args
83+
import shlex
84+
args = shlex.split(e['command'])[1:] # drop compiler
85+
out = []
86+
skip = False
87+
for a in args:
88+
if skip: skip=False; continue
89+
if a in ('-o','-MF','-MT'): skip=True; continue
90+
if a in ('-c','-MD'): continue
91+
if a.endswith('.cpp'): continue
92+
out.append(a)
93+
print(' '.join(out))
94+
sys.exit(0)
95+
" 2>/dev/null || echo "-I ggml/include")
96+
echo "Preprocessing flags: $FLAGS"
97+
emcc -E $FLAGS ggml/src/ggml.cpp -o /tmp/pp1.cpp 2>/dev/null
98+
emcc -E $FLAGS ggml/src/ggml.cpp -o /tmp/pp2.cpp 2>/dev/null
99+
if diff -q /tmp/pp1.cpp /tmp/pp2.cpp > /dev/null 2>&1; then
100+
echo "DETERMINISTIC: emcc -E produces identical output for consecutive runs"
101+
else
102+
echo "NON-DETERMINISTIC: diff follows (first 30 lines):"
103+
diff /tmp/pp1.cpp /tmp/pp2.cpp | head -30
104+
fi

0 commit comments

Comments
 (0)