diff options
| author | eunhhu <[email protected]> | 2026-10-19 11:51:58 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-19 11:51:58 +0100 |
| commit | 5db97c60b953205e68d273b9b56424d346fa750d (patch) | |
| tree | 03f0328c53e0ec2cf19d4ad2f71128099151ab48 /research/experiments/045-proof-compiler/native-hook.patch | |
| parent | b14e968e7f4f70897809a7ba6d8495f2b78c95f6 (diff) | |
| download | pure-5db97c60b953205e68d273b9b56424d346fa750d.tar.gz pure-5db97c60b953205e68d273b9b56424d346fa750d.zip | |
045: 029's principle 1 broken on UAX #14 before any emitter, the tools and the numbers: (a) the executor runs 549.9 instructions a code point (the budget's 1,774 counts blocks as written), moves 205.5, constants 76.7 and reads of the same list, version, field and place in an event 16.4, so merging leaves 251.3: 2.19x, the bar 4x (ops-count.patch); (b) the executor's own steps stitched on constant instructions, a function a basic block (stitch.c, native-hook.patch), answers checked: 40,703 to 28,601 machine instructions a point, 15,566 to 11,850 cycles: 1.31x, the bar 3x (cost.c); Vega's C 220 and 82; where it goes: dispatch 22 machine instructions an instruction of 74, an empty handler 1,583 a point, the lists built 22,651 more, the Text record 2,951, decide 12,988 (events.c, variants); a stored list's read 331, a block fn's call 1,375, an arithmetic step 248 in the executor and 35 in batches (unit.c, units)
Diffstat (limited to 'research/experiments/045-proof-compiler/native-hook.patch')
| -rw-r--r-- | research/experiments/045-proof-compiler/native-hook.patch | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/research/experiments/045-proof-compiler/native-hook.patch b/research/experiments/045-proof-compiler/native-hook.patch new file mode 100644 index 0000000..a791e86 --- /dev/null +++ b/research/experiments/045-proof-compiler/native-hook.patch @@ -0,0 +1,25 @@ +diff --git a/core/module.c b/core/module.c +index 4b20e25..fd953e8 100644 +--- a/core/module.c ++++ b/core/module.c +@@ -4967,10 +4967,20 @@ static __attribute__((noinline, aligned(64))) PureResult run_batches(const PureM + return finish(&frame, how, result); + } + ++#ifdef PURE_NATIVE_INC /* research 045: the executor's steps stitched for one module */ ++#include PURE_NATIVE_INC ++#endif ++ + /* At a cache line's start: the steps' branches land where they would (research 126: else 10% more cycles, as many instructions). */ + static __attribute__((aligned(64))) PureResult run(const PureModule *m, PureValue *values, PureBlock block, Event *ev, Slot *result) { + PureCompiled code = m->jit ? pure_jit_code(m->jit, block) : NULL; + if (code) return run_compiled(code, m, values, block, ev, result); ++#ifdef PURE_NATIVE_INC ++ static const PureModule *native_seen; ++ static bool native_ok; ++ if (m != native_seen) native_seen = m, native_ok = native_matches(m) && getenv("PURE_NATIVE"); ++ if (native_ok && m->runner == 2) return run_native(m, values, block, ev, result); ++#endif + if (m->runner) return m->runner == 2 ? run_calls(m, values, block, ev, result) : run_batches(m, values, block, ev, result); + Slot stack[PURE_MODULE_STACK]; + Loop loops[PURE_MODULE_NESTING]; |
