diff options
| author | 2026-10-12 08:46:23 +0330 | |
|---|---|---|
| committer | 2026-10-12 08:46:23 +0330 | |
| commit | ecc350ca5c2eb50be8309c5f14f8bf0d87db9a02 (patch) | |
| tree | 70e0af76a1b13affff7c6cc8aac7b3e6ef960478 /docs/history/41-obytes | |
a
Diffstat (limited to 'docs/history/41-obytes')
| -rw-r--r-- | docs/history/41-obytes/notes.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/history/41-obytes/notes.md b/docs/history/41-obytes/notes.md new file mode 100644 index 0000000..cf3280d --- /dev/null +++ b/docs/history/41-obytes/notes.md @@ -0,0 +1,39 @@ +# 41 — byte ops in o3 + +opcodes 612..617 (`ld8`, `st8`, and the 16- and 32-bit pair) lift. a call to one of those six from o3 code emits the opcode instead of leaving the region. the interpreter, the arm64 jit and llvm each run it: an out-of-range load is 0, an out-of-range store does nothing, and a store into a word a translation covers goes through the same hook as a word store, so a patch of the program's own code still drops that translation. the byte cases sit on the default path of the region interpreter, so the switch that runs the word sieve stays the size it was. + +`tests/o3bytes.zc` writes twenty bytes, reads them back at 8, 16 and 32 bits, rejects an address off either end of memory, and patches a `putc` literal from inside a region. it prints `190 4660 7 2055 16909060 0 0` and then `ABC`. the fixpoint is 110426 words. the suite is 442 passed, 0 failed: interpreter, microcore, soft-float, the small and run-only maps, both virt boards, the arm64 jit and llvm. + +## sieve + +milliseconds per count, median of five slopes. the before column is `history/40-fatten`. the kernels are still one word per flag. this pass does not change them. + +| path | before | after | +| --- | ---: | ---: | +| gcc -O3 -march=native, word flags | 0.151 | 0.150 | +| gcc -O3 -march=native -flto, byte flags | 0.084 | 0.081 | +| zc interpreter, plain, bounds-checked | 146.8 | 145.6 | +| zc interpreter, o3, bounds-checked | 12.75 | 13.22 | +| zc interpreter, o3, raw pointer | 8.09 | 7.87 | +| zc llvm, ZYHOT=1, o3 raw pointer | 0.233 | 0.233 | +| zc llvm, ZYHOT=1, o3 bounds-checked | 0.444 | 0.438 | +| zc arm64 jit, qemu-user, o3 raw pointer | 1.936 | 1.963 | + +`bench/run.sh` timed the llvm raw pointer at 3684 repetitions, median 0.250 ms (0.176 to 0.286), and the checked sieve at 1460 repetitions, median 0.423 ms (0.230 to 0.558). a slope from 4000 repetitions to 16000 on the same binary is 0.233 ms for the raw pointer (0.208 to 0.237) and 0.438 ms for the checked sieve (0.432 to 0.477). those two are the after column. the interpreter's raw pointer went from 8.09 ms to 7.87 ms. the checked o3 sieve went from 12.75 ms to 13.22 ms. gcc's byte flags were 0.081 ms. + +## trees + +milliseconds per tree of depth 12. these kernels do not touch a byte. gcc on this run was 0.094 for malloc and 0.0144 for the arena. the o3 tree stays ahead of the plain one. + +| path | before | after | +| --- | ---: | ---: | +| gcc -O3 -march=native, malloc | 0.091 | 0.094 | +| gcc -O3 -march=native -flto, arena | 0.0144 | 0.0144 | +| zc interpreter, plain new/free | 72.97 | 72.86 | +| zc interpreter, o3 new/free | 64.89 | 65.55 | +| zc interpreter, o3 arena | 1.411 | 1.378 | +| zc llvm, ZYHOT=1, plain new/free | 7.42 | 8.08 | +| zc llvm, ZYHOT=1, o3 new/free | 6.49 | 6.95 | +| zc llvm, ZYHOT=1, o3 arena | 0.175 | 0.163 | +| zc arm64 jit, qemu-user, plain new/free | 44.12 | 44.15 | +| zc arm64 jit, qemu-user, o3 arena | 0.780 | 0.704 | |
