Commit f6db15e
silicon: wasm-cross-LTO spike — full integration attempt + 3rd synth bug
Pushed the wasm-cross-LTO experiment all the way to a buildable bench
ELF integrated via wasm-ld+arm-ar+linker-substitute. Discovered an
additional synth backend bug while attempting silicon measurement:
synth's emitted memset/memcpy/memmove don't terminate correctly on
Zephyr's startup `memset(bss, 0, sizeof(bss))` invocation. The chip
hangs in memset+0x4c forever, bouncing between offsets 0x668 and
0x67e in a tight inner loop. The synth disassembly reveals i64
shift instructions (`subs.w r3, r2, #32; rsb r3, r2, #32;
lsl.w r3, r1, r3`) lowered into what should be a byte-counter loop
— same root cause as the u64-packed FFI return codegen issue
documented earlier: synth's i64 codegen is incomplete.
End-to-end status:
- wasm-ld static-merging: WORKS. shim.wasm.o + libgale_ffi.a → 1MB
merged.wasm with z_impl_k_sem_give and gale_k_sem_give_decide both
present.
- synth inlining at merged-module scope: STRUCTURALLY WORKS. The
output `z_impl_k_sem_give` body has zero bl gale_k_sem_give_decide
instructions. Verified by disassembly. 138 bytes vs LLVM-LTO's
82 bytes — 1.68x larger but inlined.
- Bench integration: BUILDS. CMake bench builds with
-DGALE_WASM_LTO_OVERRIDE_SEM_GIVE=1 + custom libgale_ffi.a +
--allow-multiple-definition. Final ELF 219 KB FLASH, 66 KB RAM.
- Chip boot: BLOCKED. PC stuck in synth-emitted memset. Workarounds
via objcopy --weaken-symbol, --strip-symbol, --redefine-sym all
failed to evict synth's broken memset bytes from the final ELF.
Three synth backend issues filed against pulseengine/synth, ordered:
1. (blocker) memset/memcpy/memmove i64-codegen non-termination —
prevents the merged-wasm bench from booting at all.
2. u64-packed FFI return unpacking — ~50% of the LTO-parity size
delta. Same i64-codegen root cause as #1.
3. wasm linear-memory access lowering — ~20% of the size delta.
Cosmetic compared to #1 and #2.
Plus one issue against pulseengine/loom:
- Z3 SortDiffers panic in inline_functions pass on i64-heavy
wasm modules. Without loom, the verified-LTO claim doesn't hold.
The structural claim — "wasm-cross-LTO via PulseEngine pipeline
dissolves the C↔Rust seam at wasm IR level" — is **proven by
disassembly**. The cyclical claim — "silicon timing matches LLVM-LTO"
— is **blocked on synth's memset codegen**. Neither is a fundamental
architectural barrier; both are well-scoped engineering work.
This commit only updates the NOTES with the integration findings.
The bench source is restored to clean state (the gale_sem.c
#ifndef edit was transient) and verified building unchanged at
27 KB FLASH at the canonical rustc-direct path.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 35f90fb commit f6db15e
1 file changed
Lines changed: 94 additions & 7 deletions
Lines changed: 94 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
101 | 150 | | |
102 | 151 | | |
103 | 152 | | |
| |||
113 | 162 | | |
114 | 163 | | |
115 | 164 | | |
116 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
117 | 173 | | |
118 | 174 | | |
119 | 175 | | |
120 | | - | |
121 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
122 | 180 | | |
123 | 181 | | |
124 | 182 | | |
125 | 183 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
129 | 216 | | |
130 | 217 | | |
131 | 218 | | |
| |||
0 commit comments