|
55 | 55 | - name: Build |
56 | 56 | env: |
57 | 57 | CCACHE_SLOPPINESS: time_macros |
| 58 | + CCACHE_LOGFILE: /tmp/ccache.log |
58 | 59 | run: | |
59 | 60 | emcmake cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build }} \ |
60 | 61 | -DCMAKE_C_COMPILER_LAUNCHER=ccache \ |
61 | 62 | -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
62 | 63 | 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