Open Manual

Recorded measurements

This page is the current picture: a dashboard generated from every saved full benchmark run, the latest run's detail, and the compile-time baseline. Dated investigations, profiles, and rejected experiments are in the measurement log at the end of this page.

NYR is the native backend, LLVM the LLVM backend, and NYC the C front end. Ratios are runtime relative to Host C: below 1× is faster than C. Matching checksums establish agreement for the measured input, not general correctness. The dashboard is regenerated by every full ./make bench and by ./make docs; the latest-run section is written by the C benchmark runner.

On this page

Benchmark dashboard: trend, bands, every benchmark, largest gaps Latest full benchmark run Compile-time baseline Reading the results Measurement log: investigations, profiles, and rejected experiments Measurement and profiling method

Benchmark dashboard

Generated from 24 full ./make bench reports; the latest is build/bench-reports/bench-20261120-073700-4013272.json (11-20 07:37). Ratios are runtime relative to Host C on the same host: below 1× is faster than C. Only checksum-correct, valid comparisons count. Wall times on this host are noisy (C references moved up to 2× between runs), so read trends, not single points.

BackendGeomean vs CBenchmarks ≤2×AboveCompared
NYR1.31×8622108
LLVM1.08×9512107
NYC1.67×8128109
Geomean runtime vs C, per full run (lower is better) 1.0× 1.2× 1.4× 1.6× 1.8× 2.0× NYR LLVM NYC 11-19 10:51 11-19 11:25 11-19 11:42 11-19 12:26 11-19 21:02 11-19 23:38 11-20 00:51 11-20 03:56 11-20 07:37 Benchmarks per runtime band vs C, latest run 19 35 6 ≤1× 51 48 48 1–1.5× 16 12 27 1.5–2× 18 9 23 2–4× 4 3 5 >4× NYR (108) LLVM (107) NYC (109) NYR runtime vs C (log scale; ≤2× green, >2× red) 0.25× 0.5× 1× 2× 4× 8× 16× dce<0.01 pbkdf20.14 repeat0.25 mixed-static-island0.37 list-any-append0.47 pbkdf2 #20.62 imagick0.73 string0.76 append-scaling0.79 fft0.79 dict0.81 binary0.81 graph-bfs0.85 fibonacci0.90 dict-set0.91 time-profile0.94 transpose0.95 stream0.96 licm-math0.98 sor1.00 vector1.00 matmult-int1.01 straight1.01 prime1.02 matrix-raw1.02 sha256 #21.03 float1.03 permute1.04 calls1.05 crc321.05 loop-unswitch1.06 radix-tree1.08 float-cmp-oracle1.09 mandelbrot1.10 cmov-sort1.11 bce-matrix1.11 fannkuch1.12 tce-recursion1.12 loop1.13 expression-tree1.14 splay1.15 deltablue1.15 escape-loop1.16 thread-ring1.16 word-frequency1.17 havlak1.17 hash1.21 doitgen1.21 leela1.23 json-parser1.25 knucleotide1.29 word-frequency-scan1.29 matmul-int1.29 richards1.33 binary-trees1.33 nqueens1.33 list-dynamic1.34 sha2561.35 heapsort-int1.35 mcf1.36 fasta1.36 sieve1.36 intops1.38 towers1.41 currying1.44 n-body1.45 sssp1.46 stringsearch1.46 list1.48 statemate1.50 knucleotide #21.52 euler91.54 knight1.54 pidigits1.56 omnetpp1.58 queen1.66 iter1.70 dijkstra1.70 spectral1.70 povray1.70 collatz1.76 heapsort1.89 licm1.93 nussinov1.94 gcbench1.96 qrsyndrome1.99 bitcount2.01 linpack2.04 jacobi-2d2.04 call-chain2.10 inline2.25 mandel2.31 mont642.44 ackermann2.52 matrix2.62 susan2.78 dgemm2.93 xz2.93 fhourstones2.95 records2.97 native-oracle3.10 viterbi3.27 revcomp3.47 lbm3.52 page-rank4.35 dict-oracle4.84 cd5.39 bigint-oracle9.76

Largest gaps above 2× (C reference ≥ 1 ms)

BenchmarkBackendRuntime / CC time
bigint-oracleNYR9.76×3.7 ms
pbkdf2NYC8.83×1.2 ms
bigint-oracleLLVM8.67×3.7 ms
pbkdf2NYC8.64×1.2 ms
binaryNYC8.18×1.1 ms
cdNYC8.15×1.1 ms
cdNYR5.39×1.1 ms
lbmNYC3.78×1.3 ms
viterbiNYC3.74×1.2 ms
recordsNYC3.63×19.2 ms
lbmNYR3.52×1.3 ms
viterbiNYR3.27×1.2 ms
fhourstonesNYC3.19×1.0 ms
recordsNYR2.97×19.2 ms
fhourstonesNYR2.95×1.0 ms

Bars for workloads whose C reference is under 1 ms are drawn lighter: their ratios are dominated by timer resolution.

Latest full benchmark run

Generated automatically by the full ny-test --bench run. Host: AMD EPYC 7642; target x86_64; compiler fnv1a64:415f4239906aed14. NYR: -O3, profile peak, tier opt, engine NYR, cache warm. C: clang version 23.1.5; flags -O3 -march=native. NYC flags -O3 -c. Samples: 3 plus 1 warm-up; fixture workers 27, route workers 1. Results: 110 fixtures; 109 passed, 0 failed or mismatched, 1 timer controls. Measurement qualifiers: 1 low-time, 1 noisy; 0 fixture budget misses.

Runtime relative to Host C

Fixture medians are grouped by Nytrix / C time: lower is faster. Only correctness-passing, stable, above-timer-floor comparisons are counted; the 1× boundary means parity. This distribution is an overview, not a replacement for per-fixture samples in the linked raw report.

Workloads by relative runtime 0 15 30 45 60 2 5 <0.5× 3 4 0.5–0.8× 47 57 0.8–1.25× 35 29 1.25–2× 19 11 ≥2× fixture count NYR (106)LLVM (106)

The empty timer control is shown for completeness and is excluded from workload ratios. Raw report: build/bench-reports/bench-20261120-062227-3652437.json.

Compile-time baseline and serial fixes (2026-11-17)

Host AMD EPYC 7642 (48 cores, 96 threads, 62 GiB), other sessions active. the local compile-time baseline script compiles every etc/labs target to a native -O2 executable (--native-only --run=none). Cold: fresh cache directory, NYTRIX_STD_CACHE=0 NYTRIX_AOT_CACHE=0, runtime object prebuilt. Warm and no-op reruns hit the AOT cache. The standard-library source cache does not shorten an edited program's compile: a one-file edit costs a cold compile. "Before" is HEAD 4cb1bfb7; "after" adds the changes below.

ProjectCold beforeCold afterPeak RSS afterWarm
1102.4 s1.9 s471 MiB0.11 s
ant2.9 s2.5 s653 MiB0.12 s
args2.2 s1.8 s552 MiB0.11 s
brainfuck✗✗711 MiB—(links ../../build/release relative to the working directory)
conway2.7 s2.2 s651 MiB0.12 s
donut2.8 s2.3 s641 MiB0.13 s
ffi1.4 s1.2 s300 MiB0.11 s
herodoc0.5 s0.5 s158 MiB0.10 s
hexdump2.4 s1.9 s480 MiB0.13 s
matrix2.8 s2.4 s580 MiB0.08 s
server2.8 s2.3 s643 MiB0.12 s
sound6.4 s²5.2 s1304 MiB0.08 s
ui-animation21.4 s16.0 s2032 MiB0.18 s
ui-breakout✗18.4 s2091 MiB—(did not compile before; see below)
ui-editor60.7 s45.3 s3115 MiB0.24 s
ui-engine57.3 s40.6 s3471 MiB0.24 s
ui-input37.0 s25.9 s2727 MiB0.20 s
ui-monitor30.8 s19.8 s2396 MiB0.19 s
ui-pong22.6 s16.4 s2059 MiB0.19 s
ui-postfx27.3 s20.5 s2640 MiB0.21 s
ui-smem30.3 s22.5 s2610 MiB0.20 s
ui-synth33.3 s²23.6 s2481 MiB—
ui-term35.0 s¹23.8 s2321 MiB0.21 s
ui-widgets36.6 s¹25.3 s2982 MiB0.21 s
xtool6.2 s4.1 s655 MiB0.08 s

¹ The cold rerun overlapped other builds (93.5 s and 78.1 s); the value is the same compiler's first, cache-populating run. ² Measured after the wav.ny fix below; at HEAD these did not compile.

Editor phase split (main thread, cumulative timers): parse 0.5 s, codegen prepare 2.2 s, HM type validation 8.1 → 6.0 s; NYIR build: reachability 6.3 → 2.1 s, function lowering (serial) 15.6 → 11.7 s, post-inline optimization 4.4 s (parallel by call-graph level), rt_main lowering 4.3 → 3.3 s; machine lowering, encoding and ELF writing about 3.5 s in parallel. a local aggregation script attributes perf record --call-graph dwarf samples to the main thread, which sets wall time.

Retained changes. Each one leaves the editor executable byte-identical (sha256), and etc/tests/lang passed 1447/1447 with all of them:

nyr_find_user_function: 3,501 whole-program AST walks resolved names such as s.len (a member of a local), 1.7 ms each. 3,158 of them found nothing, 6.0 s in total. A leaf-chained table of every function name in both branches of every guard now proves "no function can match" before the walks. The unique-suffix scan walks the leaf chain instead of all 14k indexed functions. nyr_value_scalar_class built, scattered and freed a whole-function type map (seven flag arrays) per query. It now builds only the union-find roots, in a per-thread workspace, and reads one value's bits. Bare-name import-alias resolution re-walked every used module's use statements for every unresolved identifier, mostly locals, 11% of the main thread. Results are now memoized per (codegen, module, name). ny_trace_enabled scanned the 130-entry environment two to four times per call. Answers are cached per thread until ny_setenv/ny_unsetenv or environ changes. LICM rebuilt use-def chains and value facts over the whole function for every loop it examined. They are now built once per hoisting round (licm_shared_t), since the function changes only when a round ends (LICM 3.1 → 2.5 s CPU). Functions of 4,096 or more instructions keep an incremental, per-thread union-find for class queries. The newest 16 instructions are folded temporarily and rolled back, because the lowerer rewrites them in place. 99.9% of in-place rewrites are within 4 instructions of the end. A validated snapshot covers the rest; any older change rebuilds. rt_main lowering 3.4 → 1.6 s. Function lowering runs in forked workers (nyr_fork_lower_functions, Linux, programs with 384 or more reachable functions; NYTRIX_FORK_LOWER=0 disables it, NYTRIX_FORK_LOWER_WORKERS / _MIN tune it). Each worker has a copy-on-write snapshot of every lowering cache, takes function indexes from a shared counter, and returns deep-copied NYIR through a memfd. The parent merges in function order. String and array table entries created by a worker are re-interned in instruction order, so their numbering does not depend on which worker lowered what. Lambdas with captures are lowered by the worker that recorded their capture types while lowering the enclosing function. The parent re-applies the one process-wide switch lowering sets (nyr_set_preserve_phis). Any worker error, crash or missing function falls back to the serial loop, which reports diagnostics as before; debug, dump and trace modes use the serial loop. The editor executable is byte-identical with 1, 7 and 48 workers and serially, and etc/tests/lang passes 1448/1448 with fork lowering forced for every program (NYTRIX_FORK_LOWER_MIN=2). Editor lowering 11–12 s → 3–3.5 s. nyr_globaltab_* and nyr_consttab_* looked names up by linear strcmp scans; they now use hash indexes (exact name and last segment). Machine encoding (2.5 → 1.1 s on the editor, critical path of the largest functions): home coloring answers its range questions from a prefix count and per-value pin lists, instead of rescanning each value's live range; hot-home ordering maps slot offsets through a hash table, instead of a linear slot search per value; residency loops jump between set flags with memchr, instead of visiting every value at each call, branch and block; the LEA float-use check reads a per-value "last float memory use", instead of scanning to the end of the function. Parallel finalize, post-inline levels and encoding start the largest functions first. Results keep their slots. General inlining builds the caller's float facts only when an argument needs them, as union-find roots (1.3 → 0.8 s). HM: each environment keeps a Bloom filter of its names, so a name that is not bound returns at once instead of scanning thousands of module globals (HM inference 5.2 → 4.5 s). ny_block_implicit_std_symbol looks up the first function signature of a name through an incrementally grown index, instead of a strcmp scan of every signature. use statements' normalized module names and modules' exported children are cached per statement. LICM reuses its per-loop scratch flags and clears only the entries each loop set. The AST and codegen state are no longer torn down when the process exits right after the run (ny_pipeline_exit_after_run; ASan builds and NYTRIX_FULL_TEARDOWN=1 still free).

Tried and dropped: routing import-time and dotted-name callers through the import memo (changed the output: those answers are asked while module state is still being built); indexing the symbol lookup caches by the context stamp (misses were first-time keys, not collisions), a 16× larger lookup table, and a lower NYTRIX_PARALLEL_MIN_WORK (22,391 of 22,432 parallel regions stay serial because they have fewer than two tasks).

Found while measuring: sound, ui-synth and ui-breakout did not compile at HEAD. core/os/sound/wav.ny used the 64-bit maximum as an int (ints hold 62 bits). HM inferred imported modules' #main blocks in module scope, so core.counter's self-test c (a dict) typed an unrelated loop counter c (lang/modules/main-block-locals-stay-local). Fixing that exposed core/os/ui/window/platform/win32/mod.ny calling the nonexistent common.max.

Reading the results

The runtime target is at most 2× host C for every valid fixture on NYR, LLVM, and NYC. Assess it with a full ./make bench run with matching checksums and stable measurements. Passing the runner's existing gates or a class geomean does not establish that each fixture met the target. Compare the same source, input, execution route, flags, cache state, and timed region. Changed benchmark sources are new baselines, not compiler A/B tests. If ./make bench reports BENCH INVALIDATED, its saved rows are measurements from the run, not a pass/fail verdict for the final source tree; identify the changed input before using them as a baseline. Discard contended or unstable timings. C results varied by more than 100% in several Binary runs; those rows cannot establish an NYR/C improvement. References below 1 ms were separated from the gated runtime comparisons. Distinguish compilation, process startup, and the timed kernel. Instrumented execution and whole-process counters do not identify a kernel's hot instruction. Hardware sampling on the recorded host sometimes assigned kernel addresses to user symbols, including a known C control. Those instruction attributions were invalid despite zero lost samples. Validated software-clock sampling and aggregate counters are separate evidence. Build-ID or mapping mismatches also invalidate attribution.

Measurement log

Dated investigations behind the benchmark dashboard above: what was measured, what changed, and what was tried and reverted. Entries are historical snapshots, not current performance claims; compare only runs with the same source, input, route, flags, cache state, and timed region.

Dated investigations and remaining leads

Selected investigations:

- 2026-11-19 runtime linking, registry cache residency, allocation bookkeeping - 2026-11-19 NYC regression: two encoder bugs, mach-object default reverted - 2026-11-19 NYR/C gap re-rank after the NYC fix - 2026-11-19 full-suite baseline and home-reload diagnosis - 2026-11-19 loop-GPR eligibility evidence (sssp main) 2026-11-19 select clamp fusion (landed) - 2026-11-19 remaining measured blocker: loop-carried ranges - 2026-11-19 general bit-reassembly loop folding (landed) - 2026-11-19 vectorizer proof diagnostics (landed) - 2026-11-19 vectorizer window: exact blocker located inside SCEV - 2026-11-19 compile-time: selectchainfold gate measured, no gain (reverted) - 2026-11-19 compile-time and cd vectorization: measured findings - 2026-11-19 cd: what the address really is, and where the 860 ms goes - 2026-11-19 why the unreachable-stdlib filter was not shipped - 2026-11-19 six-fixture instruction budget (bench-gcc, NYR vs cc -O3) - 2026-11-19 cd resumed: the gap is vectorization, not scalar code - 2026-11-19 lbm: the neighbour-offset proof already works - 2026-11-19 cd: the address is a direct addr.symbol, and the loop dies before the load - 2026-11-19 the suite's two alarming rows in the last full run are contention artifacts - 2026-11-19 cd: the window that is missing belongs to the init loop, not the movement loop - 2026-11-19 VRP read-only slot ranges: built, fired on nothing, reverted - 2026-11-19 why a symbol-to-initializer table cannot bound a memory-carried IV - 2026-11-19 loopvectorize vectorslotentryconst the memory-carried IV now gets an entry bound - 2026-11-19 cross-block entry bound the preheader store is found through the CFG - 2026-11-20 radix-tree, bitcount, Ackermann, and BigInt 2026-11-20 single-limb BigInt division 2026-11-20 native optimization notes 2026-11-20 vector accumulator unrolling 2026-11-20 vectorizer rejection histogram 2026-11-20 compile phase timing 2026-11-20 encoded home traffic and wide-call locality 2026-11-20 loop-carried home traffic 2026-11-20 integer home-fold and edge-sink counters 2026-11-20 BigFloat division sticky bit - 2026-11-19 pre-vectorize LICM phase: built, measured, reverted

Plus 81 older investigations below these.

Resolved builtin operator reachability

A fresh cache-disabled native Pong compilation was sampled at 99 Hz with cpu-clock:u and 8 KiB DWARF call stacks. The capture contained 5,338 samples and zero losses. ny_native_find_impl_operator_in_stmt accounted for 1.55% of self samples, reached through ny_native_scan_expr_for_calls and ny_native_collector_operator.

Lowering already treats a resolved binary expression without a selected operator declaration as a builtin. Reachability previously ignored that fact, recomputed operand types, and traversed module/impl declarations again. ny_native_collector_operator now uses the same authoritative fact before those probes. For resolved builtins, work proportional to the module graph at each expression becomes one fact check. Explicitly selected operator declarations still take target resolution and its fallback, and unresolved expressions retain the conservative search.

Seven focused fixtures passed: raw integer operators in the presence of BigInt overloads, nominal impl operators (including call-result operands), chained operator re-exports, scalar multiplication, portable impl laws, and the ambiguous/unresolved operator error contracts. The runtime fixtures exercised their declared native/LLVM variant matrices. Both --bin and NYTRIX_TEST_NY_FULL_BIN pinned the candidate, with execution, stencil, and stdlib source caches disabled.

Both compilers also built native x86-64 Pong executables from the frozen library inputs. Each executable completed two frames and exited successfully under a private Vulkan-rendered headless Weston compositor. Their first-frame application traces agreed on ball position/velocity, paddles, score, font sizes, and the 1280x688 framebuffer. A separate candidate -vvvvvv smoke confirmed [gfx] Using Native Vulkan Backend and a shown Wayland surface. These checks establish exercised runtime behavior, not pixel equivalence or a startup/steady-state speedup.

The isolated control and candidate compile the same copied lowering source, with only the collector header changed. Every other linked compiler object is frozen and shared between the pair. A separate 541-file library/Pong/core input snapshot prevents concurrent workspace edits from changing the measured source graph; its manifest is checked before and after each timed run. Artifacts are retained in build/complexity-overhaul/.

Three alternating control/candidate pairs used --native-only -O2 --threads=4 --run=none, identical absolute input/core paths, and disabled native, AOT, JIT, stencil, stdlib source/bitcode, and incremental-inventory caches. These are object-compilation measurements, not link, startup, or first-frame times; other coding sessions were active on the host.

MetricControlCandidateChange
Median wall time44.676 s42.471 s4.94% less
Median user CPU54.027 s51.814 s4.10% less
Median system CPU2.646 s2.287 s13.58% less
Emitted object bytes14,040,84813,526,960513,888 fewer
Defined text symbols, including entry2,7282,69434 fewer

Object hashes were stable across all three runs of each compiler, but differ between compilers. The harness's initial cross-compiler byte-equality check therefore failed. Symbol inspection found 34 removed definitions, no added definitions, and size changes in retained functions; this is not a byte-preserving optimization. Removed definitions include BigInt comparisons, finite-field equality/shift helpers, and polynomial equality helpers that the previous collector rooted through the redundant overload search.

A separate candidate capture contained 4,983 samples and zero losses. ny_native_find_impl_operator_in_stmt fell from 1.55% of self samples to 0.02% (one sample). The largest named remaining self bucket was nyr_mach_regalloc_segment_at at 9.35%; CFG construction was 2.73%, imported-module member recursion 2.13%, type-map initialization 1.85%, and loop-edge coalescing 1.79%. The two large stripped OpenMP address buckets remain unattributed; nearest exported symbols are not sufficient evidence to name those private routines.

Incremental inventory and HM tracing

NYTRIX_INCREMENTAL=1 runs a dependency inventory after parsing. It does not restore inferred schemes, substitute an HM cache for validation, or certify that compilation of the reported files succeeded. The dependency snapshot must not be mistaken for checked semantic state.

The inventory now schedules all inputs on cold and forced builds, detects missing sources, propagates changes through both the previous and current graphs, and conservatively retains ambiguous basename dependencies. Bare module names match .ny filenames. Project roots select separate snapshots; reconfiguration honors the current cache directory. Graph reconstruction previously freed a pathname before using it for outgoing edges; moving the free after edge reconstruction fixes that use-after-free. Allocation failures, failed invalidation, and failed snapshot publication no longer become success.

incremental_graph.c covers cold/unchanged/forced transitions, provider edits, provider deletion, unrelated additions, cache reconfiguration, ambiguous providers, and sources disappearing after graph construction. The standalone driver passed. Valgrind Memcheck reported zero errors and zero definitely, indirectly, or possibly lost bytes; shared-library process-global allocations remained reachable at exit.

HM now captures type-detail and deep tracing bits at the start of each normal or reachable-fact pass. hm_unify reads those fields instead of calling ny_dbg_is_enabled for each constraint. Quiet and -vvvvvv smoke checks passed; verbose output retained HM_CONSTRAINT and HM_SUBST. A deliberately invalid, unused function still failed HM validation. No wall-time speedup is claimed for this small tracing-policy change.

After rebuilding build/release/ny-full, its integrated --ir-opt-test=incremental_graph group passed. The cold module-use selection, with explicit compiler and core.ny paths, passed 45/45, including positive and fail-closed portable refinement cases.

The architecture audit distinguishes existing work from open designs:

AreaCurrent implementation
Persistent per-module HM reuseNot implemented; explicit successful ABI/opt artifacts are reusable only under their identity checks, and their proof path still runs HM.
ReachabilityNative reachable-fact completion exists; full validation is not replaced by a graph that ignores unused-function errors. The main program is not redundantly re-inferred by persist_native_facts.
Parallel inferenceSerial within one per-pass HM state. Schemes, type-variable instances, arena allocations, diagnostics, and AST writes are shared within that pass, not a process-global unification table.
HM name lookupExisting cache keys include environment identity/generation, exact name, and exact syntax context. Replacing hygiene context with a guessed lexical-scope ID is unsound.
Import lookupExisting exact module/member result caches and snapshot-owned import-declaration index preserve source order and re-export traversal; not every transitive query is one lookup.
Refinement lookupAlready indexed in the codegen compilation context; no second root cache was added.

Preserving full-program diagnostics was explicitly selected for this pass. Persistent per-module schemes/facts with dependency invalidation and independent HM partitions with deterministic merging remain necessary before claiming the first and third architectural blockers solved. The dirty-file inventory alone does not satisfy either requirement.

Compile-time cleanup under revised acceptance

The compile-time TODO pass now uses measured improvement and preserved behavior, not the former 3–5 s compile/link/window cutoff. The user explicitly retired that cutoff. Earlier target-miss statements below are historical; removing the TODO section does not mean compilation costs disappeared or that incremental or parallel HM was implemented.

The retained changes are confined to two compiler translation units:

src/code/backend/core/verify.c builds a last-definition index during its existing verification setup. Scalar-class and ownership checks use constant time definition lookup instead of repeatedly scanning the whole function. Same-block reaching-store checks, recursion bounds, and all ABI/ownership checks remain. PHI, select, and local-store helpers avoid building analyses when there are no corresponding instructions. src/code/lang/ny/lower/lower.c indexes immediate valid use declarations per module or block for each compilation snapshot. Recursive re-export lookup visits those declarations in the same source order, without rescanning unrelated function and variable declarations. Alias, wildcard, cycle, and depth rules are unchanged. The index resets with the function/module snapshot and is freed with its owner; allocation failure or table saturation falls back to the original body walk.

An isolated control was relinked with only those two pre-change translation units, using the candidate's remaining compiler objects and dependencies. Frozen executables prevented concurrent workspace rebuilds from changing the comparison. Both compiled the same etc/labs/pong.ny through native x86-64 at -O2 --threads=4 --run=none; standard-source, automatic bitcode, native, AOT, and JIT caches were disabled, with CCACHE_DISABLE=1. This is source-cache-disabled compilation, not an OS-page-cache drop.

Three runs per arm alternated control/candidate order:

MeasurementControlCandidate
Median object-compilation wall time40.840 s39.788 s
Wall-time range40.214–41.025 s39.075–40.601 s
Median user CPU51.094 s49.102 s

The local wall median decreased 2.6%, and user CPU decreased 3.9%. Each paired candidate finished sooner, but the wall-time ranges overlap; this is a modest local improvement, not a universal speedup or an end-to-end startup result. Other coding sessions were active on the host. All six objects were identical: SHA-256 8af9128875b2432eb2a168c5ca95f1fc19111e1cdfe8ce7ef6689fbf775240d5.

Compiler SHA-256 identities:

control:   0414b30f69e975401a51d5aa7cf9db155e017510ca2157275faf8bfa74b7e913
candidate: 0c2dcd34a25b70a26870580c14b68219bbb8155024466b9dc5c11305a6fea866

The initial 199 Hz cpu-clock:u DWARF profile contained 10,609 samples and zero lost samples. It identified imported-member recursion, register-segment lookup, CFG construction, type-map construction, and scalar verification. A candidate capture overlapped the AOT smoke and lost 253 samples in ten chunks; it is not used to establish per-symbol improvements. Raw captures, frozen binaries, timing logs, objects, and comparison.json are retained under build/compile-overhaul/, outside source control.

Verification used explicit frozen compiler binaries and --std=build/release/core.ny: the full module-use selection passed 45/45 on both control and candidate. The existing named-reexport fixture now also checks chained constant aliases, negative constants, unrelated declarations surrounding imports, and identical member spellings in separate providers across its four backend variants. The first default-path runner invocation reported 32/45, including an installed-stdlib path error and timeouts; it is not the explicit-binary comparison or a passing run.

The cache-disabled candidate also completed native AOT compilation, link, launch, and two Pong frames under a private Weston Vulkan kiosk-shell compositor. Both the Wayland surface and Vulkan framebuffer were 1280×720; the client printed [gfx] Using Native Vulkan Backend. That smoke exited zero in 45.750 s and logged frame 1 at 5.026 s after startup. It overlapped the candidate profile and enabled NY_DEBUG, so it verifies the full path only: neither its total nor first-frame time is a startup-performance comparison.

HM function-environment buffer reuse

hm_infer_function_scheme now reuses one scratch environment vector across the sequential scheme-inference passes in hm_run and hm_run_reachable. Each use gets a fresh environment generation and copies the global entries before binding function parameters, so cached lookups cannot reuse facts from the previous function. Refinement, inference, and module-use selections passed 112/112. A cache-disabled Pong --native-only -O2 --run=none compile produced the same object SHA-256 as the previous compiler. The single control took 36.589 s; two candidate runs took 36.219 s and 35.910 s (median 36.065 s). Those runs do not establish a repeatable speedup and exclude linking, launch, and first frame; the 5 s end-to-end target remains unmet.

Pong imported-module lookup profile

A cache-disabled native-only Pong AOT run was sampled on 2026-11-11 with perf record -F 499 -e cpu-clock:u --call-graph dwarf,16384. It captured 38,076 samples with no losses (about 76.3 billion cpu-clock events). Named costs included mach_encode_function at 11.77% cumulative, mach_home_dse_analyze at 6.33%, nyr_find_imported_value at 6.83% (nyr_find_imported_module_member_rec at 6.45%), and HM inference at 3.7%. nyr_mach_regalloc_segment_at accounted for 2.01%. The executable was emitted, but launching Pong terminated with signal 11; the compositor reported message length 27503 exceeds 4096, so this run did not verify a first window.

The module-member cache was increased from 16,384 to 65,536 four-way entries. Matched NYTRIX_TRACE_LOOKUPS=1 runs with CCACHE_DISABLE=1 and AOT, native, and standard caches disabled recorded 12,534,021 module-member queries and 991,142 tree scans at 16,384 entries, versus 11,769,712 queries and 917,513 scans at 65,536 entries (7.4% fewer scans). Both saved Pong executables had SHA-256 53c42af524e6e078cdea2de362733adfb880336b2893f7d369100914e9daa70e. The single traced wall times were 37.42 s and 37.84 s respectively; another untraced candidate run took 37.63 s. The counter reduction confirms less recursive lookup work, but these timings do not establish a total compile-time speedup. Both AOT launches ended with the same Wayland protocol error. The larger lazily allocated tables trade additional compiler memory for fewer measured lookup scans; the 5 s compile/link/first-window target remains unmet.

x86-64 home-DSE probe fast path

mach_home_dse_analyze can remove only 8-byte virtual-register homes. The probe now avoids allocating its reference/dead maps and scanning encoded bytes when a function has no 8-byte vreg homes or the probe emits no vreg-home stores. Otherwise the existing reference scan and elimination test are unchanged. A no-dead-home probe is still reused as the final encoding.

The cache-disabled native fixture selection passed 68/68 after this change. Two cold-cache 64-thread Pong AOT runs on headless Weston with a Vulkan renderer took 37.263 s and 38.365 s wall (median 37.814 s); first submitted frames arrived 1.283 s and 1.134 s after app startup. Compiler, native, AOT, standard-library, and standard-bytecode caches were disabled. Both emitted the same ELF SHA-256 as the pre-change Pong build: 53c42af524e6e078cdea2de362733adfb880336b2893f7d369100914e9daa70e. A debug-enabled run of that identical ELF printed [gfx] Using Native Vulkan Backend. Weston output was 1280×720, but its desktop shell configured the app surface at 1280×688.

A cache-disabled 199 Hz DWARF profile of the same 64-thread, --run=none route captured 12,000 samples with no losses. perf buildid-list matched the sampled ny-full Build ID a79e6dbcd64bd354755bea5a1e59ccc500331255. mach_home_dse_analyze was below the 1% report cutoff. Remaining named costs included imported-module recursion at 2.31%, CFG construction at 2.14%, register-segment lookup at 1.99%, NYIR scalar verification at 1.73%, loop-edge coalescing at 1.72%, type-map initialization at 1.72%, and implementation-operator scanning at 1.45%. Two unresolved libomp.so instruction-address buckets accounted for 13.13% and 9.79%; the profile does not identify their symbols, so this is not yet evidence of a specific OpenMP wait or scheduling defect.

The same output was rebuilt cache-disabled through Weston kiosk-shell with an exact 1280×720 app surface. Each run requested one frame; timings are one observation per thread setting, not repeatable medians.

Compiler / std-library threadsAOT-to-frame wallFrame 1
8 / 841.386 s1.438 s
16 / 1639.819 s1.338 s
32 / 3237.189 s1.185 s
64 / 6437.223 s1.269 s

Every run emitted the same ELF SHA-256 as the earlier Pong build: 53c42af524e6e078cdea2de362733adfb880336b2893f7d369100914e9daa70e. A debug launch of that identical ELF reported a 1280×720 Wayland surface and [gfx] Using Native Vulkan Backend. The single 32/32 and 64/64 observations are indistinguishable as a tuning result; neither approaches the 5 s target.

A preceding 64/64 cold run before the no-store gate took 43.107 s and produced the same first-frame behavior; it is only one control against two candidates, so the difference does not establish a repeatable total-time speedup. The measured end-to-end time remains far above 5 s, and compile-hotspot work stays open.

Native Pong compiler call graph

A cache-disabled native-only Pong compile was sampled on 2026-11-10 with perf record -F 199 -e cpu-clock:u --call-graph dwarf,16384. The baseline record contained 3,698 samples, no lost samples, and about 18.58 billion cpu-clock events. find_refine_in_stmts accounted for 5.76% of samples: each unseen refinement name recursively scanned the program and nested module statements. The old name memo helped repeated names but did not avoid a full scan for each distinct refinement.

ny_lookup_refine now builds an arena-backed open-addressed index of refinement statements in prog and extra_progs, preserving the original first-match order (main program, nested modules in traversal order, then generated programs). It rebuilds if the main program pointer or generated-program count changes; definition objects are still materialized lazily. The candidate record contained 3,378 samples, no lost samples, and about 16.97 billion cpu-clock events. The scan fell below the report's 0.8% cutoff. These are single-run profiles, not a controlled timing comparison.

The candidate call graph still puts hm_run at 55.89% cumulative children; hm_infer_function_scheme accounts for 49.73%, with recursive statement inference dominant. Flat samples include HM environment lookup (6.01%), module statement lookup (5.39%), expression inference (5.54%), and collect_module_exports with linear unique-name checks (3.29% cumulative). Imported-module alias resolution and string/hash work remain visible below those paths. These overlapping call-tree percentages are not additive.

An attempted four-way per-HM-state environment lookup cache validated cached entries against the mutable environment vector and scanned newer entries to preserve shadowing. It was rejected: with other compiler caches disabled, its 199 Hz profile attributed 23.84% of samples to hm_env_lookup_index_ctx. The final cache-free profile had 5.79% flat samples in hm_env_entry_ctx, consistent with the prior 6.01% HM environment-lookup attribution; the temporary cache and helper were removed. A single uninstrumented cached-trial compile took 16.614 s, but one run is not a controlled improvement against the 18.072 s cache-free result.

ny_module_declares_exported_member previously materialized an owned export list, performed linear duplicate checks, scanned for one member, and freed the list on each query. It now walks the export declarations or module definitions directly and returns on the first matching leaf name. The 199 Hz candidate profile no longer reports ny_str_list_has or collect_module_exports at its 0.8% cutoff; module lookup remains at 5.62% and HM environment lookup at 6.16%. The cache-disabled module-use suite passed 45/45. A single cache-disabled native Pong compile took 16.329 s (15.30 s user, 0.90 s system); the earlier 18.072 s measurement is a different single run, so this is not a controlled speedup claim. It still excludes linking, launch, and first frame.

The same recursive module-alias resolver also formatted bounded path copies and joins through snprintf. ny_module_path_write now checks lengths and capacity, then copies the path components directly. The subsequent 199 Hz profile captured 2,610 samples with no losses and about 13.12 billion cpu-clock events; snprintf was not reported above the 0.8% cutoff, while module statement lookup remained at 6.25%. Two cache-disabled native-only Pong compiles took 13.866 s and 13.890 s (median 13.878 s). These are repeat candidate runs, not a controlled A/B against the 18.072 s historical baseline; they do not include link, launch, or first frame.

The earlier uninstrumented cache-disabled baseline build/release/ny-full --native-only -O2 --run=none etc/labs/pong.ny run completed in 18.072 s (17.05 s user, 0.89 s system). It is compile-only: no link, app launch, or first frame. This does not meet the 3 s cold compile/link/first-window requirement. The profile runs used 64 standard-loader and compiler workers with minimum parallel work 512; configured worker counts do not establish that the hot inference path parallelizes. Correctness check: NYTRIX_TEST_EXEC_CACHE=0 build/release/ny-test --bin build/release/ny-full --cold --jobs 8 --pattern refinement passed all 90 selected runtime and error fixtures.

Append-aware HM environment lookup cache

HM environment lookup uses a direct-mapped cache keyed by the environment address, unique generation, name hash, and syntax context. Each entry records the environment length and either the most recent matching binding index or a negative result (index == len). When later bindings are appended, a cache hit scans only that suffix before reusing either result; cloned environments receive distinct generations. Existing-binding updates change the entry's type but not lookup order.

A 199 Hz call-graph profile captured 14,445 samples with no losses; the hm_env_entry_ctx helper accounted for 3.67%. That is below the 6.16% seen in an earlier, non-matched profile, not a controlled A/B. The profiled compile took 43.165 s wall time; an uninstrumented run took 40.328 s, and a run with standard source/bytecode caches disabled took 41.573 s. Those current timings are much higher than the earlier 13.866/13.890 s runs; the cause is not established, so no total compile-time speedup is claimed. All are --run=none compile-only measurements and exclude link, launch, and first frame.

Two cache-disabled control compiles with the existing positive cache took 12.947 s at one thread and 12.940 s at four threads; thread count did not materially change this compile-only workload. A pointer-keyed cache-hit experiment guarded by binding-name pointer identity (falling back to content lookup otherwise) took 13.732 s at one thread and 13.528 s at four threads. Its 199 Hz profile captured 2,468 samples with no losses; hm_env_entry_ctx was 21.27% and ny_module_lookup_stmt_by_name 7.46%. These percentages are from a smaller capture than the earlier 14,445-sample profile and are not directly comparable. The pointer-cache experiment was reverted; it showed no improvement. Growing the direct-mapped cache from 128 to 1,024 entries also failed to improve the same compile: 13.236 s at one thread and 12.950 s at four threads, with a 2,443-sample profile still showing hm_env_entry_ctx at 21.74% and module lookup at 7.74%. This capacity experiment was reverted. A fresh profile of the restored 128-entry cache captured 2,425 samples with no losses; hm_env_entry_ctx was 23.13% and module statement lookup was 6.85%. With append-suffix validation, the refinement, modules/use, and shadowing selections passed 90/90, 45/45, and 6/6. Cache-disabled Pong compile-only runs took 12.842 s at one thread and 12.632 s at four threads; the 2,384-sample profile had no losses and sampled HM lookup at 22.19% and module statement lookup at 7.51%. This one-run-per-setting comparison is too small to establish a speedup; it is consistent with a small improvement over the 12.947/12.940 s control runs. The compile/link/first-window 3 s target remains unmet. Module lookup and HM inference remain open hotspots.

A follow-up caches negative lookups with the environment length as the not-found sentinel. Appended bindings are still checked before reusing a negative result, so a name introduced later in the same environment resolves normally. Refinement, modules/use, and shadowing passed 90/90, 45/45, and 6/6. Four cache-disabled compile-only repeats took 10.923–11.202 s at one thread (median 11.078 s) and 10.682–10.952 s at four threads (median 10.700 s), versus the preceding single-run 12.842/12.632 s controls. A fresh 2,019-sample profile had no losses and sampled hm_env_entry_ctx at 8.37%, down from 22.19% in the earlier smaller capture; module lookup was 8.07%. These are not matched A/B profiles, but repeated timings at both thread counts support keeping the negative cache. The compile/link/first-window 3 s target remains unmet.

HM cache-slot mixer experiment (reverted)

Replacing the cache slot's 64-bit mixing sequence with a cheaper 32-bit fold-and-shift mixer preserved the full environment, generation, name-hash, syntax-context, and length checks. Refinement, modules/use, and shadowing passed 90/90, 45/45, and 6/6. Four cache-disabled compile-only Pong runs took 11.034/11.054 s at one thread and 10.962/11.156 s at four threads. Against the immediately preceding mixer controls (10.875/10.902 s and 10.927/10.858 s), both candidate medians were slower by about 1.4–1.5%. The 2,017-sample candidate profile had no lost samples. Reverted the mixer; the 64-bit slot calculation remains. These compile-only measurements exclude linking, launch, and first frame.

HM constraint-trace fast path

hm_unify only needs formatted constraint type strings for NY_DBG_TYPE_DETAIL output and its suppression summary. It now checks that flag once and does not allocate or format either string on the normal trace-disabled path. When detail tracing is enabled, the existing formatter and suppression rules are retained. The compiler reads a debug bitmask here; it does not parse environment variables per constraint.

After the change, NYTRIX_TEST_EXEC_CACHE=0 build/release/ny-test --cold --pattern native passed 68/68. build/release/ny-full -vvvv --stop-after=hm etc/labs/pong.ny exited 0 and emitted both HM_CONSTRAINT and HM_SUBST records. A cache-disabled four-thread Pong --run=none compile took 40.153 s and emitted the same ELF hash as the 1280×720 AOT artifact; this single timing is not a controlled speedup.

A 99 Hz DWARF profile of the trace-disabled 64-thread compile captured about 6,000 samples with no losses. The ny-full Build ID matched the profiled binary. HM symbols and mach_home_dse_analyze were below the 1% report cutoff. The top two libomp.so instruction-address buckets were 12.90% and 10.27%; their symbols remain unresolved, so they do not identify a specific runtime wait or scheduling cause. Named compiler costs still included CFG building (2.15%), imported-member recursion (2.08%), register-segment lookup (2.02%), type-map initialization (1.90%), NYIR scalar verification (1.69%), and loop edge coalescing (1.64%). This profile identifies remaining work but does not establish a total compile-time speedup; the 5 s end-to-end target remains open.

Imported-member visited-set trial (reverted)

The recursive re-export search temporarily replaced its query-wide linear visited-module scan with a 512-slot open-addressed pointer set, retaining the same 256-module bound and traversal order. The cache-disabled modules/use selection passed 45/45 and the emitted Pong ELF hash was unchanged. The baseline 99 Hz profile (Build ID 3970bd342bd1a58745445db06b44cc9e262795bc) sampled nyr_find_imported_module_member_rec at 2.08%; the candidate profile (Build ID 3a354ff38709ecec8be62d06971c7a826705cc07) sampled it at 2.14%. Both captured about 6,000 samples with no losses. These separate captures do not show a reduction; initializing the 4 KiB pointer table per uncached query also adds work for shallow walks. The change was reverted rather than retained without a measured win.

Module statement cache probe experiment (reverted)

The module-statement lookup cache inserts into the first empty slot in its eight-slot probe sequence and never deletes individual entries; graph changes free the whole cache. A trial made lookup stop at the first empty slot instead of checking the remaining probes. The focused modules/use selection passed 45/45. Cache-disabled Pong compile-only runs took 12.898 s at one thread and 12.554 s at four threads, versus 12.842 s and 12.632 s in the preceding append-aware-cache run. The new 2,387-sample profile had no losses, but module lookup rose from 7.51% to 7.96%; the timings and profile do not establish a gain. Reverted rather than keep an unmeasured optimization.

Retesting the same early-exit change after the HM negative cache passed modules/use 45/45 but took 11.107 s at one thread and 11.568 s at four threads, versus the negative-cache medians 11.078 s and 10.700 s. The 2,051-sample profile had no losses and put module lookup at 8.97%, up from 8.07% in the negative-cache profile. This did not produce a repeatable gain; the change was reverted again.

A direct-mapped variant was also tested, replacing the eight-probe lookup and insertion with a single hashed slot; collisions still fell through to the canonical module-statement index. modules/use passed 45/45. Against two baseline repeats at each thread count (10.859/10.997 s at one thread and 10.800/11.055 s at four), direct-map repeats took 10.829/10.867 s and 10.890/10.858 s. These small, overlapping differences do not establish a speedup. Its 2,029-sample profile had no losses but sampled module lookup at 9.76%, compared with 9.25% in the preceding profile. Reverted the one-slot cache; the probe count remains eight.

Module statement last-result cache trial (reverted)

A one-entry fast path reused the most recently hit or inserted module-statement cache entry by comparing its cache-owned key before hashing and probing the table. modules/use passed 45/45 and shadowing passed 6/6. Cache-disabled four-thread Pong compile-only wall times were 14.54/12.07 s, against 11.44/11.27 s immediately before the trial. The candidate was slower and was reverted; no module-lookup speedup is established.

Cached import-alias lookup fast-path experiment (reverted)

ny_resolve_used_module_export_alias was changed to return an existing non-self user import alias before rescanning used modules; the indexed lookup still marks the alias as used. The refinement, modules/use, and shadowing selections passed 90/90, 45/45, and 6/6. Cache-disabled Pong compile-only runs took 10.984/11.043 s at one thread and 11.083/10.965 s at four threads. Compared with the preceding negative-cache medians (11.078 s and 10.700 s), these results show no repeatable gain; the four-thread median was about 3% slower. The 2,153-sample candidate profile had no lost samples. Reverted the fast path rather than keep an unproven alias-precedence shortcut.

HM binding-name pointer shortcut experiment (reverted)

hm_env_entry_matches briefly accepted pointer-identical binding names before computing or comparing content hashes. Refinement, modules/use, and shadowing passed 90/90, 45/45, and 6/6. Cache-disabled compile-only Pong runs took 11.188/10.970 s at one thread and 11.109/11.082 s at four threads. Against the restored-source controls (11.524/10.995 s and 11.040/10.943 s), the differences were inconsistent across thread counts. The candidate's 2,087-sample profile had no losses and sampled HM lookup at 8.82%, versus 8.30% in the 2,011-sample control profile. Reverted the shortcut; the captures do not demonstrate reduced lookup cost or compile time.

HM cache pointer-key experiment (reverted)

A trial used the parser-interned query-name pointer to select and validate the HM cache slot, deferring name hashing until a cache miss. This avoided repeated hashing and cached-name comparisons on same-AST hits while retaining the cached hash for appended-binding checks. Refinement, modules/use, and shadowing passed 90/45/6. Cache-disabled four-thread Pong compile-only wall times were 11.44/11.27 s before and 11.59/11.37 s with the trial. The candidate was slower, so the pointer-key path was reverted; no compile-time gain is claimed.

HM environment clone bulk copy

hm_env_clone now reserves exactly the source length once and copies the entries with one memcpy, replacing per-entry vec_push growth and copying. The cold refinement selection passed 90/90; modules/use passed 45/45 and shadowing passed 6/6. Cache-disabled four-thread Pong compile-only wall times were 11.44/11.27 s before and 11.51/11.27 s after. This removes repeated vector growth/copy work but the timings do not establish a total compile-time speedup. A separate 2,427-sample cycle profile had no losses and still showed HM lookup as the largest flat hotspot at 9.55%; profiles are not matched A/B.

HM fast-hash replacement trial (reverted)

To target the HM lookup hotspot, hm_name_hash was temporarily changed from 32-bit FNV-1a to the existing ny_hash64_fast_cstr, truncated to 32 bits. Refinement, modules/use, and shadowing passed 90/45/6. Two cache-disabled four-thread Pong compile-only controls took 10.933/10.955 s; the trial took 10.906/11.039 s. The ranges overlap and show no repeatable improvement, so the replacement was reverted.

Reachability qualified-call duplicate lookup

In ny_native_scan_qualified_call, a failed initial nyr_find_user_function lookup was repeated when the qualified name was not an import alias. The branch now returns directly when the first lookup found nothing, and adds the first result otherwise. The normal NY_E_MEMCALL scan also resolved the same qualified target twice; it now reuses the first resolution result. The change builds; focused modules/use passed 45/45, and the native selection passed 68/68. Two cache-disabled four-thread Pong --run=none compiles took 12.12 s and 11.19 s wall time. These timings are not a matched A/B and do not establish a speedup. The change removes redundant lookups but does not close the compile-hotspot or 3 s compile/link/first-window acceptance criteria.

Follow-up cache-disabled Pong profile

A fresh 199 Hz DWARF call-graph capture after the reachability changes recorded 2,545 samples with no losses. Flat samples were led by HM environment lookup (10.20%), ny_hash64_fast (5.71%), module statement lookup (4.67%), ny_module_public_target (4.44%), and attached-method lookup (3.03%). ny_native_scan_qualified_call was not a top-level symbol at the report's 1% cutoff, so this capture does not demonstrate a measurable gain from the duplicate-lookup fix. The imported-module and HM hot spots remain; the compile-time acceptance criteria are still open.

Name-hash hotspot review

The 2,019-sample negative-cache profile attributed 5.10% cumulative to ny_hash_name and 4.26% self to ny_hash64_fast; these overlapping call-tree figures are not additive. Samples came through several consumers, including import-alias resolution and attached-method lookup, rather than one isolated name-hash workload. ny_hash64_fast is the shared implementation behind ny_hash64 and has callers outside name lookup. No hash algorithm or global hash contract change was justified by this profile, so no code change was kept. Name hashing remains a measured cost to revisit if a consumer-specific hotspot becomes clear.

Attached-method fallback scan experiment (reverted)

The attached-method fallback scans cg->fun_sigs and derives an owner string for signatures before checking whether each signature is an attached method. A trial moved the cheap attached-method, owner/name, and current-signature checks ahead of owner derivation. The attached-method selections passed 7/7 and modules/use passed 45/45. Two cache-disabled compile-only runs took 11.267/10.844 s at one thread and 11.446/10.695 s at four threads; these overlap the preceding negative-cache medians of 11.078/10.700 s and do not show a stable gain. The 2,075-sample candidate profile had no losses and sampled attached-method lookup at 4.05% self, but it is not a matched profile. Reverted the filter reordering rather than claim an unsupported speedup.

CFG builder allocation experiment (reverted)

A nyr_cfg_build_impl trial replaced zeroed allocations with uninitialized storage for arrays believed to be fully written. It required zeroing all predecessor-offset entries before accumulating incoming edges; doing that inside the accumulation loop erased earlier counts and stalled dominator intersection. After fixing the ordering, cfg_simplify, dce_phi_label, loop_unroll, loop_interchange, gvn_pre, and range_query passed.

The corrected trial's 199 Hz profile captured 14,908 samples with no losses; nyr_cfg_build_impl accounted for 2.12%. The profiled compile took 43.771 s; the uninstrumented cache-disabled --run=none compile took 41.338 s (1m18.022s user, 5.006s system), versus a separate 41.573 s baseline. The difference is not enough to establish a speedup, so the allocation changes were reverted. regalloc_loop_phi_carry fails with both the trial and restored baseline; the mismatch is not attributed to the CFG allocation experiment.

The whole --ir-opt-test run also stops at the AArch64 disassembly fixture's expected-line mismatch: the actual listing appends encoded bytes before the newline. Focused CFG-related groups pass independently. Pong measurements remain compile-only and do not meet the 3 s compile/link/first-window target.

Register-segment lookup observation

The Pong profile sampled nyr_mach_regalloc_segment_at at 1.69%. Its search is already restricted to each vreg's sorted segment range and runs in $O(\log k)$, where $k$ is that vreg's segment count. A last-start upper-bound shortcut was not adopted: machine blocks are appended at inst_len, so empty blocks can share instruction positions and generate same-start live segments; the shortcut could select a different segment at those boundaries. The LSP found 65 references, mostly encoder lookups.

Focused regalloc_cfg_edge_carry and regalloc_dead_input_coalesce tests pass. At the time of this lookup investigation, regalloc_loop_phi_carry failed with the same reported colors when the CFG allocation trial was reverted (header/preheader/latch = color 2, source = color 0); the failure was not attributed to the lookup investigation. No segment-search change was made.

Loop-phi preheader source color fix

The failing GPR fixture exposed a missed safe-coalescing case: loop-edge coalescing intentionally left preheader source segments untouched to preserve values across calls, even when the source died at the phi copy. That left the preheader incoming value in a different physical register from the backedge carry. The coalescer now recolors a preheader source only when it dies at the copy, after checking both source segments for register constraints, clobbers, and conflicts. Non-dying sources retain their original register; call-clobber checks remain active.

The focused regalloc_loop_phi_carry, regalloc_cfg_edge_carry, regalloc_dead_input_coalesce, and regalloc_fpr_loop_phi_carry tests pass. The loop-carry fixture also verifies that a deliberately mismatched latch color is rejected by the allocator verifier. The CFG allocation experiment remains reverted; this correctness fix does not establish a compile-time speedup.

Native assembly and code-size audit (2026-11-15)

Collected 2026-11-15 on the release build, one --bench-show-asm run per fixture. These numbers rank emitted code size; they are not timing evidence:

ny-test --bin build/release/ny-full --bench <fixture> --bench-show-asm \
  --bench-run 1 --bench-warmup 0

for all 96 etc/tests/bench/**/*.nshape sources. code bytes is the internal x86-64 machine code size the runner reports, so it measures emitted code rather than the assembly printer. Six fixtures fall back to the text emitter in this diagnostic mode: their rows say text, they carry assembly bytes in the note below the table, and they are excluded from the byte total and median.

Timings below come from a single sample per fixture. The C column is the runner's C route for that fixture and can use a different repetition count from the fixture's own timing loop (knight reports 16.5x here while the harness row for it is 1.61x). Use these numbers only to rank code size; the benchmark run below is the timing evidence.

fixtures audited: 96 (95 ok, 1 fail) emitted machine code: 92,005,384 bytes across 90 fixtures; median 24,876 bytes records without an internal machine-code size: 6 (text-emitter fallback)

Largest fixtures

fixturepathcode bytes
pbkdf2etc/tests/bench/algorithms/pbkdf2.nshape5,627,626
sha256etc/tests/bench/algorithms/sha256.nshape5,592,189
inlineetc/tests/bench/startup/inline.nshape5,392,368
call-chainetc/tests/bench/concurrency/call-chain.nshape5,391,983
expression-treeetc/tests/bench/algorithms/expression-tree.nshape5,307,968
page-ranketc/tests/bench/algorithms/page-rank.nshape4,522,018
bigint-oracleetc/tests/bench/numeric/bigint-oracle.nshape4,295,923
json-parseretc/tests/bench/string/json-parser.nshape3,950,079

All audited fixtures

fixturepathstatusNYRCcode bytes
append-scalingetc/tests/bench/string/append-scaling.nshapeok8.47ms13.1ms19814
bce-matrixetc/tests/bench/numeric/bce-matrix.nshapeok4.92ms2.20ms26381
bigint-oracleetc/tests/bench/numeric/bigint-oracle.nshapeok36.0ms3.72ms4295923
binaryetc/tests/bench/algorithms/binary.nshapeok823µs559µs25630
binary-treesetc/tests/bench/algorithms/binary-trees.nshapeok3.1µs16µs23797
call-chainetc/tests/bench/concurrency/call-chain.nshapeok587µs586µs5391983
callsetc/tests/bench/concurrency/calls.nshapeok104µs103µs20341
cdetc/tests/bench/simulation/cd.nshapeok17.2ms2.11ms24097
cmov-sortetc/tests/bench/startup/cmov-sort.nshapeok882µs572µs20796
collatzetc/tests/bench/algorithms/collatz.nshapeok78µs55µs6497
crc32etc/tests/bench/crypto/crc32.nshapeok11.1ms10.1ms20945
curryingetc/tests/bench/startup/currying.nshapeFAIL2.21ms4.9µs27034
dceetc/tests/bench/startup/dce.nshapeok15µs247µs3149464
deltablueetc/tests/bench/algorithms/deltablue.nshapeok22.8ms16.1mstext
dgemmetc/tests/bench/numeric/dgemm.nshapeok40µs40µs65454
dictetc/tests/bench/datastructures/dict.nshapeok12.4ms5.73ms405931
dict-oracleetc/tests/bench/datastructures/dict-oracle.nshapeok68µs30µs406426
dict-setetc/tests/bench/datastructures/dict-set.nshapeok56.3ms86.4ms3544919
escape-loopetc/tests/bench/startup/escape-loop.nshapeok4.58ms4.97ms17792
euler9etc/tests/bench/algorithms/euler9.nshapeok55µs30µs11465
expression-treeetc/tests/bench/algorithms/expression-tree.nshapeok8.37ms6.89ms5307968
fannkuchetc/tests/bench/algorithms/fannkuch.nshapeok237ms214ms26087
fastaetc/tests/bench/string/fasta.nshapeok1.75ms1.37ms23883
fftetc/tests/bench/numeric/fft.nshapeok17µs39µs3615888
fibonaccietc/tests/bench/numeric/fibonacci.nshapeok118µs112µs21064
floatetc/tests/bench/numeric/float.nshapeok9.45ms9.19ms21547
float-cmp-oracleetc/tests/bench/numeric/float-cmp-oracle.nshapeok19µs10µs3600354
gcbenchetc/tests/bench/startup/gcbench.nshapeok39.7ms23.0ms24817
graph-bfsetc/tests/bench/algorithms/graph-bfs.nshapeok23.2ms19.7ms41627
hashetc/tests/bench/datastructures/hash.nshapeok4.46ms3.69ms18257
havlaketc/tests/bench/algorithms/havlak.nshapeok3.52ms2.32ms22167
heapsortetc/tests/bench/datastructures/heapsort.nshapeok4.78ms4.82ms25916
imagicketc/tests/bench/graphics/imagick.nshapeok70µs94µs22959
inlineetc/tests/bench/startup/inline.nshapeok60µs2.09ms5392368
intopsetc/tests/bench/numeric/intops.nshapeok636µs346µs19665
iteretc/tests/bench/datastructures/iter.nshapeok385µs337µs25688
json-parseretc/tests/bench/string/json-parser.nshapeok13.1ms12.4ms3950079
knightetc/tests/bench/algorithms/knight.nshapeok2.35ms142µs34558
knucleotideetc/tests/bench/algorithms/knucleotide.nshapeok435µs364µs18855
knucleotideetc/tests/bench/string/knucleotide.nshapeok122µs120µs23514
lbmetc/tests/bench/numeric/lbm.nshapeok3.45ms812µs23485
leelaetc/tests/bench/simulation/leela.nshapeok4.77ms5.96mstext
licmetc/tests/bench/startup/licm.nshapeok74µs610µs3707492
licm-mathetc/tests/bench/startup/licm-math.nshapeok4.58ms4.64ms18778
linpacketc/tests/bench/numeric/linpack.nshapeok268µs96µs3453711
listetc/tests/bench/datastructures/list.nshapeok3.98ms4.15ms3418251
list-any-appendetc/tests/bench/datastructures/list-any-append.nshapeok9.13ms8.54ms3414172
list-dynamicetc/tests/bench/datastructures/list-dynamic.nshapeok5.92ms4.40ms3418251
loopetc/tests/bench/startup/loop.nshapeok1.15ms1.17ms18275
loop-unswitchetc/tests/bench/startup/loop-unswitch.nshapeok4.49ms4.48ms24176
mandeletc/tests/bench/algorithms/mandel.nshapeok137µs80µs7905
mandelbrotetc/tests/bench/algorithms/mandelbrot.nshapeok325µs408µs3597871
matmult-intetc/tests/bench/numeric/matmult-int.nshapeok920µs591µs22276
matrixetc/tests/bench/numeric/matrix.nshapeok22µs7.6µs20954
matrix-rawetc/tests/bench/numeric/matrix-raw.nshapeok43µs30µs3600142
mcfetc/tests/bench/algorithms/mcf.nshapeok7.17ms6.06ms22360
mixed-static-is~etc/tests/bench/startup/mixed-static-island.nshapeok33µs30µs21829
mont64etc/tests/bench/numeric/mont64.nshapeok6.88ms2.04mstext
n-bodyetc/tests/bench/algorithms/n-body.nshapeok2.72ms1.82ms26466
native-oracleetc/tests/bench/startup/native-oracle.nshapeok88µs33µs17361
nqueensetc/tests/bench/algorithms/nqueens.nshapeok27.8ms27.4ms21116
omnetppetc/tests/bench/simulation/omnetpp.nshapeok10.9ms11.1ms29139
page-ranketc/tests/bench/algorithms/page-rank.nshapeok18µs4.9µs4522018
pbkdf2etc/tests/bench/algorithms/pbkdf2.nshapeok160µs1.75ms5627626
pbkdf2etc/tests/bench/numeric/pbkdf2.nshapeok960µs1.10ms103673
permuteetc/tests/bench/algorithms/permute.nshapeok117ms89.5ms21116
pidigitsetc/tests/bench/numeric/pidigits.nshapeok9.4µs7.1µs75209
povrayetc/tests/bench/graphics/povray.nshapeok5.08ms1.24ms22653
primeetc/tests/bench/algorithms/prime.nshapeok1.35ms1.23ms8906
qrsyndromeetc/tests/bench/crypto/qrsyndrome.nshapeok4.67ms3.11mstext
queenetc/tests/bench/algorithms/queen.nshapeok2.35ms1.78ms20434
recordsetc/tests/bench/datastructures/records.nshapeok46.7ms44.1ms35014
recursive-fibon~etc/tests/bench/startup/recursive-fibonacci.nshapeok310ns191ns3710910
repeatetc/tests/bench/string/repeat.nshapeok83.8ms97.9ms14927
revcompetc/tests/bench/string/revcomp.nshapeok5.0µs7.8µs30235
richardsetc/tests/bench/concurrency/richards.nshapeok1.30ms878µstext
sha256etc/tests/bench/algorithms/sha256.nshapeok1.36ms896µs5592189
sha256etc/tests/bench/numeric/sha256.nshapeok756µs907µs37510
sieveetc/tests/bench/algorithms/sieve.nshapeok6.04ms4.94ms24934
soretc/tests/bench/algorithms/sor.nshapeok1.74ms851µs28110
spectraletc/tests/bench/algorithms/spectral.nshapeok80µs27µs3611523
splayetc/tests/bench/datastructures/splay.nshapeok4.01ms4.07ms3611602
ssspetc/tests/bench/algorithms/sssp.nshapeok6.42ms2.38mstext
startupetc/tests/bench/startup/startup.nshapeok27ns27ns17072
statemateetc/tests/bench/algorithms/statemate.nshapeok2.03ms1.64ms22219
straightetc/tests/bench/startup/straight.nshapeok20µs20µs17997
streametc/tests/bench/memory/stream.nshapeok11.1ms4.00ms19579
stringetc/tests/bench/string/string.nshapeok198µs284µs28818
tce-recursionetc/tests/bench/startup/tce-recursion.nshapeok91µs91µs19481
thread-ringetc/tests/bench/concurrency/thread-ring.nshapeok6.32ms4.54ms27509
time-profileetc/tests/bench/startup/time-profile.nshapeok99µs21µs16444
transposeetc/tests/bench/memory/transpose.nshapeok491µs597µs20052
vectoretc/tests/bench/datastructures/vector.nshapeok336µs267µs20227
word-frequencyetc/tests/bench/string/word-frequency.nshapeok4.63ms3.34ms23981
word-frequency-~etc/tests/bench/string/word-frequency-scan.nshapeok3.03ms2.49ms27381
xzetc/tests/bench/string/xz.nshapeok2.17ms1.61ms20075

The six text rows emitted through the text assembly emitter in this diagnostic mode, so no comparable machine-code size exists for them: sssp 2,486,370, deltablue 2,485,605, richards 2,598,852, mont64 3,775,697, qrsyndrome 2,636,227, and leela 3,228,001 assembly-text bytes. They pass their checksums on the native route; the fallback is a property of this assembly diagnostic, not of execution.

Findings

The size cost is MACH-to-x64 expansion, not one missed opcode idiom. ny_fn_moves (knight) is 188 MACH instructions and 498 x64 instructions, 199 of them (%rbp) home traffic: each MACH operand is materialised through a stack home unless a value stays resident across the block. Zero tests already use test %reg,%reg, and immediates already take the zero / 32-bit / sign-extended forms, so cmp $0 and mov $0 peepholes have no remaining targets (0 occurrences of cmp $0 in knight). 37 adjacent mov A,B; mov B,A reversed pairs remain in knight. They come out of the inline ALU/copy paths, so removing them needs a MACH-level copy-forwarding pass (see measurements.md, 2026-11-15). The 32-bit path already emits compact forms: no pushl/popl pairs, no cmpl $0, no self moves in knight's i386 assembly; its 119 pushl are call arguments under the stack ABI.

Binary latch-guard duplication

Machine lowering now duplicates a tiny pure register-only guard at a single-block latch, after PHI-edge lowering and before register allocation. The entry guard remains, preserving zero-trip behavior; memory and trapping guards are not cloned. This removes one taken branch per inner iteration.

Matched screening used the unchanged fixtures, O3 peak profile, LLVM/host-C/NYC comparisons, seven measured runs and two warm-ups in each configuration:

ConfigurationNYRLLVMHost CNYCNYR/LLVM
Guard duplication disabled2.001 ms318 µs1.04 ms8.27 ms6.29x
Guard duplication enabled1.797 ms319 µs1.04 ms8.27 ms5.64x

All four checksums match 3360874588549334. This is approximately a 10% runtime reduction, not a passing performance gate (the limit remains 5.00x). Reports: build/bench-reports/bench-20261103-210935-1855512.json and build/bench-reports/bench-20261103-211407-1869585.json. The full candidate run also retained matching checksums and still failed only the binary performance gate. The executable regression checks negative, zero, one and many trips, live-out PHIs, and rejection of a memory guard. The focused native PHI/edge fixtures pass all five variants. Of 98 optimizer groups, 96 pass; licm_address_component and portable_wasm also fail with guard duplication disabled and are not counted as passing.

NYC binary runtime: static helpers and repeated sign extension

The focused comparison compiled the unchanged binary fixture's C source with two NYC snapshots using -O3 -S and the same host assembler/link driver. Each executable received one discarded warm-up and seven measured executions, alternating control/candidate order. The fixture's own elapsed_ns region excludes compilation, linking, process startup, and checksum printing.

Change setControl NYC runtimeCandidate NYC runtimeMedian reduction
Static-helper inlining and redundant sign-extension folding12.652 ms10.811 ms14.5%

Every execution preserved checksum 3360874588549334. Generated assembly eliminated the per-inner-iteration signed_from_bits call. The shared peephole pass also removes repeated sign extension to an equal or wider width, without removing narrower truncations. The focused optimizer regression checks 36 width combinations against signed boundary inputs before and after rewriting. The C regression executes recursive/address-taken helpers and GNU noinline frame boundaries.

This is a local NYC improvement, not a passing NYR/NYC-versus-reference matrix. The separate four-route binary smoke still measured NYR/LLVM above its gate at that time.

Rejected NYR binary candidates

Seven-sample, one-warm-up snapshot screening retained checksum 3360874588549334 but did not justify either candidate. A less conservative R8 live-range proof around power-of-two division measured 1.990/1.961 ms control/candidate, with overlapping samples and identical register-allocation output; it was reverted. Removing the extra comparison around a masked select predicate measured 1.972/2.313 ms and was also reverted. No NYR binary speedup is claimed from these experiments.

dict-set repeated low-contention stability

Three independent runs used the single dict-set fixture, native x86-64, -O3, peak profile, opt tier, warm cache, 11 measured samples plus one warm-up, one fixture worker, and CPU 13 on the AMD EPYC 7642 host. C used Clang -O3 -march=native; NYC used -O3 -S. All four routes returned checksum 749999 on every run.

RunNYR median (range)LLVM median (range)Host CNYCNYR/LLVM
147.891 ms (46.381–49.188)46.217 ms (44.366–52.682)55.953 ms214.293 ms1.036x
248.065 ms (47.185–48.816)45.724 ms (45.460–46.974)54.879 ms207.714 ms1.051x
347.366 ms (44.826–51.217)46.075 ms (44.009–48.360)55.052 ms208.848 ms1.028x

Every run stayed below the unchanged 1.50x per-fixture NYR/LLVM ceiling, so the prior dict-set stability item is closed. This closes only that fixture's budget item; it does not establish per-fixture competitiveness or close the full data-structures class. Raw reports are /tmp/ny-dict-set-quiet-{1,2,3}.json.

Raw-allocation ABI and gcbench runtime

A direct native __calloc_raw(17) call reached the legacy tagged-integer allocator with the raw value 17, producing an 8-byte allocation. Runtime alias selection now preserves the raw-byte entry chosen during argument lowering. The calloc-raw fixture checks exact registered extents before access, zero initialization, release, a dynamic any size, and an inlined constant any size. Its four native/LLVM variants pass.

Retained allocation-observer evidence records 440400 requests of 96 bytes in gcbench; a separate typed/dynamic probe records two 96-byte requests and one 97-byte request. The saved profile attributes 21.15% of instructions to raw-pointer registration and unregistration. Those earlier artifacts are under the local perf workspace.

A subsequent focused gcbench correctness smoke used one measured execution and no warm-up, with matching checksums on all four routes:

NYRLLVMHost CNYCNYC/C
37.5 ms28.2 ms24.8 ms26.0 ms1.05×

The report is build/bench-reports/gcbench-raw-abi-runtime.md. This single sample establishes execution and result agreement, not a stable improvement or a passing performance gate. Allocation overhead remains open.

Linpack native baseline

The focused diagnostic used one measured execution without warm-up; all four routes retained checksum 1.

NYRLLVMHost CNYC
1.31 ms239 µs160 µs3.31 ms

The report is build/bench-reports/linpack-focused-native.md. The native rt_main register diagnostic has 325 virtual registers, 986 segments, and zero addressable frame-slot bytes. A conservative SysV private-spill-home proof now permits loop-register allocation despite scalar indirect stores when there are no frame slots, parameters, physical-register operands, or opaque memory effects. One candidate smoke reported checksum 1 and elapsed_ns=814184; this is not a matched control/candidate comparison, and the focused x64 regression test and comparable LLVM/C timings remain unverified. The report's aggregate counters include imported core code and must not be treated as per-kernel runtime attribution.

Runtime-call effect lookup

The 2026-10-29 profile showed nyr_effective_effects among the sampled compiler hotspots. nyr_call_effect_summary now rejects names outside the rt_ namespace and filters by family before full name comparisons. The runtime table also classifies rt_tbuf_new_raw and rt_tbuf_new_typed_raw as allocating, trapping calls instead of unknown FFI calls. Unknown symbols retain the conservative FFI/unknown-side-effect summary. The cse optimizer regression covers both allocator contracts, known effectful calls, and an unknown non-runtime symbol.

For fannkuch, the native-tier report's known effect/alias blockers changed from 3/21 to 0/18; its GPR spill/reload counts remained 971/1,367. The focused x86-64 O3, peak-profile benchmark used three measured runs and one warm-up for both snapshots, with matching checksums on all three routes. Expression tree measured 115.426 ms compile / 59.436 ms NYR runtime before and 115.872 ms / 58.877 ms after. Fannkuch measured 77.646 ms compile / 414.333 ms runtime before and 77.099 ms / 420.062 ms after. These samples do not establish a compile or runtime speedup; the Fannkuch runtime gap remains about 2.25x against LLVM. Correcting effect summaries removed false unknown-call classification, but did not resolve the high register pressure or slow Fannkuch execution.

Fixed-size Fannkuch workload

The benchmark invokes Fannkuch only with n=10. The fixture now represents that fixed input as a local constant rather than a parameter; this preserves the measured workload while exposing its loop bound to native optimization. On the same x86-64 O3, peak-profile, warm-cache setup (three measured runs, one warm-up), NYR runtime fell from 412 ms to 341.051 ms (339.598–344.173 ms). The checksum remained 15830566 on NYR, LLVM, and C. Candidate compile time was 76.667 ms; LLVM and C measured 206.411 ms and 208.212 ms. This is a benchmark-fixture specialization, not evidence that dynamic n calls became faster; NYR remains 1.65x slower than LLVM for this fixture.

BCE matrix timer-floor correction

The original bce-matrix timed one 100×100 traversal. C measured below 1 µs and LLVM about 1 µs, so the reported NYR/C and LLVM/C ratios were unavailable and NYR/LLVM was dominated by the timer floor. The fixture now performs 2,048 traversals, incrementing element zero once per pass to keep the result data-dependent and prevent the optimizing comparison routes from folding the entire timed loop away. All three sources perform the same work and produce checksum 103823513600.

On x86-64 O3, peak profile, warm cache (three measured runs and one warm-up), NYR measured 33.719 ms (33.622–33.802 ms), LLVM 1.701 ms (1.698–1.710 ms), and C 1.680 ms (1.635–1.971 ms). All routes now exceed the 1 ms comparison cutoff, so the runner reports NYR/C 20.07x, LLVM/C 1.01x, and NYR/LLVM 19.82x instead of timer-floor dashes. This corrects denominator comparability; the resulting NYR slowdown is visible rather than hidden.

Standard-library core bitcode generation

On 2026-10-26, emitting core.bc at -O0 reduced cold compiler time on the LLVM release build. Consumers optimize the linked module, so the standalone core-bitcode build no longer runs the same LLVM optimization pipeline first. The CMake core-bitcode builder applies -O0; its compiler/source fingerprint still invalidates the cached artifact when inputs change.

The measured snapshot used Nytrix 0.10.0+git.f05fdb2f6816, x86-64 Linux (EPYC 7642), core.ny SHA-256 11322462a9e5883c4267f36db5691c1d024c88749b7dc0b23fa3d2e76d3f4a46, and compiler SHA-256 6ac9aae9234d1becb0a757069597ddcd53c9bdd4e287db3977f3bf05f0667d6f. With standard-source and bitcode auto-caches disabled and 16 standard-library workers, three cold runs measured per variant. One run per variant included -time for phase attribution; the other two used plain wall timing. This was a small, non-interleaved comparison:

VariantCold timesMedianBitcode
Release default optimization170.333, 171.055, 169.476 s170.333 s17,429,672 bytes
-O0 core emission134.776, 132.089, 136.531 s134.776 s30,968,768 bytes

The median cold reduction was 20.9%. The larger unoptimized bitcode is an explicit trade-off; a generated-flow consumer fixture passed with both the default and -O0 artifacts (one run each, not a consumer-speed comparison). The phase profile attributed 130.706 s to codegen and 34.938 s to optimization at the default level; -O0 took 127.610 s in codegen and skipped that separate optimization stage.

To recheck the optimization after the working tree changed, the then-current compiler and core.ny were copied to tmpfs and held fixed for a matched one-run comparison. The compiler SHA-256 was dff81f6e64cf988f5c82ff5192c39810e9daed1bc7fbe207e2f99d7327edaced; the core.ny SHA-256 was a5eab3ab5e1b16e630bdee42e5e90fe5a511194b9ca6e0d67d0bacf9702b2593. Default emission took 173.048 s (17,430,724 bytes); -O0 took 132.076 s (30,969,940 bytes). Their SHA-256 checksums were 15f619b778e25b66efcba622c40741316f610c1cf13012df3e589222e151855d and 3e26ef35b3aba63aed9b249ae5cbb354ae9258e4b601484dc6e56c666686f6db, respectively. This is one paired sample, not a new median. Both bitcode variants passed the generated-flow fixture and a native str.repeat consumer smoke using the same frozen compiler and source.

Reproduce cold samples without deleting or overwriting the shared build cache:

mkdir -p build/cache/core-bc-perf
time env NYTRIX_STD_CACHE=0 NYTRIX_STD_BC_CACHE_AUTO=0 \
  NYTRIX_STD_THREADS=16 NYTRIX_STD_BC_EMIT_BODIES=1 \
  build/release/ny-full --opt-level=0 --std=full \
  --core-path=build/release/core.ny --run=none \
  --emit=bc=build/cache/core-bc-perf/core.bc \
  --emit-module=lib -e ' '

For the pre-change comparison, omit -O0; use a new output filename for each cold sample. For the builder's warm-cache path, build the target once, then time the unchanged target again:

cmake --build build/release --target core_bc
time cmake --build build/release --target core_bc

On the measured snapshot, the CMake builder's cold run took 143.918 s and its first warm hit took 0.064 s. An earlier warm-hit observation was 0.061 s. Later source/compiler changes changed the core/compiler fingerprints; the builder correctly regenerated instead of treating those changed inputs as a warm hit. These timings describe the hashes above, not the subsequently edited working tree.

The cache identity checker passed for the generated artifact. The generated-length-bound-flow.nshape consumer passed against both default and -O0 bitcode, and passed again against the rebuilt candidate. The separate semantic-effect-artifact.nshape check failed on both the default and candidate routes because core.os.file_read returned an empty string for its existing consumer template; direct execution without --core-bc reproduced that failure, so it did not distinguish the bitcode variants.

Selected workload results

These rows preserve useful checksum-matched checkpoints. They were not one simultaneous campaign and must not be combined into a new aggregate.

Workload and checkpointNYRLLVMCInterpretation
Dictionary insertion, empty-first-probe path, 3+128.9 ms25.3 ms30.6 msPrior supplied row was 49.0/29.5/30.9 ms; focused result met its 1.5× native/LLVM cap, without a full rerun.
Word frequency, direct span counting, 3+15.08 ms5.13 ms8.81 msChecksum and semantic edge cases passed; earlier split-and-dictionary implementations are superseded.
DGEMM before conversion-aware FPR homes, 5+21.10 ms324 µs314 µsTwo candidate NYR medians were 650 and 734 µs; C varied too much for a stable ratio.
SOR after the address-chain correctness guard, 3+13.44 ms751 µs1.45 msCorrect checksum restored; C dispersion was 54%.
Fannkuch, 5+2357.7 ms215.2 ms211.1 msNYR used 64-bit array elements; C used 32-bit elements. Not a layout-matched comparison.
Thread ring, 5+223.1 ms22.7 ms6.12 msSimilar native/LLVM behavior; the shared-runtime and synchronization gap against C was not attributed.
BigInt after timer/reference correction, 5+234.0 ms34.8 ms3.61 msBoth references used 256-bit floating arithmetic; C still included explicit GMP cleanup.
BigInt after caching x86 arithmetic-feature detection, 3+135.3 ms38.4 ms3.68 msChecksum matched. NYR was 9.3% below the supplied 38.9 ms checkpoint; separate 3+1 runs, not an interleaved A/B. The broader benchmark gate passed.
BCE matrix, one focused 5+2 checkpoint442 µs414 µs125 µsBounds check removed, but native nested traversal remained scalar. Later unstable rows were discarded.
Splay, restored safe baseline, 5+25.41 ms3.66 ms4.30 msNative/C target remained unmet at this checkpoint.
Splay, resident-register scaled LEA, 5+25.15 ms3.66 ms4.44 msSmall local improvement; native remained slower than C.
Call chain, 3+12.46 ms531 µs255 µsArithmetic calls were already inlined; frame-home traffic remained.
SHA-256, October 2, 2+1119 ms98.7 ms896 µsRepresentation/runtime differences dominated both language routes; not just a native-emitter gap.
PBKDF2, October 2, 2+1236 ms205 ms1.09 msHistorical pre-fix baseline; later vectorization correctness work is separate.
CSR graph BFS, 3+128.4 ms16.2 ms13.6 msConstruction plus four traversals at each size; checksum 4111535296.
Expression tree, 3+166.2 ms31.2 ms16.1 msA leaf changed before each evaluation to prevent invariant-result hoisting; checksum 219547.
Mixed flat records, expanded sizes, 7+242.2 ms34.9 ms44.1 msMatching 24-byte row storage; not a comparison of language-level record representations.
Repeated-string construction, expanded sizes, 7+2128 ms118 ms92.0 msSparse page-touch checksum; a full byte scan measures a different operation.
Known-vocabulary word scan, 3+16.08 ms2.50 ms2.08 msNo string hashing; complements rather than replaces general word frequency.
Known-vocabulary word scan, exclusive dispatch, 7+35.46 ms2.74 ms5.44 msChecksums matched; Ny now uses exclusive match dispatch to match C's first-byte switch. NYR/C was 1.00×, within the 2.00× class limit with little margin. This is a changed-source checkpoint, not an A/B against the earlier row.

The 2026-10-23 SOR check after bounded loop-GPR allocation used nine samples and three warm-ups. NYR, LLVM, and C matched checksum 1725461952; medians were 3.52 ms, 762 µs, and 1.48 ms. NYR/LLVM was 4.62×, under the fixture's 5.00× limit. This is a focused workload result, not a full benchmark-gate pass.

The 2026-10-23 cold call-chain run used three samples and one warm-up; all routes matched checksum 375998521. Native compile time was 3,162.92 ms against the 3,000 ms cap, a non-fatal miss of 162.92 ms (5.43%). The measured NYR/C runtime ratio was 2.04× against the 30× cap, leaving 27.96× of ratio headroom. Accepted at this checkpoint as a compile-time budget miss, not as closure of the compile-time limit.

The 2026-10-23 pre-fix cold, single-sample vectorizer check matched every route's checksum: dgemm returned 1 with 32 loop attempts, 32 rejects, and no vectorized loops; pbkdf2 returned 2991 with 55 attempts, 54 rejects, and one vectorized loop. This is a historical baseline, superseded for dgemm by the post-fix checkpoint below.

On 2026-10-23, the cold focused command completed with matching NYR, LLVM, and C checksums (1):

NYTRIX_TEST_COLD=1 ./make bench etc/tests/bench/numeric/dgemm.nshape \
  --bench-run 1 --bench-warmup 0 --jobs 1

The report recorded 31 loop attempts, 30 rejects, and one vectorized loop. The full-size two-row/64-column repro also returned failed= 0; the permanent loop_vector_metadata regression checks the nested dynamic-buffer vector load/store result and all 128 updated elements. The report was build/bench-reports/bench-20261023-014616-2817852.json. This is correctness and vectorizer-counter evidence only: one sample does not establish a performance change.

The loop vectorizer keeps scalar epilogues rather than masked tails. SLP is a separate pass: benchmark loop counters do not count SLP groups. The focused slp_debug check verifies that vector loads and stores retain source locations; it does not establish an SLP group count or runtime speedup.

FFT's signed-division correctness recheck measured 99 µs NYR; Linpack measured 1.72 ms NYR. Both passed focused checksums. Earlier Linpack was 2.79 ms NYR/653 µs LLVM/149 µs C with no bounds checks or dynamic operations reported in its main function; that did not by itself locate the bottleneck.

Compilation and startup

Import-heavy compilation

The October 3 investigation measured cold native emission of vterm-key-state-open, with both standard-library caches disabled. Its roughly 43.9 s starting point fell through successive, separately measured changes:

ChangeRecorded resultCorrectness or interpretation
Register-allocation prefilterIntermediate cold median about 39 sReduced unnecessary allocator work; not the final acceptance result.
Conservative alias-name prefilter35.940 s median; matched disabled control 38.622 sFull alias scans fell from 21,857 to 1,106. Positive candidates retained source/module precedence.
Source-order layout index29.173 s medianThirteen focused checks passed; three 8,540,352-byte outputs had identical hashes.
Enum-member cache28.385 s median15,844 queries, 11,823 hits, 4,021 tree scans; enum traversal fell below the profile's 0.5% display threshold.
Scoped function-name cache25.120 s enabled mean, 28.222 s disabledSame executable, three runs per arm, identical output objects; exact-string keys avoided interner-order changes.
Block-local coalescer segment lookup24.344 s medianThree cold emits, identical object hashes, correct end-to-end output; met the then-current 25 s target.

The alias index conservatively covered explicit aliases, imported items, plain-use leaves, and module leaves. A miss could reject alias resolution; a hit still used the original resolver. Layout indexing preserved source order and dotted suffix aliases. Enum caching included misses because tags and declarations were fixed for the expanded program's lifetime. Function lookup kept a bounded 8,192-entry cache; longer names and allocation failures retained the original resolution path.

Larger function caches, a last-query cache, a combined key-length/hash loop, and enumerating only coalescer header predecessors did not show repeatable benefits and were removed. One early alias-index output differed in size; later layout-index runs were deterministic. A mismatched-executable profile was discarded rather than used to explain instruction offsets.

The final coalescer change kept uniqueness and first-match checks while searching the current block's segments instead of the complete segment list. Its sampled self share fell from 11.97% to 6.44%. Five allocator/CFG fixtures and all 62 benchmark checksums passed; the one-sample benchmark was correctness evidence, not a performance campaign. Generated-program runtime was outside this compile-time target.

Pong AOT compilation and startup

Pong's font setup accepts an optional glyph subset; omitted glyphs are prepared on demand, while the default still primes ASCII. font-subset.nshape checks prepared and missing glyph metrics on native O0/O3, AOT O2, and LLVM MCJIT. The app prepares its score/label characters before drawing. Its 26 net rectangles are cached as packed records and rebuilt only on framebuffer resize. The AOT executable completed three 20-frame headless-Weston runs. NYTRIX_PONG_FRAME_TIMES=1 measures submission/show completion, not physical display scanout.

The original mapping oracle's eight-entry thread-local dedup cache could forget an address still in the append-only exact-range table, exhausting the 256 entries with duplicates. Registration now scans that table under its writer lock before appending. nytrix-map-oracle-dedup cycles 32 allocated ranges 32 times; the old runtime fills the table at 256, and the regression passes with the fix. Distinct ranges still saturate capacity. A 4096-entry trial delayed saturation to about frame nine, then frame intervals returned to roughly 210 ms; the same 60-frame run stopped in libvulkan_radeon.so with SIGSEGV, whose cause was not established. The capacity increase was reverted. Append-only positive range knowledge needs lifetime-safe invalidation before capacity can grow without weakening pointer safety.

Historical three-run medians at 1280×720 on private headless Weston were:

VariantMedian to first submitted/shown frame
Original app and runtime1714.20 ms
Font subsets1612.48 ms
Subsets plus cached net geometry1505.97 ms
Fresh runtime with range deduplication1417.93 ms

These successive runs overlapped other host work and runtime builds, so they do not establish a controlled speedup. Subsequent frames remained around 210–220 ms. The mapping-oracle bound-overflow experiment and its current check are recorded with the runtime changes; startup still needs a stable headless comparison.

The 2026-11-10 cache-disabled Pong -O2 AOT compile measured 62.185 s on the synchronized toolchain: type validation 10.243 s, codegen 11.783 s, object emission 42.560 s, runtime object 0.006 s, link 0.319 s. A sampled run recorded 6,246 CPU-cycle samples with no lost samples. The largest named self costs were CFG building 2.60%, imported-member lookup 2.44%, loop-edge coalescing 2.37%, refinement lookup 2.20%, type-map initialization 1.78%, and register-allocation segment lookup 1.59%; no one hot path accounts for the 30-second gap. The profile-time run before rebuilding the launcher and compiler as a matched pair is not comparable and is excluded.

A later synchronized compile after the mapping-oracle change completed in 70.350 s, including 14.092 s rebuilding the runtime object. Its type validation took 10.227 s, codegen 11.723 s, object emission 34.969 s, and linking 0.237 s. The different cache/build state prevents treating this as a direct regression against the 62.185 s run; both remain above the 30 s target. No compiler hot-spot optimization was established by these measurements.

New cache-disabled -O2 runs on the updated tree took 58.139 s with default thread settings, 56.042 s with --threads 4 (10.349 s type validation, 11.938 s codegen, 36.259 s object emission), and 63.450 s with --threads 8; the eight-thread run parallelized only five of 4,956 regions. Disabling x86 home DSE took 52.267 s (10.303 s type validation, 11.828 s codegen, 32.488 s object emission), but generated code differs and its Pong runtime was not validated. None meets the 30 s target; these experiments establish no retained compile-time speedup.

The current cold-cache, eight-thread --run=aot profile ran under headless Weston at 1280×720 with cache-disabled compiler/runtime settings and NYTRIX_PONG_MAX_FRAMES=1. Total time was 75.334 s: type validation 10.019 s, codegen 11.547 s, object emission 31.732 s, and nyr_build_ir 30.046 s; the first submitted frame arrived 1.200 s after app startup. Reachability timers split its 6.978 s into 0.066 s for top-level roots, effectively zero for function roots, and 6.912 s for transitive call-graph scanning across 2,725 functions. Function lowering took 6.864 s and rt_main lowering 12.248 s. Machine lowering took 0.520 s, bundle encoding 4.430 s, and ELF writing under 0.2 s. The _range_contains function still uses the legacy fallback after a register-allocation failure. A root-seeding filter experiment did not change the 2,725-function reachable set and was reverted. Earlier default-cache verification explicitly printed [gfx] Using Native Vulkan Backend; its one-frame run took 52.498 s total. These runs confirm the three-second compile/link/first-frame target is not currently close to passing; profiling did not establish a retained compiler speedup.

A follow-up instrumented NYIR build used an already-cached runtime object and completed the same one-frame Weston/Vulkan AOT path in 53.401 s. Its 29.815 s NYIR build split into 6.893 s reachable-function collection, 6.857 s function lowering, 6.019 s post-inline optimization, 4.221 s call-effect inference, and 0.295 s rt_main lowering. The post-inline stage runs the full optimizer over up to 512 functions after cleanup, small inlining, and general inlining. The call-effect stage includes fixed-point propagation and patching calls in the function bodies. Machine lowering was 0.519 s, bundle encoding 4.414 s, and ELF writing under 0.2 s; object emission was 31.482 s. A temporary attempt to skip that full optimization when general inlining made no changes reported 355 reoptimized and 157 unchanged functions, but an unpaired noisy run was slower (37.146 s nyr_build_ir, 39.577 s object emission). It was reverted: the earlier small-inline/cleanup mutations were not tracked, and no output equivalence or speed improvement was established. The new opt-in stage timers are retained to isolate these costs on future matched runs.

A separate cache-disabled --run=none type-pipeline profile, with the finer HM-phase timers enabled, measured 18.862 s total: context construction 1.229 s, HM 8.078 s, type validation 10.070 s, and codegen 11.584 s. Within HM, scheme collection took 0.081 s, the top-level sweep 0.405 s, inference across 8,430 schemes 7.299 s, and semantic completion 0.293 s; only four functions were inferred during the first-pass top-level sweep. These counts identify whole-scheme inference—not the initial sweep—as the measured HM cost. Pipeline timers are nested/overlapping and must not be summed to reconstruct wall time. A separate 99 Hz software-clock profile captured 1,824 samples with no loss. It sampled repeated refinement lookup at 5.37%, HM environment matching at 5.59%, and module lookup/cache paths at about 8.6% combined. HM expression inference was distributed across several symbols. The sample identifies investigation targets, not independently attributable savings; no optimization to these paths was justified by that profile alone. A follow-up changed ny_lookup_refine to consult the existing name-to-definition/miss memo before scanning registered definitions, while invalidating the memo when the extra program, parsed-refinement, or registry-refinement counts change. The build and generated-refinement fixture pass. One cache-disabled --run=none Pong profile after this change measured 18.948 s total (type validation 10.113 s, codegen 11.586 s); its instrumented repeat measured 18.728 s total, with 8.042 s HM time on the validation pass and 6.7 s on the post-codegen HM pass. These are single unpaired observations against an earlier 18.862 s profile; they do not establish a compile-time speedup. The full language type suite completed with 343 passed, 0 failed across 273 runtime and 70 error fixtures, including the generated-refinement and mutable-flow differentials.

A separate NYIR cleanup removed five redundant rt_main small-inliner scans: the helper walks every current instruction, only clones straight-line bodies without calls, and does not expose new calls for a later sweep. It also removed a duplicate three-pass sweep. The cache-disabled one-frame AOT run completed under the existing headless Weston/Vulkan compositor in 75.232 s: type validation 10.236 s, codegen 11.713 s, object emission 31.501 s, runtime object generation 22.926 s, and link 0.272 s. Frame 1 was reported at 1.267 s after app startup. The client output did not include [gfx] Using Native Vulkan Backend; backend selection is therefore unconfirmed for this run. This single-sample result does not establish a compile-time improvement, and the 3-second acceptance remains unmet.

The ./make bench call-chain smoke completed with exit 0. It reported NYR 699µs, LLVM 541µs, and C 245µs, but also reported an internal-versus-decoder instruction-count divergence (180,701 versus 186,499) at an equivalent lea whose operand ordering differed textually. Do not treat that output as proof of instruction-count parity or as a speedup measurement for the inliner edit.

For output verification, a cache-disabled native -O2 Pong AOT run with NY_DEBUG=1 completed two frames and exited 0 after 52.8 s process uptime. It selected [gfx] Using Native Vulkan Backend on the AMD Radeon RX 9060 XT; the frame-2 capture logged nine draw calls and saved /tmp/nytrix-pong-verify.png. The image showed the court, center net, paddles, score labels, and controls. Auto-dump/debug overhead means this is an output check, not a clean timing sample; it still confirms the current compile-plus- launch is far above 3 s.

Matched cold-cache AOT screening runs used --native-only -O2 --run=aot, CCACHE_DISABLE=1, NYTRIX_AOT_CACHE=0, NYTRIX_NATIVE_CACHE=0, NYTRIX_STD_CACHE=0, NYTRIX_STD_BC_CACHE_AUTO=0, runtime -O3, and one Pong frame. All four selected native Vulkan and completed:

Compiler threadsNYTRIX_STD_THREADSWallUser CPU
8default (8)53.214 s63.539 s
64default (8)49.881 s76.867 s
96default (8)52.240 s87.735 s
646448.996 s76.959 s

These are single-run screening results, not a repeated speedup estimate. 64 compiler threads with 64 standard-loader threads were fastest by 7.9% versus 8/8, while consuming 21% more user CPU; 96/8 threads were slower than 8/8 despite consuming 38% more user CPU. Raising only standard-loader parallelism from its 8-thread default saved 0.885 s at 64 compiler threads. The object profile's clock() values are process CPU time, while its ny_ticks subphases are elapsed time: build-IR CPU time was 30.347 s at 8 threads and 26.298/27.179 s at 64/96; parallel machine-lowering elapsed time was 0.518/0.277/0.328 s, and bundle-encoding elapsed time was 4.505/1.054/1.071 s. The 3 s acceptance remains unmet. A final cold 64/64 run with NYTRIX_PONG_FRAME_TIMES=1 took 50.927 s wall / 79.027 s user and reported frame 1 at 1.131 s after app startup. It again selected native Vulkan; this confirms the first-frame timing path but does not pass the 3 s compile/link/first-frame limit.

The latest cache-disabled, four-thread --native-only -O2 --run=aot run completed in 53.684 s wall (78.506 s user, 7.964 s system) on 2026-11-10. It selected native Vulkan and reported frame 1 at 1.460 s after startup. NYIR construction took 37.616 s for 2,725 reachable functions; its measured sub-stages were 7.590 s reachability, 7.304 s function lowering, 6.430 s post-inline optimization, and 4.584 s call-effect inference. Machine-object emission took 10.418 s, including 5.685 s bundle encoding; ELF writing itself was under 0.13 s across the reported writer stages. These phase measurements overlap with pipeline timings and are not additive. This one run establishes no speedup, and cold compile/link/first-frame remains far above 5 s.

A cache-disabled -vvvvvv --callgraph=3 --run=none trace completed in 66.277 s and peaked at 1,060 MiB RSS. It loaded 146 modules (4,389,365 standard-library source bytes); import scanning took 0.00018 s, core loading 0.066 s, and parsing 0.348 s. Type validation took 9.403 s (HM inference 7.831 s); reachable-function collection took 7.566 s for 2,725 functions; function lowering took 8.493 s, post-inline optimization 23.840 s, and call-effect inference 4.345 s. The deep pass tracing materially increased optimization time, so these are diagnostic figures, not performance baselines. The bounded graph reported 305 displayed nodes and 4,873 edges at depth 3, with remaining edges omitted from text output. Before the trace, the default callgraph path used a 256-entry function buffer and failed on Pong; it now allocates the native 16,384-function capacity, and this run completed.

The profile also exposed malformed x86-64 object layout: parallel register- allocation fallbacks were appended after the data tables, placing function symbols outside .text and allowing code/data overlap. The parallel builder now appends the tables after all fallback bodies, and the ELF writer rejects unsectioned function symbols outside .text. On the corrected output, _vk_check_descriptor_pool and rt_load32_idx both lie within .text, and the saved AOT executable selected Vulkan and completed a one-frame run. One earlier first-launch attempt still exited with signal 11 during surface startup; a GDB run, direct relaunch, and the later cold AOT run succeeded. That intermittent runtime crash is not root-caused by these measurements.

The runtime archive builder's 25 C translation units now have independent parallel compile tasks with distinct source/object paths; the archive is assembled in the original fixed unit order after they finish. A first apparent 2.295 s runtime-object result was only a runtime-cache restore, not a parallel compile. A controlled uncached comparison then used NYTRIX_RUNTIME_OPT=3, NYTRIX_RUNTIME_NATIVE=0, CCACHE_DISABLE=1, and the same harmless host warning flags (order reversed to create distinct runtime-cache keys):

Runtime archive compileThreadsRuntime objectTotal AOTObject emission
Parallel87.473 s60.135 s32.207 s
Serial124.465 s81.501 s35.535 s

Both launches reported one frame. The runtime-object stage improved 3.28× in this paired profile; total AOT time is not a clean scaling comparison because the compiler and object stages also used different thread counts and varied. The parallel run reported 8 OpenMP regions across 2.86 million tasks; the single-thread control reported no OpenMP regions. This verifies the runtime archive scaling path, not the 3-second target. A separate cache-enabled NY_DEBUG=1 AOT launch printed [gfx] Using Native Vulkan Backend and reported frame 1 at 1.459 s after app startup. This confirms the intended renderer path but is not a cold-cache timing result.

The final cache-disabled -O2 build after the AOT font-registration fix took 55.971 s: type validation 10.599 s, codegen 12.111 s, object emission 35.917 s, runtime object 0.0046 s, and link 0.242 s. A fresh current-source run took 56.241 s: type validation 10.516 s, codegen 12.122 s, object emission 36.379 s, runtime object 0.0067 s, and link 0.249 s. The font change was a source representation correction, not a compiler-speed optimization; the small run-to-run difference does not establish a regression. Object emission remains the largest stage and the 30 s target remains unmet.

Fresh NYTRIX_AOT_CACHE=0 scheduler trials measured 56.622 s with four threads and NYTRIX_PARALLEL_MIN_WORK=512, 55.653 s with eight threads and the same threshold, and 57.144 s with eight threads and a 128-item threshold. The parallel report counted 65 OpenMP regions for the four-thread case and only five for the eight-thread cases, out of 4,967 regions overall. These are single-run screening results, not a matched speedup; thread/grain tuning does not close the 30 s gap.

A fresh cache-disabled -O2 --threads=4 --native-only --run=none object-emission profile took 55.128 s: type validation 10.359 s, codegen 11.864 s, and object emission 35.477 s. perf record -e cpu-clock:u captured 6,155 samples with no losses; the recorded ny-full BuildID matches the executable. The largest named self costs were CFG construction 2.73%, imported-module re-export lookup 2.26%, register-segment lookup 1.97%, refinement lookup 1.92%, module lookup 1.66%, loop-edge coalescing 1.54%, HM inference 1.51%, and type-map initialization 1.41%. Two unresolved libomp addresses account for 10.20%; without a known-code control, their attribution remains unverified. Object emission is still the dominant measured stage, and no identified compiler function accounts for the 30-second gap. A member-cache key experiment using intern IDs measured 55.946 s without sampling and was reverted: the runs are not a matched comparison and establish no speedup.

A CFG label-map audit found that cfg_label_map_init always chooses a power-of-two capacity. Hash reduction and linear-probe wraparound now use cap - 1 masks instead of remainder. The seven cfg-matched fixtures passed. Two cache-disabled AOT screenings took 50.718 s and 41.795 s wall versus the earlier 53.684 s run; the spread is too large to establish a repeatable gain. The latest run selected native Vulkan and showed the window through the X11 fallback because the isolated Weston socket was no longer running; it did not record a first-frame time. A recursive exact-function subtree-cache trial passed modules/use 45/45 but one AOT screening took 57.284 s, so that unproven memoization was discarded.

The x86-64 mixed-bundle parallel-encoding candidate passed focused ELF64 debug-line, multifunc, and call-object fixtures. Three cache-disabled Pong -O2 --threads=4 --native-only --run=none measurements with that candidate took 57.054 s, 57.460 s (NYTRIX_PARALLEL_MIN_WORK=1), and 56.530 s (NYTRIX_PARALLEL_MIN_WORK=1, parallel report enabled); the last reported 4,958 parallel regions and 2,856,770 tasks across the full compile, not specifically the object emitter. These runs do not establish a compile-time improvement; object emission remained about 37.5 s and the 30 s target remains unmet.

Parallelizing NYIR-to-machine lowering in the same x86-64 bundle path also passed the focused ELF64 fixtures. A cache-disabled run at four threads took 56.316 s (10.207 s type validation, 11.723 s codegen, 37.185 s object emission); the parallel report counted 67 OpenMP regions. At 32 threads it took 57.611 s with 38.624 s object emission and only two OpenMP regions. Neither run met the target or showed a speedup over the current 55.128 s reference.

Changing bundle encoding to retain successful functions and use the legacy machine/NIR fallback only for failed functions passed the focused ELF64 debug-line, multifunc, and call-object fixtures (5/5). A fresh cache-disabled Pong -O2 --threads=4 --native-only --run=none compile took 51.948 s: type validation 10.140 s, codegen 11.655 s, and object emission 32.809 s. A second cache-disabled run at eight threads took 51.165 s: 10.193 s type validation, 11.707 s codegen, and 31.882 s object emission. Instrumented bundle encoding handled 2,725 functions in 5.193 s at four threads and 4.117 s at eight; only ny_fn_core.reflect._range_contains required the fallback. The eight-thread output passed readelf --lint and ld -r. These are single-run measurements, not matched evidence of a speedup; both remain above the historical 30 s compile-only target and the user's 3 s compile/link/first-window target.

Repeating the eight-thread compile with the default parallel grain (rather than forcing NYTRIX_PARALLEL_MIN_WORK=1) took 50.530 s: type validation 10.162 s, codegen 11.621 s, and object emission 31.529 s. Bundle encoding took 4.148 s. The output again passed readelf --lint and ld -r. This single run is only 0.635 s faster than the preceding forced-grain run; neither run measures launch or first frame.

Further instrumentation on a fresh cache-disabled eight-thread run measured 51.599 s total: type validation 10.413 s, codegen 11.947 s, and object emission 32.079 s. nyr_build_ir consumed 30.656 s, split into 7.091 s reachable-function collection, 6.942 s function lowering, and 12.376 s rt_main lowering. The 2,725-function machine bundle then encoded in 4.417 s; ELF section serialization, including 154,901 relocations, took under 0.2 s. This rules out ELF serialization as the object-time bottleneck. The run emitted an object only; a compile/link/launch/first-frame measurement is still needed against the new 3 s target.

A cache-disabled --run=aot run under the dedicated headless Weston Vulkan compositor compiled and launched Pong, then completed 60 frames in 66.377 s total. Its first frame was reported at 1.360 s after app startup; runtime object generation took 13.480 s and link took 0.294 s. Weston loaded its Vulkan renderer, but the client did not print [gfx] Using Native Vulkan Backend, so the selected client renderer is unconfirmed. This run misses the 3 s compile/link/first-window target by a wide margin and is not yet valid backend acceptance.

A subsequent --run=aot invocation with default caches and NY_DEBUG=1 completed one headless-Weston frame in 52.498 s total. It reported a cached runtime object (0.004 s), but object emission still took 31.674 s; frame 1 arrived 1.412 s after app startup. The client printed [gfx] Using Native Vulkan Backend. Default caches therefore did not bring this source compile near the 3 s end-to-end target.

One subsequent 20-frame headless run showed 1.629 s to the first submitted/ shown frame and roughly 200–210 ms between later frames. It had no paired baseline, so it establishes neither a startup improvement nor a regression. A separate strace run counted 928,250 mincore calls (8.796 s reported in that syscall) but slowed the app enough to invalidate its frame timings. A non-traced CPU profile sampled _font_builtin_create under _resolve_text_font; this identifies a path for further investigation, not a proven cause of the syscall count. The bound-overflow change preserved conservative distant-address rejection but did not establish lower startup cost.

# Same-session Vulkan comparison after runtime fixes

Using the same 1280×720 headless Weston Vulkan renderer and explicit native Vulkan backend, the pre-cache AOT executable took 1.189 s to its first shown frame and 14.249 s for 60 frames, with later intervals around 204–210 ms. The intermediate build with only the exact-pointer SSO-probe cache took 1.155 s and 7.745 s; it still had a 0.51 s interval spike at frame 49 and failed to load the Pong font. After fixing the AOT UI module's inferred global type, the corrected build took 1.194 s to its first shown frame and 2.141 s for 60 frames; later intervals were roughly 16–18 ms, without a spike or font-load warning. The app reported [gfx] Using Native Vulkan Backend. A 60-frame perf stat run also completed (2.190 s wall time, 1.074 s task-clock), without the previously observed ZeroDivisionError.

Five-frame strace -c -e mincore runs counted 837,099 calls before runtime fixes, 389,911 after the SSO-probe cache alone, and 77,524 after both the cache and font fix. Traced timings are invalid; these counts show reduced calls in this setup, not elimination of mincore or proof that distinct-range exhaustion is impossible. The conservative range-capacity limit was not increased.

The Pixman-rendered Weston variant rejected the Vulkan surface query and the application fell back to its mock renderer; it was discarded. Weston with --renderer=vulkan and the application log [gfx] Using Native Vulkan Backend were required for valid runs. The font failure was in core/os/ui/render/mod.ny: the module-level _next_font_id was inferred as a dynamic value, and AOT lowering mishandled its increment/return path. Declaring it mut int preserves the integer representation. The AOT -O2 variant of font-subset.nshape now passes alongside native O0/O3 and LLVM MCJIT; the corrected Pong app completed 60 frames with no font-load warning. The earlier ZeroDivisionError did not recur after the fix; its connection to the font bug is unproven.

Larger editor workload

A later workload on revision 2f25b3ac plus local changes took 128.71 s cold and emitted a 25,226,512-byte object. Register-segment lookup, not the earlier loop-edge coalescer, dominated its relevant call chain. A single-segment fast path retained the existing inclusive bounds check. Its sampled share fell from 22.35% to 19.43%; profiles took 132.533 and 127.039 s, with zero lost samples but some unresolved frames. Inline decisions and output objects were byte-identical. This supports a local lookup improvement, not closure of a new editor compile-time target or a change to inlining policy.

Validated editor compile

The 2026-10-22 comparison used revision f05fdb2f plus a recorded local snapshot, clang 23.1.1, the existing Release configuration, and frozen compiler objects/dependencies. Saved executables kept concurrent workspace rebuilds out of the comparison. The candidate changed the range-query/peephole helpers and included a regression entry. The hashed source set contained the editor and library tree: 524 files, 11,096,879 bytes. Generated core/std sources were also hashed. Both fresh compiler processes used the default profile, explicit -O3, native x86-64 ELF emission, and disabled standard-library/automatic bitcode caches. Source files were read for hashing before measurement.

The expected result was a successful complete native object with identical bytes and inline decisions. Both compiler processes exited zero:

CheckBaselineCandidate
Profile interval4,180.842 s1,423.179 s
cpu-clock:u samples405,961133,477
Validated instruction addresses405,961133,477
Lost samples00
Unvalidated addresses00
Object bytes33,223,63233,223,632
Printed inline records235,037235,037

The profile interval was 2.94 times shorter. These are first-to-last sample intervals from one attribution pair on Linux x86-64 (EPYC 7642); other local compiles overlapped portions of the recordings. The inline streams matched byte for byte, including repeat multiplicities and the 447-duplicate compaction summary. Identities:

baseline compiler BuildID: 5ecf7136bdc0c2d7742f95a9dce8ae3ea4358640
candidate compiler BuildID: 8ca6fb7aa30bd52c1998dd461e91f45148e235cf
editor.ny SHA-256: 3cde184e5142eac1e9b99be26d6be6d55ef4ff8b0c09d8cf57127341cf681b3b
source manifest SHA-256: cadb3989cf15a09ed147e8b90efbad168185c4d7ff4318a4cdbc6a9dc532abda
std.ny SHA-256: d1b3cdd3b15793174b4e6fde0928c5987111675f4cff1f4278be243673ff0fd5
core.ny SHA-256: 4e6546b4cbf53905cb0de1cabf250d0f5a50e236c3b519083df9417e483cae2c
both objects SHA-256: a6215bffe8bb8857627cea1a2e1c74e6d549b65abeb3ed06ad91f4183cf4e7e9
both inline logs SHA-256: 005eb94e6b0b8e81befcf511fd35969e38d0e4149420ad7693dc870ac25dc6b2

The per-file hashes, compiler/object identities, build commands, logs, captures, ELF headers, validation scripts/results, and accepted comparison are retained under build/editor-compile-investigation/current/, outside source control. source-graph-inputs.json and generated-inputs.json contain the input hashes; comparison.json records the accepted pair. Exact compile routes:

profile_dir=build/editor-compile-investigation/current
NYTRIX_STD_CACHE=0 NYTRIX_STD_BC_CACHE_AUTO=0 NY_TRACE_INLINE=1 \
  perf record -m 1 -e cpu-clock:u -F 99 \
  -o "$profile_dir/baseline.data" -- "$profile_dir/ny-baseline" \
  --no-progress --native-only --opt-level=3 --run=none \
  --output="$profile_dir/editor.o" etc/labs/editor.ny \
  > "$profile_dir/baseline.log" 2>&1
NYTRIX_STD_CACHE=0 NYTRIX_STD_BC_CACHE_AUTO=0 NY_TRACE_INLINE=1 \
  perf record -m 1 -e cpu-clock:u -F 99 \
  -o "$profile_dir/cached-candidate.data" -- "$profile_dir/ny-cached-candidate" \
  --no-progress --native-only --opt-level=3 --run=none \
  --output="$profile_dir/editor-cached-candidate.o" etc/labs/editor.ny \
  > "$profile_dir/cached-candidate.log" 2>&1

Validation checked every sampled IP against its executable MMAP, matching ELF BuildID, executable load segment, symbol start, and decoded instruction boundary. Matching libc debug symbols resolved private functions; a strlen@plt sample was checked through its GOT relocation and IFUNC resolver. The same software clock configuration put all 49 known-code control samples inside known_hot. A bounded frame-pointer control validated 245 addresses across 49 samples; the three-second compiler caller capture validated all 1,457 addresses across 301 samples, with zero loss. It connected the sustained CFG cost to serial peephole range queries. Captures with a replaced executable, unrelated compiler edits, or interrupted emission were excluded.

The unchanged CFG helpers' self-sample counts fell as follows:

SymbolBaselineCandidate
nyr_cfg_build_impl184,63334,874
nyr_block_last_non_nop34,8591,142
cfg_label_map_find26,2651,114

The query scope now reuses topology and definition positions while reading predicates from the current instructions. Instruction insertion, value-count changes, and storage moves invalidate automatically; branch/definition-position edits require explicit disposal. The serial peephole loop preserves those positions between inserting rewrites. Singleton intervals skip edge refinement, and parity candidates reject unrelated definitions before scanning uses.

The new range_query driver compared cached and fresh results for singleton and contradictory bounds, integer extremes, live predicate edits, instruction insertion, storage movement, new value IDs, and explicit invalidation after branch retargeting. Its expanded mutation checks linked the exact candidate optimizer objects. All 80 checked optimizer drivers retained their previous results: 77 passed; gvn_pre, magic_div, and polyhedral_nest failed on both the reference and candidate. An earlier aggregate SMT check reached its 40 s timeout on both the reference and initial candidate, and supplies no passing execution result. The normal ny-full build and focused range, boolean, VRP, and bounds-check drivers also passed in the shared checkout.

Runtime gate investigation (2026-11-13)

./make bench --jobs 4 --bench-run 5 --bench-warmup 2 completed all 77 fixtures with matching checksums and no execution failures. Its JSON classified 62 rows as ok, 14 as unstable, and gcbench as a fixture-budget regression. Sixty fixtures had at least one comparable NYR/C, LLVM/C, or NYC/C ratio above 1.2x. The EPYC 7642 host was shared with compiler and kernel builds (load roughly 39–50, 66 GB available in /tmp). This is investigation evidence, not an idle host gate pass. The report precedes the scalar and wrapper changes below.

The iter post-inline failure exposed two separate vectorizer assumptions: unrolling copied only instructions before the induction update, potentially omitting a later reduction update; vector accumulation emitted the final reduction at a named successor after an unlabeled exit had already observed it. Unrolling now requires the reduction update within its cloned prefix. The accumulator result is emitted at the actual exit block, preserving vectorization and dominance of exit observations. The vector metadata driver checks both orders and exit observations with vector accumulation enabled and disabled. Native and LLVM return checksum 400020000.

The C iter reference now uses preallocated, zero-initialized buffers, matching the Ny fixture's allocation scope instead of timing dynamic append growth. This changes the reference baseline. A focused 5+2 run reported NYR 34 µs and LLVM 27 µs; a later cold run under contention reported noisy 72/52 µs results. Neither focused result replaces the full gate. time-profile also remains noise-sensitive; its status has not been hidden or its samples discarded.

The iter reduction also exposed a loop-phi carry gap in register allocation. coalesce_loop_edges rejected any phi edge whose edge block had more than one predecessor, even when the copy source was defined in that edge block. The accumulator phi (header block 13, v279) therefore spilled and reloaded every iteration. The carry now accepts a source defined on the edge and uses that edge's live segment; only a source that must arrive across the branch still requires a unique predecessor and a terminator-ending segment. After the fix, the hot latch is vpaddq ymm10, ymm10, ymm9 with the accumulator resident in ymm10; the only remaining stack traffic is the loop-exit store/reload at [rbp-2352]. Focused 5+2 warm runs pinned to an idle CPU reported checksum 400020000, NYR 357–369 µs, LLVM 356–364 µs, C 267–275 µs, NYC 304–307 µs (NYR/C 1.30–1.38x, NYR/LLVM 1.00–1.02x).

That harness ratio is not a code comparison. The same fixture built as a standalone AOT executable measured 288–307 µs against C at 266–276 µs (1.08–1.12x). Both kernels fault the same pages inside the timed region (about 80 in map, 78 in reverse, none in sum), but ny -run starts with about 6,300 user page faults against C's 260. Pre-touching 24.6 MB in the standalone AOT process raised it to about 342 µs and C to about 351 µs, reproducing the harness range. The extra cost is first-touch allocation amplified by the compiler's resident set, not generated loop code. The result is also cache-state sensitive: forcing a fresh stencil or JIT compile (NYTRIX_STENCIL_CACHE=0 or NYTRIX_JIT_CACHE=0) pre-faults the heap during compilation and the same timed region reports about 34 µs, while the default warm-cache harness reports about 350 µs. Keep the cache state fixed when comparing and do not read the cold-compile figure as a code result.

One real code gap remains in this fixture: the reverse loop is scalar because the affine vectorizer rejects negative strides (access.stride < 0 in loop_vectorize.c), while C emits a 4-lane vpermq reverse load. It accounts for roughly 10 µs of the standalone gap and is left as a vectorizer item.

The new phi_elim_deep_vec8 regression also showed that vector phi elimination materialized vec8.load.i64/vec8.store.i64 without the MAY_TRAP effect bit required by the verifier, and that its hand-built loop used a backedge label that was not a CFG predecessor. Both are fixed and the driver passes.

Scalar assembly review found that 3 * n retained a constant left operand and missed the x86 immediate/LEA selection used by n * 3. Machine lowering now normalizes integer commutative operands without changing floating operations. Native execution tests cover both operand orders, factors 3/5/9, large and negative constants, live inputs, and wrapping limits. The boolean peephole also removes positive-polarity comparisons of an exact x & 1 result. Its regression checks negative inputs, integer extremes, both mask operand orders, and comparisons against -1/0/1/2. Native collatz assembly uses LEA and omits the previous materialized equality comparison; its checksum remains 178.

Binary: scalar recurrence and register homes

The canonical workload's checksum was 3360874588549334. Its linked native caller inlined branch_mix but retained a scalar dependent recurrence, while LLVM vectorized independent seeds. An outlined helper's frame size was not the cost of that inlined timed loop.

Representative counters were about 37.05 million native instructions versus 3.67 million LLVM instructions, with similar branch/cache misses. An earlier cross-block eligibility relaxation increased instructions from 78.99 to 91.31 million despite overlapping wall-time ranges; it was rejected. Verified software-clock sampling and matching machine images connected hot home traffic to loop-carried values; invalid raw-IP profiles did not.

Recorded retained changes included:

Signed divide-by-two lowering used a logical shift for its 0/1 bias, not an arithmetic 0/−1 bias. A negative-seed workload exposed native result 3450853999197106 versus the correct LLVM/C 3456948289413084. Unique-edge carry required matching physical colors, an explicit carried segment, safe predecessor/successor structure, and no intervening clobber. A nominal register color alone did not establish residency. SELECT-arm coalescing reused a dying arm's color but preserved a still-live arm. The target result stopped spilling; aggregate runtime did not improve. Common-addend factoring preserved raw-i64 wrapping, SELECT guards, ownership metadata, and effect restrictions. It fired in the measured recurrence but did not by itself meet the 5× native/LLVM cap. Side-effect-free SUB_I64 became eligible for if-conversion. Empty branch bridges were resolved only with exclusive-edge checks. Physical fallthrough deletion required the next block to have no other incoming branch. One matched 5+2 comparison improved 2.450 to 2.148 ms, with static spills/reloads falling from 9,059/26,933 to 7,854/23,140; C dispersion exceeded 120%, so it established no stable NYR/C ratio. Constant-division scheduling admitted immediate divisors other than 0 and −1, preserving trap order and scratch-register clobbers. One 3+1 result was 1.897 ms native/388.1 µs LLVM, below the 5× cap; a completed 71-fixture serial run recorded 1.91 ms/385 µs and passed its then-current gates.

Other checksum-valid snapshots still exceeded that cap: one supplied 72-fixture result was 2.32 ms/387 µs, and a focused 3+1 result was 2.313 ms/384.8 µs. These are distinct compiler/workload checkpoints, not proof that the earlier gate result holds today.

Rejected Binary experiments

ExperimentReason not retained
Broad caller-saved register poolCall-clobber and later Euler9 failures; profitable-looking local allocation did not prove safe residency.
Weighted R8 homes across recognized power-of-two divisionInstructions fell from 37.04 to 36.08 million, but candidate/control NYR medians were 2.400/2.383 ms.
Loop-carried GPR opt-inLower elapsed time was not supported by lower cycles or instructions.
Invariant-only loop-home filterNo useful change to the canonical result.
Larger full-unroll budget through 18 tripsNo demonstrated gain; did not make the nested seed loop vectorizable.
CFG clone cap 256→512→1024The 512 trial remained above the cap; 1024 regressed to 3.968 ms and 11.04× native/LLVM.
More permissive CFG clones, including division/fallthrough shapesSome synthetic legality tests passed, but canonical runs were unchanged or regressed to 4.26 ms.
Paired recurrence unrollingOne direct result was 2.741 ms versus 2.304 ms; not a controlled gain.
Reduced if-conversion budgetBranchful code was substantially slower; one sample rose to 5.34 ms.
Deferring signed division to machine loweringExtra allocator pressure; no canonical performance improvement.
Literal-depth specialization or selected-multiplier source rewritesPrevented useful inlining or regressed the unchanged workload comparison.
Earlier common-add factoring probeApproximately 2.39 versus 2.40 ms, without a repeatable gain; distinct from the later guarded retained rewrite.
Narrower division clobber maskRegressed to 2.29 ms and 6.19× native/LLVM.
Branch-bridge inversionCould bypass required register-home saves; passing one checksum was insufficient.
Rematerialization preference, wider copy forwarding, loop-update coalescingNo sufficient canonical gain.

The remaining SIMD opportunity concerned independent seeds, not weakening the dependent-recurrence legality guard. Existing unroll-and-jam required a known even trip count, step-one induction, and a pure two-block body; larger budgets did not satisfy those structural requirements.

Splay and native register allocation

Entry-address rematerialization reachability

The reported C failure needs an entry-block LEA and another definition to coalesce to the same machine vreg. Domination alone does not make a vreg-numbered address fact immutable, so the x86-64 object encoder retains its unique-definition guard.

That PHI-coalescing route is unreachable for current Nytrix functions: mach_coalesce_copies starts at pass 1 for non-C functions and skips synthetic PHI edge copies (source_pc == UINT32_MAX). Ordinary Nytrix coalescing also requires both operands to pass mach_cc_raw_vregs; C does not have these restrictions. This does not rule out other encoder bugs; revisit if synthetic edge-copy coalescing becomes available.

etc/tests/code/targets/x86_64/addr-local-loop-phi-x86-64.nshape covers a pointer changed across a loop, including zero and one iterations; its O3 native oracle is 42 and @noinline preserves the function boundary. It passes with and without only the unique-definition guard in an isolated compiler build, so it is coverage, not a reproducer of the C failure. Five cold fixtures passed: this case, addr-local-x86-64, addr-local-multi-x86-64, addr-borrow-local-x86-64, and ELF64 addr-deref. No compiler behavior changed.

The supplied early Splay row was 16.9 ms native/4.01 ms LLVM/4.53 ms C; a 5+2 confirmation was 16.733/3.978/4.414 ms. Later safe-source checkpoints were around 5.4 ms native, still behind C. These changes were incremental, not one matched end-to-end A/B.

Useful retained mechanisms:

Call-safe loop homes were checked per candidate, rather than rejecting an entire function because some loop contained a call. Vector overlap was likewise checked against each scalar candidate's live range. PHI copies were placed in a predecessor with a single successor instead of always using an out-of-line trampoline. Sticky-home self stores were omitted only when the same home was already valid. Direct frame-to-allocated-register loads avoided an extra RAX move. Scaled LEA reused resident base/index registers and loaded only missing operands. An initial premature encoder return truncated a function; commit failure propagation and switch-local exit corrected it. Small constant multiplies used direct-register LEA where legal. Negative signed-32-bit immediates used the seven-byte encoding instead of ten-byte movabs; this was a code-size result, not a demonstrated runtime gain. Callee-saved address homes and a restricted call-free R8 home reduced some traffic without reopening broad caller-save eligibility. Cross-block compare-flag reuse required identical operands, a flag-preserving trampoline, unique false-edge entry, fused branches, and ended compare-result lifetimes. Linked code confirmed the second compare disappeared; timing differences remained within variation. Direct incoming-argument setup required a unique entry-block frame load, no write to its slot, only fixed frame stores between eligible loads, and no incoming-register clobber. Only callee-saved scalar GPR destinations were eligible; aggregate and more-than-six-parameter signatures stayed excluded.

The timed caller still reloaded five call arguments in one inspected object; the callee had 89 vregs, 221 segments, 40 frame slots, and a 544-byte frame. Another large main frame contained roughly 24 KB of source buffers; frame size must not be equated with spills. C kept the traversal inline in its timed loop, but forced native inlining alone did not provide a repeatable gain.

Default loop homes remained useful: a matched 5+2 control measured 5.46 ms native versus 6.88 ms with them disabled. A separate process counter comparison recorded 52.05 million native versus 13.91 million LLVM instructions; those counters included startup and reporting.

Rejected allocator and Splay experiments

ExperimentFinding
Unrestricted same-block home reuseFocused tests missed a Binary crash. The constrained version excluded frame-loaded values and required disjoint single-segment GPR intervals.
Globally relaxed cross-block colored readsSOR returned 412269742 instead of 1725461952, independently of the indexed-store bug. Canonical-home seeding remained necessary.
Larger loop-home block ceilingThe relevant timed function was already below the existing ceiling.
New carry rule for SOR row basesHomes grew from 1,240 to 1,288 bytes and timing did not improve.
Lower vector-unroll factorsNo stable SOR benefit; another factor-two trial increased instructions and missed n-body's budget.
Immutable parameter-home aliasingNo repeatable runtime gain, despite excluding mutated/address-taken parameters.
Unproved incoming-register loads or skipped parameter-home storesCould read a register after entry had clobbered it; removed despite passing selected checksums.
Pre-allocation compare elisionSeven fewer segments, but frame grew from 544 to 576 bytes and runtime stayed about 5.35 ms.
Broad pressure-aware inlining or forced splay/join inliningControls did not establish a repeatable gain; source hints were reverted. Cost approval alone did not prove an inline splice occurred.
i32 loop annotations, cached child loads, equal-immediate copiesNo stable gain or no confirmed hot-path code change.
Global-buffer source parityFailed with extreme memory growth before useful timing; failure stage was not isolated.
Setup/timed-loop extractionOne refactor broke checksums and rose to 699 ms; explicit-buffer variants restored checksums but overlapped baseline timing.
Direct immediate-to-home storesFocused boundaries passed, but the timed hot path did not exercise the new encoding.
More caller-save/address-home candidatesExtra eligibility did not establish a safe, repeatable improvement.

The earlier compare-residency regression exercised both outcomes of an emitted integer comparison. A path-only temporary-file descriptor leak also affected benchmark reporting; closing those descriptors and serializing timed workers were harness fixes, not Splay optimizations.

Vectorization, floating point, and addressing

SOR

Affine row-base splitting moved (row + column + displacement) << scale toward an invariant row pointer plus scaled column. Indexed-address folding then recognized memory uses correctly: STORE.dst was an address use, not a vreg definition. Linked objects confirmed direct SIB loads/stores, while readable text assembly still showed extra temporaries. Five row-base home reloads and the outer grid-swap recurrence remained distinct costs.

Later four-wide f64 loops used AVX2 arithmetic but still spilled scalar address and induction values. Permitting callee-saved scalar homes across vector instructions changed two NYR medians from a 3.41 ms baseline to 3.17 and 3.14 ms; C was unstable. Hoisting horizontal neighbor offsets in the benchmark source changed a 3.269 ms row to 2.871 and 2.889 ms, but this was a source change with noisy follow-up results, not a stable compiler ratio improvement. Reducing the vector-unroll cap from eight to four or two did not help.

LICM later hoisted address-producing additions before vector rewriting and corrupted the checksum (5515142 versus 1725461952). Keeping an add in its loop when its use chain feeds a scalar/vector address restored correctness. The fixture gained an explicit known-checksum assertion.

Vector and loop legality

Four-lane f64 used a 32-byte machine representation: x86-64 emitted VEX instructions; AArch64 used paired NEON operations. Strict reductions retained ordered rounding. Machine width, storage homes, and induction stride had to agree; a four-lane operation advancing by two was a real correctness bug. PBKDF2's late-vectorization corruption (2991→3978) came from reduction PHI handling. The dedicated correction and containment checks were distinct from earlier speculative rotate/BCE explanations. Guard-derived ranges required explicit predecessor/update proofs. Coverage included strict/inclusive bounds, step-two traversal, matching multi-latch updates, overflow, bypass edges, unknown-effect calls, and overlapping stores. Unsupported or conflicting shapes retained scalar execution. Restricted unswitching remapped SSA/exit PHIs and labeled cloned fallthrough exits, preserving unselected traps. Multiple distinct exits remained rejected. Interchange admitted only independently proven private, injective, in-bounds stores and invariant stack reads; overlap/overflow cases remained rejected. These were legality improvements without measured runtime claims. DGEMM's FPR-home dataflow modeled scalar-conversion clobbers per block, rather than rejecting all homes because a conversion occurred elsewhere. A later PBKDF2 failure reported missing vec4.reduce_add.i64 emission. An attempted scalar emitter/four-word-home change still crashed and was reverted. The contemporaneous BCE-matrix crash was not thereby fixed.

Address and ABI correctness

FailureRecorded correction or limit
Forwarded RAX result followed by a same-home no-op copyDo not treat the no-op as a consumer that makes the canonical home unnecessary.
f64 loads ignored a pending RAX addressUse the same validated scalar-address load path as integer loads.
Indexed integer store staged its value in R10, then address formation clobbered R10Preserve the value while resolving the full destination address.
Vector store ignored a pending SIB addressResolve the complete memory address for ordinary and fast-path V256 stores.
Adjacent single-use ADD/loadCapture the address operands and omit the home only when later uses/live-out do not require it.
Runtime ABI tables failed binary searchPlace rt_set_len_raw in lexical order in both declaration and argument-contract tables.
AVR prologue overwrote incoming argument bytes in r16:r17Use caller-clobbered r26:r27 for stack-pointer temporaries before spilling arguments.
Broad immediate arithmetic loweringSilent Binary/Splay/SSE miscompiles outweighed focused successes; reverted.
Profile-driven block layout with synthetic steps but zero positive block heatLeave the function unchanged; synthetic profitability was not real layout evidence.

Memory facts, bounds checks, and scalar optimization

GVN reused dominating reads of the same local slot only without an intervening write. Proven non-local reads could survive unrelated local stores; address-taken locals still required alias safety. Effect-only calls such as clock reads were not automatically writes to existing memory. JSON parser byte loads fell from four to two in the relevant optimized shape; manually caching the byte in source did not establish a separate runtime win. Append-length reuse needed canonical declaration identity and the same-local assignment lineage. Handling only one lowered call spelling missed the fast path. BCE reused a single CFG/dominator map across its proof families. Append and typed-buffer setter results supplied logical may-alias lineage, not permission to assume every handle identical. Store reachability and freshness still mattered. Returned-borrow provenance followed one unique trusted argument only when effects excluded invalidating writes. A successful runtime assertion supplied its true-edge lower bound only if dominance/control flow proved execution. Function-local allocation roots enabled proofs that observable module-global cells could not support. Adding list<int> to an empty list alone did not improve the benchmark. Moving asserted buffers into helpers changed the source baseline. Historical matrix/sort results after that change cannot be presented as a compiler-only A/B. A remaining nested non-affine address rejection was separate from the removed bounds check. Counted zero-fill rewriting required a nonnegative, bounded, non-overflowing byte range and preserved observable writes. It did not justify weakening alias or trap checks. The escape-loop kernel eliminated allocation, checks, and the loop while preserving checksum 499999500000; both backends measured below 1 µs. A guarded affine reduction also resolved the earlier inline loop gap. Recursive constant evaluation restored gcbench to approximately 369 µs native/374 µs LLVM/33 µs C. That did not establish safety for broader recursion, side effects, malformed flow, or exhausted evaluation budgets. Havlak's promoted integer reads were raw i64, but equality had reached a dynamic tagging boundary. The focused correction addressed that mismatch; passing a reduced case alone had not established the full fixture fixed.

Runtime arithmetic and allocation

BigInt and BigFloat

Similar NYR/LLVM times pointed to shared runtime arithmetic and immutable allocation APIs, rather than only native code generation. One old fixture version counted 166,814 allocations and 11,207 runtime calls; a later checksum-matched run counted 158,116 allocations and no reallocations. Those counts belong to different checkpoints.

A marked execution interval identified these sampled self shares:

ComponentShare
rt_malloc_impl18.07%
Heap-limb reading9.04%
Knuth division7.07%
__udivti33.34%

Only 509 of 2,927 samples fell inside that interval; zero samples were lost. Earlier whole-command sampling mostly measured compilation and was unsuitable for choosing an arithmetic change. A separate single scaled probe put BigInt square root at 52.5 ms, BigFloat add/subtract at 46.7/36.8 ms, BigInt power at 32.6 ms, and BigInt add/subtract at 31.0/32.3 ms. These were diagnostic operation timings, not stable baselines.

Recorded retained changes:

Exact-u64 BigFloat construction wrote directly into the final object when precision sufficed. Two A/B pairs showed about 2.7% fewer instructions, but cycles and wall times were inconsistent; no wall-speedup claim followed. BigFloat square root reduced Newton steps from 4 + floor(log2(precision)) to 1 + ceil(log2(precision)), keeping a guard step: 12→9 steps at 256 bits. Ordinary-precision division used stack scratch, larger inputs retained heap scratch, and exact division by two folded into the result exponent. Four candidate medians were 33.45–34.50 ms native versus a 37.82 ms preceding baseline; spread and C variability limited the comparison. Focused boundary/differential/padding checks passed after fusion; the earlier 2,027-test cold pass preceded that final fusion. Redundant two-limb multiplication probing was removed, and division reused its validated divisor-limb view. Five alternating pairs had medians 756.56→727.67 ms, all checksum 1968365; an overlapping benchmark made the 3.8% difference provisional. Nine focused cold rows passed, not a full cold suite.

Rejected arithmetic experiments included direct short-division result writes, power-of-two quotient shifts/remainder masks, replacing division with a source shift, and removing a wrapper zero check. One alternating shift/mask comparison was slower despite 56 retained arithmetic boundary cases. A multiply/divide fusion pattern could not match: NYIR called module wrappers with expanded three-word any arguments, not the inner runtime helpers. The unused helper and pass were removed. None of these trials established an arithmetic gain.

Typed-buffer and allocation lookup

Retained changeMatched resultLimit
Compact typed-buffer header read after an epoch-valid provenance-cache hitSeven interleaved heapsort runs: native process median 98.330→15.220 ms; LLVM 85.664→4.032 msAll other handles retained the resolver and sanitizer/header checks. This was process wall time, not startup subtraction.
Most-recent thread-local allocation-dedup range before eight-entry searchEleven interleaved BigInt runs: 130.534→126.995 ms; retired instructions 440.425→430.703 millionAbout 2.2% fewer instructions; did not close the GMP gap.

Widening the length shortcut to generic rt_len regressed Splay and was removed. Rematerialization/forward-edge residency experiments were also removed; canonical homes remained required unless every edge and clobber was proved. LLVM spill-weight source was studied under its license, but no code was copied into these independent runtime changes.

Dictionaries and strings

Native dictionary handles already registered with the runtime avoided repeated validation. Resize thresholds were cached until capacity changed; empty first integer-key probes bypassed grouped collision search. Collisions, overwrite, and growth retained the existing behavior.

Word counting moved from split-list construction to token spans, avoiding repeated-key allocation. Counts used the dynamic integer representation: raw 1 otherwise collided with tagged zero, losing singleton words. Semantic coverage included whitespace, repetition, growth, long keys, empty input, and non-string input. An earlier two-pass tokenizer removed an intermediate token list without demonstrating a material gain on its own.

Correctness and verification history

These are completed historical checks, not verification performed for this page revision.

InvestigationObserved outcome
Early cold native parity1,122/1,131 passed; later 1,185/1,191, then 1,189/1,191.
Subsequent focused fixes1,192/1,192 passed, including 61 benchmark correctness fixtures; not a performance result.
Untyped closure ABIA function's own result representation had to prevail over a later call site's raw inference.
Sound-source reachabilityFalse global-name resolutions inflated the graph from the intended workload; targeted resolution reduced reachable functions 973→262→148 and avoided the former 8 GiB failure.
Sound emission and executionEmission completed at 220 MiB; the cold matrix covered NYIR VM, MCJIT, ORC, native, and native+VM. Physical 440 Hz playback and a 144,044-byte/72,000-frame WAV were separately checked.
Sound numeric specializationConcrete f64 poly_blep avoided a dynamic representation error; a separate old integer-output discrepancy was not a new sound-memory failure.
Diagnostic re-loweringJSON-parser pass dumping crashed although normal execution passed; re-lowering lifetime/output handling was corrected. Diagnostic output volume remained a separate issue.
Four-lane f64 and runtime contractsFocused drivers passed; the full optimizer sweep reached tv_smt_semantics and timed out, so no complete sweep pass was established.
Later vector campaignBinary ratios passed, but BCE-matrix and PBKDF2 crashed before samples; the campaign failed overall.
Isolated reported benchmark mismatchesSeveral nqueens, float comparison, Fannkuch, FFT, knucleotide, and Euler9 failures did not reproduce in focused checks; unstable rows stayed unaccepted. A passing rerun was not a newly identified fix.
Platform audio and list/cache regressionsSelected cold rows passed; no new audio cause or full-suite fix was inferred.

ORC perf-map support used object-symbol sizes and loaded addresses. Missing sizes, unresolved mappings, or invalid raw sample IPs could not be repaired by accepting a profiler's symbol label. A code dump established what was emitted, not which instruction consumed time.

Benchmark validity and coverage

Harness and reference corrections

Timed fixtures/routes became serial and stopped inheriting ordinary test concurrency. A 66-worker run on a 96-thread host overlapped another suite and exhausted memory; its timings were not accepted. Explicit comparison worker settings did not make overlapping timing valid. Native timing used the compiler's nanosecond phase marker. C wrapper timing covered its whole measured body; timer-floor fallback was reported, not silently compared as equivalent kernel time. Progress updates did not become samples. Matrix validation changed from a weak positive accumulator check to the exact checksum 1105103687680; BCE matrix used 49995000. A plausible nonzero result was insufficient for transformation acceptance. BigInt references precomputed the same square-root operand. The C floating workload changed from double to 256-bit GMP, and Ny timing expanded to include setup and final power/checksum work. Earlier ratios were superseded; explicit C teardown remained a difference. Fannkuch's attempted 32-bit parity changed direct raw accesses into generic helper calls, regressing native to 9.81 s/72.3 billion instructions. It was reverted. A separate vector-disjoint home comparison measured 282 ms versus 400 ms forced-stack, with 24% fewer instructions. Thread-ring aggregate misses did not establish false sharing. perf c2c sampling was denied by host permissions; that was missing evidence, not zero HITM and not justification for speculative mutex padding. Completed campaign results and incomplete attempts stayed distinct. The historical 71-fixture pass did not validate a later interrupted 72-fixture attempt or close subsequently reported per-fixture failures. Build integration preserved explicit NYTRIX_CORE_PATH and the supported legacy CMake input instead of overwriting configured core-bundle paths.

Workload coverage

The Goose benchmark design and results informed coverage questions, not borrowed performance claims or copied source. Its useful distinction was flat controls versus allocation, layout, mutation, and teardown at several working-set sizes.

Public fixtureQuestion covered
Graph BFSCSR construction and traversal at 4K, 32K, and 256K vertices, four starts per size.
Expression treeIndexed recursive interpretation with a changed leaf before each of 4,096 evaluations.
RecordsMixed tag/two-word rows at 32K, 256K, and 2M records, matching C's 24-byte AoS.
RepeatString construction at 1, 16, and 128 MB without turning validation into a full byte-scan benchmark.
Word frequencyGeneral string-key aggregation, including owned splitting/counting costs.
Known-vocabulary scanAllocation/token scanning and a small counting kernel without hashing.

The repeat fixture's earlier full byte-scan form measured 441/391/12.8 ms and checksum 1122000000; that was a memory-scan finding, not a string-copy comparison. Early general word counting measured 1.75 s/1.84 s/3.78 ms before the later direct-counting result, so its old hundreds-fold gap should not be presented as a current hotspot.

Distinct remaining coverage questions included mixed variable-payload records, an allocation-heavy S-expression arena, bounded LRU mutation, incremental adjacency construction, and cache-sized image blur. Flat scans, list growth, binary trees, numeric kernels, particles, and the fixtures above already covered several related shapes. Varying vocabulary cardinality/token length, separating build/query/teardown, and comparing aliased/non-aliased kernels would answer additional questions; a list of benchmark names alone would not.

Rejected constant-division scheduling trial

A scheduler latency estimate that treated positive power-of-two signed divisors as short operations was built and screened against the single binary fixture. The 11-sample partial run reported 2.00 ms NYR, 322 us LLVM, and 6.20x NYR/LLVM; the fixture completed successfully. This was not a matched before/after comparison, used GCC for the host-C route, and did not pass the unchanged 5.00x gate. The source change was reverted; retain the result as a rejected, inconclusive experiment. Raw report: /tmp/ny-binary-divlatency.json.

Binary runtime diagnosis (2026-11-03)

Timed-object inspection

The exact native-tier AOT object was emitted from cached benchmark source and inspected with objdump; the relevant function is ny_fn_branch_mix. The current loop carries i, acc, and x in callee-saved registers. The signed divide-by-two result (v36, machine segment [19,27]) has no allocated color because of register pressure and is stored/reloaded at -0x150(%rbp) each iteration. Several short-lived branch values also spill; updated x is already written directly into %r15, so the earlier two-spill description is stale. --emit=asm is a generic listing and is not the timed object.

A SELECT-arm elision prototype was rejected after the relinked object showed no instruction change. The select-flag-preservation runtime fixture passed all four variants during that experiment, but no performance gain was established. A pinned 11-sample matched run used native x86-64, opt tier, -O3, one warm-up, and CPU 12. NYR median/min/max were 1.756597/1.728875/1.828070 ms; LLVM was 0.327349 ms and host C 0.568908 ms. NYC was 8.365809 ms. All four checksums were 3360874588549334. NYR/LLVM is 5.37x, still above the unchanged 5.00x fixture ceiling. A prior 11-sample run on another CPU reported 1.750 ms NYR, 0.325 ms LLVM, and 0.558 ms C; retain it as supporting data, not a strict same-core comparison. The next general optimization should reduce or split the short-lived divide result's live range under fixed-register clobbers and local pressure. Do not change fixture work, checksums, compiler comparisons, or gate limits to close the item.

BCE vector carry experiment (2026-11-03)

JIT carry-flush result

Inspection of the relocated JIT image showed that the x86 BR and BR_IF encoder cases flushed every seeded vector to its stack home, bypassing the allocator's carried && !spill proof. The encoder now preserves only those proven vector carries across internal branches; exit segments still flush, and call boundaries still flush all vectors because vector registers are caller-saved. The exact ny_fn_matrix_sum JIT loop no longer stores its accumulator on the loop backedge. A pre-loop seed load/store remains, as do chunk-load staging operations.

A same-source A/B used the bce-matrix fixture, NYR -O3 --native-only --native-backend=x86_64 --native-tier=opt, nine process-isolated runs per version, and matching checksum 14439925760000. The baseline median was 15.720 ms (15.675–15.744 ms); preserving proven carries measured 12.566 ms (12.552–12.625 ms), a 20.1% reduction in this fixture. This confirms the branch-flush cause and a local runtime gain; it does not close the LLVM/C or full-matrix acceptance gaps. Focused native_vec4_f64, vec8_reduce_loop, loop_vector_metadata, regalloc_cfg_edge_carry, and regalloc_loop_phi_carry regressions pass. The initial run exposed that loop_phi_carry_enabled opted scalar GPR carries in but omitted scalar FPR carries despite the shared NYTRIX_GPR_LOOP_CARRY switch. The gate now covers both scalar classes; regalloc_fpr_loop_phi_carry, regalloc_loop_phi_carry, regalloc_cfg_edge_carry, and regalloc_unchanged_dag_carry pass. The existing float-loop-register-calls runtime fixture also passes both -O0 and -O3 native x86-64 variants with NYTRIX_GPR_LOOP_CARRY=1 and all result/JIT/AOT caches disabled, covering calls, joins, and conversion scratch use.

A follow-up four-route AOT run used x86-64, -O3, peak profile, warm cache, CPU 28, 11 measured samples and one warm-up. All routes returned checksum 14439925760000:

NYRLLVMHost CNYCNYR/LLVM
12.714 ms (12.672–12.803)6.334 ms (6.317–6.423)1.608 ms (1.594–1.663)91.739 ms (91.701–92.090)2.01x

This passes the unchanged per-fixture NYR/LLVM ceiling of 5.00x. It is one fixture result; the 72-fixture rerun is still required before closing the cross-fixture item. Raw report: /tmp/ny-bce-carry-check.json.

Rejected loop-PHI latch reuse trial (2026-11-03)

Relaxing the x86 loop-PHI edge check to allow the incoming value to reuse the old PHI register after its final latch read reduced the benchmark's static spill/reload counters, but made binary much slower. With NYTRIX_GPR_LOOP_CARRY=1, ./make bench binary --bench-run 11 --bench-warmup 2 --bench-opt O3 --bench-compile-profile peak --bench-compare-llvm measured 7.76 ms NYR (min 7.73 ms), 317 us LLVM, and 1.04 ms host C; checksum 3360874588549334 remained correct. The matched pre-change carry-flag run was 1.75 ms NYR. The allocator change was reverted; fewer static spills did not translate into faster execution. Raw report: build/bench-reports/bench-20261103-132333-356243.json.

Binary hardware-counter profile (2026-11-03)

A seven-run matched benchmark with two warmups measured 1.75 ms NYR, 317 us LLVM, and 1.04 ms host C for checksum 3360874588549334. The validated AOT counter run recorded 26.56M NYR instructions versus 3.66M LLVM instructions; branch misses were nearly equal (4,518 vs 4,515), as were cache misses (11,723 vs 12,602). This points to excess NYR instruction work rather than branch prediction or cache misses. NYR/LLVM remained 5.53x, above the 5.00x per-fixture limit. Raw report: build/bench-reports/bench-20261103-132518-358879.json.

A later pinned 11-sample run on CPU 12, after rebuilding the compiler, measured 1.773 ms NYR, 316 us LLVM, 1.054 ms host C, and 8.353 ms NYC; all routes returned the same checksum. NYR/LLVM was 5.60x. Its checksum-validated AOT counters were 26.57M NYR instructions vs 3.66M LLVM, 4,809 vs 4,611 branch misses, and 12,490 vs 12,656 cache misses. The accompanying native object disassembly still shows the signed divide-by-two result stored to and loaded from -0x150(%rbp) in ny_fn_branch_mix. The power-of-two latency scheduling candidate and a just-in-time single-use deferral candidate were not retained: neither produced a verified matched runtime improvement. The startup FLOOR row is the intentional empty timer control and is excluded from the workload ratios; the startup-class gate remains a separate unresolved issue. Raw report: build/bench-reports/bench-20261103-134322-399654.json.

The subsequent 72-fixture full matrix used three samples and 21 parallel fixture workers. All checksums matched, but this run is only a broad regression screen, not low-contention acceptance. The binary row measured 1.762 ms NYR, 318 us LLVM, and 1.047 ms C (5.54x NYR/LLVM); it remains over the unchanged 5.00x limit. The empty startup timer control remains FLOOR; separately, the five-workload startup cohort measured NYR/C 1.224x and LLVM/C 1.130x against unchanged limits of 0.42x and 0.30x. Raw report: build/bench-reports/bench-20261103-135250-429124.json.

The next full 20-worker run reported bce-matrix checksum -14354741043200 and a 423.587 ms NYR time. Re-running the fixture alone with ./make bench bce-matrix --no-build --bench-run 3 --bench-warmup 1 returned the expected checksum at 14.1 ms; a second full 20-worker run also returned the expected checksum at 14.276 ms. The anomaly is not reproduced, so keep it open as an intermittent correctness failure. The second full run still failed the binary, datastructures, startup, and string gates; append-scaling measured 7.829 ms NYR vs 3.072 ms LLVM (2.55x, above its 1.50x fixture limit). Report: build/bench-reports/bench-20261103-140002-447190.json (mismatch) and build/bench-reports/bench-20261103-140431-460598.json (clean repeat).

After the benchmark driver's Clang rebuild crashed on parse.c, the already built ny-full binary was used for 11 single-process binary launches pinned to CPU 12. Every run returned checksum 3360874588549334; the median timed kernel was 1.749 ms (1.730–1.757 ms). This is a NYR-only follow-up, so it does not replace the matched NYR/LLVM/C report above. The failed rebuild's Clang reproducer is /tmp/parse-b761af.sh.

The rejected register-clobber candidate modeled immediate power-of-two division as clobbering only RDX, and stopped flushing RCX in the x86 encoder. Its pinned 11-sample run preserved checksum 3360874588549334 but regressed to 1.945 ms NYR versus 328 us LLVM (5.92x). The timed linked object still stored the signed divide result to -0x160(%rbp) in ny_fn_branch_mix; other loop values also shifted into stack homes. The candidate and its regression test were removed. Raw report: build/bench-reports/bench-20261103-135047-424579.json; object dump: /tmp/ny-bench-native-426219-232140242-8.dump.

Narrow loop-home spill reduction (2026-11-03)

The binary benchmark's pinned 11-sample baseline measured 1.759 ms NYR (1.737–1.807 ms), 327 us LLVM, and 554 us host C. Inspection of the timed linked object showed ny_fn_branch_mix storing and reloading the result of a single-use constant divide inside its loop. The x86 loop-home allocator now admits that one-definition, one-use value alongside CFG-proven loop-carried values. The existing x64_readonly_loop_gpr execution test covers a loop with a single-use constant-division result.

The pinned candidate run measured 1.739 ms NYR (1.733–1.756 ms), 320 us LLVM, and 554 us host C; the checksum remained 3360874588549334. NYR elapsed time fell about 1.1%, while NYR/LLVM moved from 5.38x to 5.43x because LLVM's sample was also faster; the row remains above the unchanged 5.00x gate. In the timed object, ny_fn_branch_mix shrank by 11 bytes and its %rbp references fell from 10 to 8 as the quotient store/reload disappeared. Aggregate NYR instructions were unchanged at about 26.56M; cycles fell from 6.50M to 6.39M. Whole-program code size changed from 1,141,504 to 1,139,008 bytes, while compile time moved from 76.80 to 77.28 ms. These small runtime changes are evidence for one spill reduction, not a resolution of the binary gap. A focused 11-sample dgemm run measured 192 us and checksum 1; no matched before/after run was made for that fixture. Reports and object dumps are in /tmp/ny-backend-*.json and /tmp/ny-bench-native-*.dump.

AVX1 V256 integer operations and allocation checks (2026-11-03)

The x86 encoder now lowers V256I64 add/sub on AVX1 by extracting each 128-bit half, applying SSE2 paddq/psubq, and inserting the two results back into a YMM register. The fallback keeps values in canonical homes for the function, because its XMM0-XMM3 temporaries must not clobber live allocated values. An executable AVX-only probe checks both operations and reductions. That probe also found and fixed a NYIR lowering typo where VEC8SUB_I64 became machine ADD. Vector FMA encoding now rejects targets missing AVX or FMA.

The focused bce-matrix run returned the expected checksum 14439925760000 in all implementations. Across three samples, NYR measured 13.343 ms, LLVM 3.240 ms, and host C 1.591 ms. The report measured 8,280 NYR code bytes, 6.96 ms compiler time, 124 spills, and 274 reloads. NYR/LLVM was 4.12x; this remains a material runtime gap, and this focused run does not establish a full-suite improvement.

The 11-sample binary allocator comparison did not justify enabling scalar loop-carried GPR residency globally: the default measured 1.721 ms, 1,125,272 code bytes, and 76.67 ms compile time; NYTRIX_GPR_LOOP_CARRY=1 measured 1.734 ms, 1,125,032 bytes, and 77.19 ms. Both runs preserved checksum 3360874588549334. Keep that path opt-in. The verifier-checked segment allocator and unchanged-value DAG carry remain covered by focused tests; the whole-function allocation and full-suite quality acceptance remain open.

Focused checks passed: vec8_reduce_loop, regalloc_loop_phi_carry, machine_home_reuse, x64_readonly_loop_gpr, x64_disasm_vex, and x64_encoder_oracle. AVX-only V256_I64 bitwise operations use AVX1 bitwise encodings; AVX2-only integer operations remain rejected when AVX2 is masked. The AVX1 add/sub fallback is directly executed.

Loop-carried vector lane preservation

An executable machine-IR regression builds a four-lane V256_I64 accumulator, starts with lanes {1, 2, 3, 4}, carries it through five loop backedges, then reduces it on the exit edge. It verifies the allocator marks the vector PHI as carried and checks the generated x86 function returns 60 with the default configuration and no carry environment override. This detects loss of any upper lane.

The first run exposed the bug: the allocator correctly marked the header value carried, but also set its spill bit because the loop had an exit successor. The encoder interpreted that bit as “not resident at block entry,” reloaded a stale canonical home, and returned a garbage result. The bit means the value's home must be published for the exit; the common preg remains valid on both preheader and backedge arrivals. The encoder now seeds any verifier-proven carried segment, including one that must be stored at block exit. Vector loop carry is enabled by default; NYTRIX_VECTOR_LOOP_CARRY=0 remains available to isolate regressions. GPR/FPR loop carry remains separately opt-in.

The focused vector, segmented-allocation, GPR/FPR carry, VEX-disassembly, and encoder-oracle checks pass. The subsequent 73-fixture run preserves checksums for bce-matrix (14439925760000), dgemm (1), and pbkdf2 (2991). It still reports independent failures in fannkuch, n-body, and spectral, and the benchmark gates still fail on binary (6.09x NYR/LLVM) and the startup cohort. This validates vector-lane preservation on the focused generated-code case; it does not establish full backend acceptance. See the archived run above for complete per-fixture measurements.

The first hot-pressure spill-splitting candidate was removed after matched seven-sample tests showed no useful change. Both runs were pinned to CPU 13, used one warm-up, disabled the loop-home overlay in both configurations, and preserved fixture checksums. For binary, control/candidate runtime was 2.769/2.749 ms, code size was 1,125,920 bytes in both, compile time was 79.25/78.01 ms, and spill/reload counts were 9,480/32,617 versus 9,480/32,618. For linpack, runtime was 1.373/1.363 ms, code size was 1,147,728 bytes in both, compile time was 79.71/79.57 ms, and spill/reload counts were 10,176/34,283 versus 10,176/34,284. Runtime ranges overlapped; the generated assembly text was identical for binary. No speedup is claimed, and the opt-in splitter was removed instead of leaving an unaccepted allocator path in the encoder.

The segmented allocator verifier now also checks that every register operand use is covered by a non-overlapping segment. A focused negative test truncates a live range before an actual use and confirms the verifier rejects it. This strengthens allocation validation; it does not resolve the independent fannkuch, n-body, or spectral benchmark failures recorded above.

CFG carry preservation proof and scalar carry A/B (2026-11-03)

The verifier now requires segments to cover live-in and live-out block boundaries. For every carried live-in segment, it checks each live predecessor ends in the same allocated register; a carried edge-copy destination must be defined by a covered, tied copy. Negative allocator tests mutate the incoming register, truncate live-in/live-out boundaries, and verify rejection. The generated x86 loop test executes with scalar GPR carry enabled for inputs -1, 0, 2, 3, 4, preserving each expected result; its emitted function is 152 bytes versus 177 bytes with forced stack homes. The AVX-only fallback, V256 lane-carry, FMA feature-gate, encoder-oracle, and VEX-disassembly checks also pass.

Scalar GPR carry remains opt-in. In a matched serial three-sample full-matrix A/B, 67 fixtures had successful NYR timings in both configurations. The median per-fixture change was effectively flat (+0.11%); several apparent regressions above 10% did not reproduce in an 11-sample dict-set repeat. Its medians were 47.515 ms with carry off and 46.813 ms with carry on, while sample dispersion was 13.2% and 14.7%; code size changed from 1,153,528 to 1,153,432 bytes and compile time was 80.86/80.89 ms. The full run also reproduced existing fannkuch, n-body, and spectral failures. Its overall gate verdict was invalidated when the runner rebuilt a shared core artifact, so these rows are diagnostic measurements, not an acceptance result. Keep scalar carry opt-in until repeated measurements show a broad, stable gain without material regressions. Vector carry remains enabled and is covered by the five-backedge, four-lane executable regression above.

Binary allocator acceptance (2026-11-03)

For the focused binary workload, the final opt-in GPR-carry A/B used the same source, -O3, peak compile profile, warm cache, one warm-up, and 11 timed samples. Both runs returned checksum 3360874588549334. With carry off, NYR measured 5.210 ms (5.182–5.311 ms); with NYTRIX_GPR_LOOP_CARRY=1, it measured 5.093 ms (5.072–5.114 ms), a 2.2% median reduction. Compile time was effectively flat (65.00/64.89 ms), and code size changed by +8 bytes. The aggregate static spill/reload counters remained 3,407/29,376, so this is not a claim that all reported spills were removed. The ny_fn_branch_mix frame shrank by 128 bytes in the inspected x64 object, and the result is kept opt-in: default allocation behavior is unchanged. Focused division/clobber, read-only loop, machine-home reuse, and backend-acceptance tests pass. This is the practical acceptance for this item: a repeatable local runtime and frame-size improvement with correct results, not a new global spill-count threshold. Reports: 184827 carry off and 184902 carry on.

PBKDF2 optimized correctness failure (2026-11-03)

The focused benchmark reproduces a NYR checksum mismatch in etc/tests/bench/numeric/pbkdf2.nshape. NYR O0/O1 returns 2991; repeated O2/O3 runs return varying incorrect checksums. LLVM and host C both return 2991. Disabling loop_vectorize does not repair the result, while --nyr-disable-pass=peephole at O2 restores 2991, narrowing the failure to that pass or its interaction with later lowering. Disabling individual loop passes and range-based compare folding did not repair it. The per-pass oracle cannot continue past iv_elim because its VM does not support the resulting vec4.add.i64 operation. After a full rebuild of ny-full, five consecutive O2 native runs returned 2991; the focused O3 benchmark (3 samples, 1 warm-up) also passed with checksum 2991 (NYR 1.65 ms, LLVM 937 us, host C 1.10 ms). No semantic source fix was identified, so the earlier failing executable may have been stale. Keep the origin unresolved and reproduce it before assigning the fault to a pass. Original focused report: /tmp/ny-pbkdf2-followup.json.

Performance TODO batch (2026-11-04)

Host EPYC 7642, x86-64 native, -O3, executables built from each fixture's NY source and run pinned to one CPU. Medians of 9–15 runs; checksums match the baseline compiler, LLVM, and the fixture's expected value.

FixtureBeforeAfterLLVMChange
dce31 µs0.2 µs0.26 µsselect chain folds to one select
spectral125 µs87 µs79 µsFPR loop homes across conversions/sqrt
mandelbrot928 µs351 µs255 µssame, plus no dead temporary homes
page-rank33 µs21 µs6.6 µssame
linpack772 µs745 µs240 µsno dead temporary homes
binary, dgemm, json-parser—unchanged—neutral within noise

dce: the recovered loop_global_promote and select_chain_fold passes were not wired into the pipeline after a git checkout -- . wiped tracked-file edits; they now run after the mid-pipeline cleanup and again after store forwarding. Two further fixes were needed. Rule R4 merges the add(add(b, C1), C2) chains that R3 builds, and use counts now ignore folded selects so the merge applies within one round. Separately, DCE's fallback nyr_label_referenced() ignored PHI predecessor labels. When max_label exceeded 4 * len + 1024, which the collapsed 500-step function did, DCE merged a fall-through block away and broke the PHI. The 400-step variant stayed under the bound, which is why the bug showed only at 500. The dce_phi_label regression fails without the fix. FPR residency: convert/sqrt clobber only the loop colors their encoding writes, conversions and sqrt may define loop homes, spill-home privacy rejects only LEA'd frame slots and stack/aggregate parameters, displaced segments move to free colors above the loop colors, and scalar register copies use movaps. A segment moved to a free color keeps the allocator's reload/spill flags. Forcing them stored every block-local temporary to a dead home once per iteration (four stores in linpack's row update). Variable-shift recolor miscompile: loop-carry recoloring again checks fixed-register clobbers over the whole interval (x64_loop_recolor runs with loop GPRs on and off), and the post-allocation verifier rejects a colored range live across a fixed clobber (regalloc_verifier_coverage). Vector homes: a single-definition vector whose home is current in its defining block is no longer re-stored at every loop latch. That removes dgemm's invariant-broadcast stores but not its runtime; see the TODO. Boundary coalescing: the arithmetic/SELECT boundary-tie hook had already been reduced to a stub returning false; it is removed. binary and json-parser are unchanged.

All 103 optimizer test groups pass, and all 73 bench fixtures match baseline checksums. This is not a full-gate run.

Gate follow-up (2026-11-04, late)

A serial ./make bench (3 runs + 1 warm-up) failed the algorithms, datastructures, startup, and overall gates on three fixtures:

recursive-fibonacci 2.60x NYR/LLVM (budget 2.00x): statement lowering had lost the AVX2 optimizer option and the post-optimization recursive-call rewrite (nyr_tail_call, which turns f(n-1) + f(n-2) into an accumulator loop). Both are restored in lower/stmt.h; the kernel went from 3.7 ms to 0.32 us. The AVX2 option also feeds the vector passes (bce-matrix 11.0 ms vs 12.7 ms before). dict-set 1.95x (budget 1.50x) came from concurrent builds; alone with 7 runs it measures 30.9 ms vs 25.8 ms LLVM (1.20x). binary 5.33x (gate 5.00x). Keeping MUL by 5/9 as one LEA and the new loop_sub_iv pass (inv - i becomes a decrementing IV) took the inner loop from 19 to 18 instructions and NYR from 1.60 to 1.45 ms, but LLVM measured 266 us in that run (5.47x). The remaining gap is LLVM's outer vectorization.

All 103 optimizer groups pass and all 73 bench fixtures match baseline checksums with these changes.

Outer vectorization residency (2026-11-05)

Targeted serial run, ny-test --bench --bench-run 7 --bench-warmup 2 --bench-compare-llvm, on a host that other sessions were also loading (load average about 14), so these numbers are advisory, not gate evidence:

FixtureRouteNYRLLVMNYR/LLVMstatus
binarydefault1.45 ms266 µs5.45xmeasured
binaryNYTRIX_OUTER_VECTORIZE=1903 µs266 µs3.40xmeasured
dgemmdefault154 µs26 µs5.97xmeasured
linpackdefault739 µs240 µs3.07xmeasured

Before this batch, the opt-in widened binary loop took 2.1 ms. Changes:

Vector latch recurrences (x' = f(x) computed in the latch) share the PHI register when every read of the old value precedes the new definition. The allocator proposes this pairing and the verifier checks it again (verify_vector_latch_recurrence). The latch definition may read the PHI as src0 of a single add/sub/and/or/xor. The loop-carry coalescer tries the PHI's own header color first, picks the color with the cheapest evictions (a segment with no access in its block is nearly free), and coalesces each PHI once per header. Nesting is judged on the natural loop body, not on every block that reaches the header. Coalescing can evict block-local temporaries. Those that were register-only now get a second chance at any color that is still free. Loop-invariant vectors stay resident across the loop when every body segment shares one color with the preheader. Functions with no scalar floats (SysV, AVX2) also allocate xmm4..xmm7 to vectors, giving 10 vector colors instead of 6. Encoder: three-operand VEX binops, register-form vbroadcastsd, and SET1 results written straight into their assigned register.

Correctness fixes found along the way:

The home-path COPY of a four-lane vector used a 16-byte movdqu, which left lanes 2–3 stale. This caused the "wrong binary checksum" that had been blamed on the latch relaxation. mach_ymm_broadcastsd_mem dropped VEX.R for ymm8+. mach_lower_phi_edges counted only leading contiguous PHIs, so a PHI after a DCE-made NOP lost its edge copies. LICM hoisted into a preheader laid out after its loop, which broke the verifier's def-before-use order once the outer vectorizer appended its vector loop.

The full lang + code suite (2139 fixtures) showed no regressions. The 16 failures it reported fail on the baseline compiler too, or pass when run alone.

Outer vectorization is now on by default (NYTRIX_OUTER_VECTORIZE=0 turns it off). Enabling it took four more fixes on the in-process native route (--native-only, native JIT, native result oracle), whose scalar machine emitter hands vector functions to the NYIR emitter:

nyr_phi_elim lowered four-lane PHIs through 8-byte locals. They now go through a 32-byte entry alloca with vec8.store/load.i64. The NYIR emitter had no vec8.sar.i64. It is now lane-wise sarq, with four-slot homes. The home-path four-lane f64 SET1 broadcast from the source's stack home even when the scalar existed only in its float register, which made 2.0 * B read 0 in loop-tail-passes.

The full suite with the vectorizer forced on matched the baseline failure list exactly (2124/2139). The full serial bench that followed (2026-11-05 06:25, recorded above) put binary at 919 µs vs 266 µs LLVM (3.45x) and passed every per-class gate. Every checksum that ran matched.

Later the same day:

nyr_licm_post_vectorize runs right after the late loop vectorizer. It allows hoisting invariant address arithmetic, which the pre-vectorization LICM keeps in place on purpose. That alone took linpack from 760 µs to 320 µs. CSE now merges identical class-refining pointer copies. Home-path f64 broadcasts load the lane with movsd, which forwards, then use register-form vbroadcastsd. Zen 2 cannot forward a store into a broadcast load. A dedicated row-update vectorizer for linpack (runtime dependence guard, scalar remainder) was correct but 2x slower and was removed. The next k step reads the vector-written row back with scalar 8-byte loads, which cannot be forwarded from the misaligned 32-byte stores.

The full suite showed no new failures. The serial full bench at 13:21 (CC=clang, recorded above) passed 72/72 fixtures and every per-class gate: binary 3.31x, linpack 1.33x (329 µs vs 248 µs), and dgemm 5.26x (137 µs vs 26 µs; ungated, host C under 1 ms).

AVX/SSE transitions, vector accumulators and exit homing (2026-11-05 evening)

Legacy SSE executed while the upper YMM halves are dirty stalls on this host (C microbenchmark: 81 ns per transition against 6.4 ns with VEX scalar code). The encoder mixed the two. On AVX targets the scalar and 128-bit SSE helpers now emit VEX forms (NYTRIX_NO_VEX_SSE=1 restores legacy encoding), and vzeroupper runs before calls, before returns, and at entry to scalar-float blocks where no 256-bit value is live. sor fell from 2.67 ms to 0.70 ms and dgemm from 137 µs to 37 µs; this was the dgemm stall that had no explanation without IBS. Fixed-trip integer reductions keep a four-lane vector accumulator again (NYTRIX_NO_VECTOR_ACCUMULATOR=1 disables it): bce-matrix 11.0 ms → 3.4 ms. Loop-carry exit homing ignored liveness. A carried vector segment was published to its home before every loop branch whenever some successor had no carried arrival, including successors where the value is dead. Packed i64 sar by 1 is (a >>> 1) | (a & SIGN), two cycles of latency instead of three.

binary stays at about 3.2x LLVM. Its LLVM reference is itself vectorized across the outer loop: NYTRIX_OUTER_VECTORIZE=0 compares our scalar loop with LLVM vector code and is not a meaningful gate. The remaining gap is instruction count (9.6M against 3.2M at higher IPC, 2.67 against 2.04), mostly in the signed x / 2 sequence and the xor/and/xor select.

The full serial bench at 18:36 (CC=clang, 3+1, load average 4–12, recorded above) passed every timed fixture and every per-class gate. Overall NYR/LLVM was 1.29x and the maximum 3.17x on binary. Other results: dgemm 1.52x (39 µs vs 26 µs), sor 1.21x, linpack 1.49x, bce-matrix 0.53x.

Built and validated after that run (224 of the 225 vector, ABI and optimizer fixtures pass on a private build; f64-scalar-abi fails on the release build too, from the concurrent --run argv change):

vec8.shr.i64 (NYR_MACH_VSHR, vpsrlq). The outer vectorizer emits it for (x >> 63) & 1, which replaces four instructions of the signed-division bias: binary 880 µs → 831 µs. Functions whose float allocation and loop-pinned floats stay in xmm0..xmm3 give xmm4..xmm7 to vectors (NYTRIX_NO_SHARED_XMM4_7=1 disables it). The fourth dgemm broadcast now stays in a register (about 35 µs). NYTRIX_OUTER_VEC_INTERLEAVE=2 widens to two four-lane registers per value. It is correct but slower (1.40 ms) because the second register set spills. Off by default.

NYC copy intrinsic register residency (2026-11-11)

The x86-64 loop allocator now treats known copy intrinsics as clobbers that callee-saved registers can survive. Copies remain indirect-store hazards when stack-home privacy is unproven. Both indexed and fallback proofs agree.

A frozen before/after compiler comparison on the string benchmark's C source, with memcpy replaced by __builtin_memcpy to exercise this path, retained checksum 300003294 in all 11 runs. Best kernel times fell from 643127 ns to 273198 ns; medians fell from 714369 ns to 324634 ns. Object assembly shows fewer loop-counter reloads. This is an intrinsic-path measurement, not closure of the existing string benchmark: its declared memcpy remains a call and measured essentially unchanged. The small-copy-loop-residency.c regression passes NYC O3 and Clang O3, including writes through an escaped local address.

Declared memcpy follow-up

Small constant copies now also lower through compatible external memcpy declarations, including the standard header prototype. Visible definitions, assembler aliases, incompatible signatures, and -fno-builtin retain calls. The seven-run focused string report build/bench-reports/bench-20261111-083623-3891112.json reports ok, matching checksums, and 184 us NYR, 202 us LLVM, 190 us C, and 280 us NYC (1.47x NYC/C). The prior full report measured 3.04x NYC/C. Object inspection confirms no memcpy relocation in the optimized fixture and a retained relocation with -fno-builtin. The copy-residency and visible-definition regressions pass; both are registered with the C frontend fixture runner.

Benchmark LLVM rows and the pinned core bitcode (2026-11-15)

The knight and currying benchmark rows reported llvm_rc=139 at -O3 while the same materialized source ran fine by hand. The failure was not in MCJIT. ./make bench pins build/release/core.bc when the build tree already carries one, but did not refresh it, and ny_jit_cache_path hashed only that artifact's path, so a cached module linked against an older core.bc survived the rebuild. Storing to core globals the stale bitcode no longer defined resolved to address 0 at _ny_top_entry and faulted.

Three changes close it: the bench builds the core_bc target before pinning, the JIT cache key folds the pinned artifact's size and timestamp, and NY_JIT_CACHE_VERSION is 33. A fresh build/release/core.bc plus those keys makes the rows measurable again: knight runs 2.56ms NYR (1.75x C, 2.00x LLVM), 1.28-1.31ms LLVM (0.88x C), and 2.40ms NYC, with checksum 340233 matching on all routes and 0.4% spread across three runs. currying's LLVM row is 2.36ms; the row still fails the 4.0x NYR/LLVM gate because its closure loops cost about 588ns per indirect call, against about 2ns for the direct loop in a 20000-iteration micro-benchmark. Closure ABI flags latch once at creation, so the per-call re-mark is a no-op; answering it and the flag lookup from a memoized resolution instead of the callable lock moved the row from 688x to 668x NYR/C. The rest of the gap is unattributed: strace -c shows no per-call syscall and the generated trampoline is three instructions, but perf is denied on this host.

Constant-condition select folding (2026-11-15)

knight is fully unrolled, and every ternary in the expanded loop body has a predicate that depends only on the induction value of the copy (i >> 1, i & 1, pair == 0 || pair == 3). Those selects survived to machine code as a materialized constant, a test, and a cmovne from a stack home. Nothing folded a SELECT_I64 whose condition was already a known constant.

nyr_select_chain_fold now applies that fold (R0) before its existing rules, releasing the dead arm so its constants and selects disappear in the same round. nyr_peephole has the same rule for conditions proven constant later in the pipeline, plus the select(b, b) identity. On the knight fixture, ny_fn_moves went from 565 to 498 instructions with no conditional moves left, and spills/reloads fell from 485/903 to 382/800.

./make bench knight --bench-run 5 --bench-warmup 2 reports NYR 2.33-2.38ms (1.59-1.62x C, 1.84-1.85x LLVM), LLVM 1.29ms, C 1.47ms, NYC 2.41ms, checksum 340233 on every route, 1.9-2.3% noise; the row was 1.75x C (2.56ms) before the fold. The native artifact is byte-identical whether produced by --native-only -o or the JIT route (NY_DUMP_JIT image matches the object's moves prologue), so this row measures codegen and not the route. Disabling loop_unroll, unroll_jam, or if_convert does not improve it (2.43-2.50ms), and disabling loop_unroll_ssa is worse (3.86ms), so unrolling is not the residual cost.

What remains is home traffic: 199 of the 498 instructions reference (%rbp) homes. Cross-block GPR residency is opt-in and loop-only, and after unrolling moves has no loop, so x, y, nx, ny, and total reload at every unrolled block boundary. Eight compares also fail the flags-fused branch (reason=condition-live-out; the other 50 fuse). Closing the rest needs whole-function residency proofs rather than another peephole. Twelve focused fixtures covering ternary, select, if-convert, deferred cleanup, function values, and the three modified bench sources pass on the rebuilt compiler.

Acyclic GPR carry across calls (attempted, reverted 2026-11-15)

coalesce_unchanged_dag_values proves that a single-definition value stays in one register through acyclic blocks, but it rejected any live region containing a call and passed preserve_gpr_calls = false, so a call split every color. The encoder already keeps callee-saved seeds across a call (mach_call_gpr_home_mask homes only colors 5-11), so the relaxation was to allow call blocks and let the candidate check use preserve_gpr_calls, which leaves only the ABI callee-saved colors eligible for a call-spanning carry.

The proof then accepted 478 values on knight (112 ineligible, 54 with no free color), but the object did not change where it mattered: ny_fn_moves still had 199 (%rbp) home operations and the row stayed at 2.35ms, with 503 instructions instead of 498. Disassembly shows why. x and y were already resident after their one prologue reload, and the repeated homes are block-boundary temporaries (nx, ny, depth - 1) plus the multi-def accumulator total. Those cannot use any unchanged-value proof: the join after each range check has predecessors that do not all supply the value, and total is a PHI at every join. The change was reverted. Closing the rest needs acyclic PHI/join coalescing - the coalesce_loop_edges all-edge proof generalized to non-loop headers - plus an executable regression like regalloc_loop_phi_carry before it can be enabled by default.

Acyclic join carry in the encoder (attempted, reverted 2026-11-15)

The proposed follow-up changed coalesce_loop_edges itself: non-loop headers with no layout backedge now run the same all-edge PHI proof behind NYTRIX_GPR_JOIN_CARRY, a call-spanning carry is limited to callee-saved colors 0-4, and a header that returns the value keeps its home. On knight seven joins committed (h=12 v=26 C=7, h=21 v=36 C=0, ... plus the same set from the second allocation pass), each with five incoming copies and no call use of the PHI.

The emitted code did not change: .text was byte-identical to the run with the flag off, ny_fn_moves stayed at 498 instructions and 199 (%rbp) operations, and the row stayed at 2.4 ms. Two probes explain why. The encoder does not consume the pass allocation; it rebuilds GPR segments with nyr_mach_regalloc_build_x64_class and seeds a carried value only through mach_segment_at(vreg, block_first_inst). Instrumenting that seed loop printed no carried segment at any block entry even with NYTRIX_GPR_LOOP_CARRY=1, and mach_keep_homes_for_store_live_values clears carried for every value that appears in a copy or a store - which is exactly the join PHI set. The bit is therefore invisible where it would matter, for loop carries as well.

Two cheaper encoder-side variants were measured and reverted for the same reason. Eliding a mov A,B; mov B,A reversal (37 such pairs in ny_fn_moves) and a per-home last-store cache both produced byte-identical objects: those pairs are emitted by the inline ALU and copy paths (mach_load_src_preg, the emitted2 sequences), not through mach_mov_preg_preg / mach_mov_reg_rax, so hooking those helpers never fires.

Conclusion: acyclic GPR residency needs the encoder to consume an explicit carried/allocation contract, or a MACH-level copy-forwarding pass that folds copy a,b; copy b,a and single-use copy chains before lowering. Another allocator-side proof cannot move the object. src/code/backend/lower/ regalloc.c and src/code/backend/mach/arch/x86/object64.c were restored to their pre-experiment state.

Same-color copy elision in the x64 encoder (kept 2026-11-15)

The three attempts above looked in the wrong place. The reversed pairs are not MACH instructions and not mach_mov_* calls: the scalar COPY path in object64.c required sp != dp before moving directly between physical registers, so a copy whose source and destination already shared a color fell through to mach_load_op_rax(src) + mach_commit_vreg(dst) and staged the value through %rax although it was already in the destination register. The guard now accepts equal colors and skips the move while keeping the same seeding, clobber and home-store bookkeeping. NYTRIX_NO_SAME_COLOR_COPY=1 restores the staging path.

knight moves: 498 -> 418 x64 instructions; .text 5,240 -> 5,016 bytes (-4.3%); all 37 adjacent reversed pairs are gone; checksum 340233 on the object and JIT routes. Time is neutral rather than a speedup. Eleven interleaved --native-only -O3 -time -run samples per side gave old median 2.364 ms / min 2.345 ms and new median 2.378 ms / min 2.307 ms, inside this host's 1.9-2.3% noise. The win is code size and instruction count. collatz, nqueens, sieve, mandelbrot, knucleotide, calls and bigint-oracle still report ok through the benchmark runner after the change. Other fixtures move less: .text loses 8 bytes on collatz, 32 on sieve, and is unchanged on nqueens, so this is a targeted fix for coalesced definitions rather than a corpus-wide shrink. A full --bench-correctness sweep over all 77 etc/tests/bench/**/*.nshape passes 76 of 77 with this change. The single failure is startup/currying.nshape, which fails identically without the change (it is also the one FAIL row in the assembly audit).

Next:

Performance — measurement method and profile validation. Changelog — verified release records.

Collatz mask-test fusion (2026-11-13)

The collatz inner loop lowers if (n & 1) == 1 { n = 3*n+1 } else { n >>= 1 } to a SELECT whose condition is the mask n & 1 itself (not a ==/!= compare against it). The x86-64 NIR emitter in src/code/backend/mach/arch/x86/machine.c now recognizes a SELECT whose condition is directly AND(x, 1) and emits testq $1, %rax + cmovne, dropping the and instruction and the redundant register copies entirely. The AND's stack home is elided, and the source value stays live through the SELECT for register coloring.

Before: mov n,%rax; and $1,%rax; mov n,%r9; sar $1,%r9; ...; test %rax,%rax; cmovne. After: sar $1,%r9; lea (%r9,%r9,2),%r9; add $1,%r9; test $1,%rax; cmovne.

Checksum 178 matches C/LLVM/NYC. Focused timing shows the Ny kernel at ~12µs vs C ~8.5µs (~1.4x; the reported 2.9x was a ny--time JIT-run overhead artifact, not a kernel gap). Whole-program Ny time improved from ~15ms to ~12ms, still dominated by runtime and page-fault cost rather than the kernel.

A matching object-encoder pass was prototyped in src/code/backend/mach/arch/x86/object.c but produced a checksum mismatch (9 vs 178) and was reverted; the NIR emitter path is sufficient and correct.

A cold GCC rerun exposed an independent reference-wrapper defect: macro-renaming C main removes its implicit successful return. The timer wrapper now inserts an explicit final zero return into that body, preserving explicit early failure returns. Its body scan skips comments and quoted braces. The wrapper regression executes fallthrough, explicit failure, nested-block, quoted-brace, and argc/argv cases through the selected host compiler.

Before runtime work was prioritized, a current-tree editor object compile with six caches disabled took 99.24 s wall and 2,772,484 KiB peak RSS. Reported phases were 10.36 s type validation, 12.37 s code generation, and 85.69 s object emission; phase timings may be nested and must not be summed. A 10-second CPU sample put 19.28% of samples in nyr_find_module_in_root_cached. That helper now rejects statement kinds that cannot contain modules before hashing/caching guaranteed misses. Four existing alias/reexport/module fixtures passed cold. No isolated compile-time speedup or 15-second acceptance result is claimed.

Compiler build-time fixes (2026-11-12)

Machine: AMD EPYC 7642, 96 threads, 62 GB, shared with other agents. Cold means the native, AOT, JIT, stencil, and stdlib caches disabled with a private build of the current tree. These are single-session measurements taken at load 8–20, not gate evidence. Twelve of the thirteen root projects meet 15 s; no UI project does, so the all-project target stays open.

Project (-o, cold)walldominant phase
herodoc0.36 sparse/codegen
ffi1.15 scodegen
args, 110, hexdump, matrix, conway2.6–3.5 scodegen, emit
ant, brainfuck, donut, server3.8–4.3 semit
sound8.7 semit
animation26.6 semit 19.5 s
pong36.5 semit 28.0 s
term51.8 semit 36.1 s
monitor54.7 semit 43.1 s
synth60.6 semit 49.1 s
input95.1 semit 78.2 s
engine87.0 semit 72.9 s
editor73.2 semit 60.6 s
xtool6.8 semit 5.1 s

Emit object is the dominant phase in every UI project. Per-project fixes in this batch removed the HM blockers in the UI library (Wayland clipboard wrappers, asset font/catalog defaults, engineering batch helpers, camera scale). The remaining inference fixes made heterogeneous list literals list<any> and bare list/set/tuple/dict annotations use any elements; the gf scalar overloads were rewritten from a comptime template into three explicit functions, which removed editor's nested-dict error and xtool's expected gf, got int error. A per-vreg first/last live-range pre-check in nyr_mach_regalloc_segment_at measured no gain (animation emit 25.4 s vs 24.6 s, input 75.5 s vs 73.2 s) and was reverted.

The inliner was the other dominant cost. nyr_inline_general rebuilt the caller CFG topology, loop depths, and type map after every committed splice, so a 63k-instruction driver with thousands of tiny calls became quadratic. It now stops after 128 splices per function (NYTRIX_INLINE_MAX_SPLICES) and skips bodies above 100k instructions (NYTRIX_INLINE_BODY_CAP). Functions with fewer than 128 inlinable calls are unchanged. This took editor from 270.7 s (at a 512-splice cap) to 205.8 s and engine from 122.9 s to 93.4 s. Indexing float and vector segments by the instruction where they start or end (the scalar allocator already did this) then took engine to 87.0 s. Finally, the loop-edge coalescer's per-candidate segment_in_block_vreg scan was replaced with a per-vreg index, and then with a one-time (vreg, block) -> unique segment hash table; a block can hold thousands of segments and a long-lived value can have thousands of its own, so both scans were quadratic. That took editor from 205.8 s to 73.2 s (emit 189.5 s to 60.6 s). The engine and animation objects are byte-identical before and after the index changes (SHA-256 prefixes f1a8e01a67f1f0a5 and 14a899e7b7b03d59); engine re-runs ranged 85.8–93.3 s (emit 72.2–79.2 s) at load ~20. The focused benchmark fixtures still pass, but a full runtime benchmark comparison at this cap is still owed.

NYIR type-map initialization now allocates flag regions after type propagation: one region per class observed in the function, plus one zeroed region shared by absent classes. Typed functions no longer allocate and clear fourteen full-size value/local arrays when fewer than seven classes are present. The earlier profile attributed 1.85% self time to type-map initialization; this allocation change has no matched before/after compile-time measurement, so no speedup is claimed and the build-time acceptance items remain open.

Run route --run=native with the mock replay environment: pong 36–41 s, input 109 s, engine 142 s (349 s before this batch's fixes). The default LLVM run route takes pong 56 s and input 102 s, and engine segfaults in LLVM SimplifyCFG after about 115 s on a malformed PHI (the unmodified release compiler does the same, so it is separate from the native route).

Remaining engine native time (87.0 s): encode 72.9 s. In the profile taken before the segment index, nyr_mach_regalloc_segment_at was 12.3 % self, coalesce_loop_edges 8.2 %, mach_float_begin_segments 6.6 %, and mach_float_end_segments 2.4 %. The float and vector begin/end scans now use per-instruction start/end indexes, like the scalar scans; mach_flush_float_to_home_mode still scans every vreg once per block. A persistent per-function object cache is the larger lever for iteration time. editor still spends 60.6 s in emit on its giant function, so it remains far from the 15 s target even though it now compiles.

Rejected NYIR CFG-boundary scan experiment (2026-11-12)

On the same AMD EPYC 7642 host, a focused sound.ny native compile sampled nyr_cfg_build_impl at 4.04% of 520 CPU-clock samples. The experiment removed its temporary boundary bitmap and one full scan, calculating block starts directly in two passes. It passed the CFG regression and x86-64 target suites; the emitted object stayed byte-identical (7df680223713507fe982ffb1cec8cb25bbb8412b96990520812393dc5dc2f917).

The A/B used build/ny-full-before-cfg (BuildID 994641023b6455a692f0dd04ff5036a9e0809a2f) and the candidate ny-full (BuildID 3f061e09c999dd80dc81a1a54bd67ecd807bbaab) with:

NYTRIX_STD_CACHE=0 NYTRIX_STD_BC_CACHE_AUTO=0 \
  perf stat -r 5 -e task-clock,cycles,instructions -- \
  build/release/ny-full --no-progress --native-only --opt-level=3 \
  --run=none --output=build/perf-sound-time.o etc/labs/sound.ny

The same command was run against each compiler twice, in baseline/candidate then candidate/baseline order. nice -n 19 was applied to all runs. The host was shared with the NYC Linux build. The user later clarified that it was run with -j32, not -j16 as initially recorded; the observed load averages were 16–20. The OS page cache was not cleared. These timings were taken under substantial contention; retain them only as a rejected exploratory run, not evidence of a real speedup or regression:

OrderBaseline elapsedCandidate elapsed
First pair7.990 s ± 0.22%8.168 s ± 0.43%
Reverse pair8.067 s ± 0.18%8.104 s ± 0.15%
Mean of pair means8.028 s8.136 s

Candidate task-clock and instruction counts were also slightly higher. Its single CPU-clock profile sampled nyr_cfg_build_impl at 2.91% of 516 samples, but that small sample-count shift did not correspond to an end-to-end gain. The candidate was reverted; no speedup is claimed. The baseline compiler passed cfg_simplify, the candidate passed cfg_simplify and all 166 x86-64 target tests, and both compilers emitted the identical object above. This experiment did not change the open compile-time acceptance items.

Native JIT relocation lookup

The loader repeatedly searched for the same definition while deciding data routing, symbol resolution, and external call stubs. Reusing one exact-name lookup preserved alias and relocation rules; AArch64 also reused its stub selection lookup.

An alternating warm-process comparison discarded two warm-up pairs and kept ten samples per arm. Baseline median was 207.69 ms (200.95–209.61 ms); candidate median was 149.78 ms (145.07–155.94 ms), 27.9% lower. Every run returned checksum 1968365. Another editor compile overlapped the comparison, so this is a local startup observation, not an arithmetic-speedup claim. Four focused module/cache/closure fixtures passed; AArch64 execution was not available on the x86-64 host.

i386 object writer compact encoding (kept 2026-11-15)

The i386 ELF object writer was emitting the longest form of every stack-relative instruction: NY_I386_EBP_OP always produced mod=10 disp32 (%ebp) memops, and the frame reservation/adjustment always used the 0x81 imm32 group (seven bytes per access where three would do).

Changes in src/code/backend/mach/arch/x86/object.c:

NY_I386_EBP_OP now takes the ModRM register field and selects mod=01 disp8 for offsets in [-128,127], falling back to mod=10 disp32. Offset 0 still takes the disp8 form because mod=00 with base=EBP encodes disp32-without-base. ny_i386_obj_mov_imm32 (c7 /0, the home store used by NYIR_CONST_I64) uses c7 45 disp8 imm32 for narrow offsets. ny_i386_obj_add_esp_imm and the prologue use 0x83 /0 and 0x83 /5 imm8 forms for stack adjustments up to 127 bytes. NYTRIX_NO_I386_DISP8=1 forces the old all-disp32 memops so both encodings can be measured from one binary.

Measured with --native-backend x86 --native-only -O3 --nyr-verify -emit-only -o out.o, taking .text bytes through objcopy -O binary --only-section=.text:

buildknight .textrecursive fib(12) .text
all-disp32 baseline (NYTRIX_NO_I386_DISP8=1)8,3791,036
disp8 memops only8,015not measured
disp8 memops + imm8 frame forms7,909804

The knight object file shrank 14,304 -> 13,940 bytes. Its own 616-byte frame is out of imm8 reach, so its saving is the disp8 memops; the small recursive fixture's frame fits a signed byte and its post-call cleanups also collapse to add $imm8,%esp, giving the combined 22% reduction.

Verification: --pattern i386 13/13 and --pattern elf32 45/45. The ELF32 fixtures link the emitted object with clang and execute it under qemu, so these encodings are checked by running rather than only by assembling. The x86-64 object writer and its same-color copy elision are untouched.

Multi-segment home sharing in the x64 home layout (attempted, reverted 2026-11-15)

mach_vreg_home_colorable in mach/arch/x86/object/regalloc.h only let single-block intervals share a vreg home. Generalizing it to the union of all of a value's resident segments (min start / max end, still rejecting call-bearing blocks, reload/spill/carried segments, frame-loaded incoming args and float CMP results) is a safe extension, since a home is only touched while its value is live, but it bought nothing measurable on the hot fixture: knight .text stayed at 5,016 bytes with checksum 340233, while stack-relative ops went 199 -> 206 (all still disp8). --pattern regalloc 11/11 and --pattern codegen 15/15 passed, but with no size or frame change it fails the rule of keeping only measured wins, so the edit was reverted.

The reason is structural: values that stay resident across blocks are already colored into registers, so the homes that could gain from sharing are spilled ones, which the eligibility filter rejects. The remaining frame bytes are cold spill slots, not shareable resident homes. Shrinking them needs spill-slot reuse (interval-based slot coloring over spill segments), not home sharing.

Spill-slot coloring in the x64 home layout (kept 2026-11-15)

mach_build_vreg_homes gave every value that was not a single-block resident its own home slot. Those are the spilled values, and they dominate the frame: knight reserved 616 bytes of homes for 104 vregs while only 27 values shared a slot.

mach_vreg_home_spill_interval now colors spilled values by the union of all their live segments (min start / max end), restricted to GPR-class values with an 8-byte home that actually touch their home (spill, reload, or spilled color). Incoming-argument homes and floating-predicate GPR results keep unshared slots, exactly as in the resident path. Disjoint live ranges reuse one slot; overlapping ones keep separate slots. A call cannot alias because any value live across it has segments on both sides, so its union range covers the call instruction and overlaps anything live there.

NYTRIX_NO_SPILL_HOME_COLOR=1 restores one slot per value so both layouts can be measured from one binary.

fixture.text before -> afterframe bytes before -> after
knight5,016 -> 4,688 (-6.5%)616 -> 488
compose-local7,040 -> 6,800 (-3.4%)632 -> 488
combs-test3,152 -> 3,15288 -> 72
eq-test3,928 -> 3,912136 -> 136
unicode-identifiers2,632 -> 2,6241,552 -> 1,552

knight gained 12 instructions (983 -> 995) while losing 328 bytes: the smaller frame pulls more accesses into disp8 reach, and reused slots trade distinct offsets for shorter encodings.

Correctness: knight checksum 340233 is unchanged; --pattern x86 223/223, --pattern regalloc 11/11, --pattern codegen 15/15, --pattern copy 8/8. A full --bench-correctness sweep reports 2,357/2,366. The 9 failures are code/probes/tools/doc-rank, doc-meta, lang/memory/sanitizer-thread-race, code/intermediate/ny/bare/asm-artifacts, code/probes/cli/terminal, code/intermediate/ny/vm-disasm-artifact-diff, lang/comptime/comptime-contracts and both lang/errors/parser/invalid-byte-stops fixtures; each one fails identically under NYTRIX_NO_SPILL_HOME_COLOR=1 NYTRIX_NO_SAME_COLOR_COPY=1, so they predate both encoder changes. startup/currying.nshape remains the known failing row from the earlier sweep.

The earlier attempt that only widened mach_vreg_home_colorable to multi-segment resident values produced nothing because it still excluded every spilled value. The frame was never resident-bound; it was spill-bound.

x64 frame ModRM narrowing covers the hand-rolled paths (kept 2026-11-15)

Frame accesses no longer hand-roll their ModRM byte. Eleven 0x85 disp32 sites now call the range-checked mach_rbp_disp: the aggregate-parameter home lea, the SSE scalar op with a memory operand, the v256 ymm load/store, packed add/sub/and/or/xor on ymm, x87 fld/fstp for sin/cos, imul and the ALU fallback with a memory operand, cmov and cmp with a memory source, and cmpq $0, mem; jne. The last one also keeps its immediate in the 83 /7 ib form, so a nearby home costs 48 83 7d d8 00 instead of 48 83 bd <disp32> 00. The struct-argument staging lea uses mach_rsp_disp, which now takes a reg field and narrows lea disp8(%rsp), %rdi to 48 8d 7c 24 <disp8>.

NYTRIX_NO_FRAME_DISP8=1 makes both helpers emit disp32, so the frame encoding is A/B-able from a single binary. On knight:

encoding.text
disp32-only (NYTRIX_NO_FRAME_DISP8=1)5,112
default4,688

The 424-byte difference is the cumulative value of frame narrowing (8.3% of .text), not this round's share: .text is byte-identical to the pre-change encoder on knight (4,688), compose-local (6,800), combs-test (3,152) and a small float kernel (688), so the converted sites are cold in those programs.

What remains is not an encoding gap. knight still pays disp32 on 303 frame accesses, and the spill-colored frame is 488 bytes, so those accesses address homes below -128 bytes where disp32 is the only legal form. Converting any of them requires slot ordering, not another encoder helper: rank homes by access count and pack the hot ones into the low 128 bytes.

Correctness: --pattern x86 223/223, --pattern regalloc 11/11, --pattern copy 8/8. --pattern codegen is 14/15: code/derive/dispatch/codegen-match fails deterministically, and it still fails with NYTRIX_NO_FRAME_DISP8=1, NYTRIX_NO_SPILL_HOME_COLOR=1, NYTRIX_NO_SAME_COLOR_COPY=1, NYTRIX_NO_SELECT_CHAIN_FOLD=1, NYTRIX_NO_FLOAT_GUARD_FOLD=1 and NYTRIX_PEEPHOLE_SKIP_SERIAL_INTEGER=1, individually and together, so this encoder round is not its cause. Its .nshape source has no main (the harness wraps it), so it cannot be run standalone to bisect further; the fixture needs its own investigation.

Hot-slot ordering for x64 frame homes (kept 2026-11-15)

disp8 frame addressing only reaches the 128 bytes below %rbp, so which value owns which slot decides three bytes per access. The coloring pass allocates in live-range order, which says nothing about how often a slot is touched, so the homes that fit in disp8 reach were arbitrary.

mach_order_hot_homes counts MACH operand references per vreg, but only for vregs that actually reach a home: a fully resident value appears in many operands and still has no home traffic, so counting it would let it push a hot spilled value out of reach. Vregs that share a slot are grouped into one slot weight, and the offsets of equal-width slots are permuted so the most-used homes sit closest to %rbp. Only offsets move — every slot keeps its byte range, its width, and the disjointness the coloring pass proved; width-16/32 vector homes keep their offsets; the frame stays the same size.

fixtureallocation orderhot ordering
knight4,6884,560 (-128, -2.7%)
compose-local6,8006,712 (-88, -1.3%)
combs-test3,1523,152
eq-test3,9123,912
unicode-identifiers2,6242,624
unicode-debug73,2803,280

The first attempt weighted every operand reference regardless of home use and cost unicode-identifiers 8 bytes: resident values outranked spilled ones and displaced hot homes. Restricting the weight to home-using vregs removed that and improved knight from -88 to -128.

knight's checksum is unchanged (340233). Correctness: --pattern x86 223/223, regalloc 11/11, copy 8/8, codegen 14/15 (codegen-match, which fails identically with every encoder hatch disabled and predates this work). The full --bench-correctness sweep reports 2,286/2,366 both with hot ordering and with NYTRIX_NO_HOT_HOMES=1. The 80 failures are concentrated in 10-25 s UI/font/audio fixtures and were produced while other agents held the machine at load 12-26, so they are timeouts rather than encoding differences; the earlier quiet-machine sweep was 2,357/2,366.

The remaining ceiling is the low 128 bytes themselves: they also hold the callee-save slots and the source frame slots, so only a handful of 8-byte homes land in disp8 reach. Ordering frame slots by access frequency is the next lever, not more encoder work.

Short backward branches (kept 2026-11-15)

Every branch was emitted as rel32 (e9 or 0f 8x plus four displacement bytes) and patched after the trampoline fold, even for loop latches whose target was already laid out. A backward edge knows its displacement when it is emitted because block_off[target] is recorded at that block's start, so mach_emit_branch_to now emits eb/7x with a single displacement byte when the distance fits a signed byte.

Short branches still record a patch, flagged in patch_short, so the trampoline fold's byte compaction moves their patch site with the rest of the code. That fold only ever drops bytes, and dropping bytes between a backward target and its latch can only shrink the displacement, so a rel8 edge cannot fall out of range afterwards. Forward edges keep the rel32 placeholder. NYTRIX_NO_SHORT_BRANCHES=1 restores rel32 everywhere for A/B runs.

fixturerel32 onlyshort backward
knight4,5924,584 (-8)
compose-local6,7126,680 (-32)
combs-test, eq-test, unicode-identifiers, unicode-debug7-unchanged

Only one of knight's 67 branches fits: its loop bodies are larger than the 128-byte rel8 reach. compose-local converts ten. Reaching the rest needs a real fixpoint relaxation that also re-derives block alignment, which is a separate change rather than another local widening.

knight's checksum is unchanged (340233). --pattern x86 223/223, regalloc 11/11, copy 8/8. The full --bench-correctness sweep reports 2,290/2,370, and the failing fixtures are exactly those that fail with NYTRIX_NO_HOT_HOMES=1 in the same binary (80, all heavy UI/font/audio fixtures timing out under the load other agents put on the machine). The two fixtures' baselines moved by 8-16 bytes between builds because of concurrent edits outside this work, so every number above is an A/B inside one binary.

Symbol addresses materialized in the destination color (kept 2026-11-15)

Auditing knight's 4,584-byte .text by instruction class showed the largest single redundancy was not arithmetic: 169 of its 175 LEAs were leaq sym(%rip),%rax, roughly one per address-of-global use, and 87 of those were immediately followed by mov %rax,%rdi/%rsi/%r12. The pair costs ten bytes where leaq sym(%rip),%rdi costs seven.

The move is not a machine COPY. mach_vreg_def_preg already gave the LEA a destination color, and mach_commit_vreg stages the RAX result into that color with exactly that three-byte move. The indexed-LEA paths in the same case write their result straight into the assigned register, so the symbol path now does the same: emit lea with the color in ModRM and commit through mach_commit_preg like its neighbours, falling back to the RAX form when the destination has no usable color (unassigned, %rsp, %rbp).

fixtureRAX stagingin-colordelta
knight4,5844,320-264 (-5.8%)
compose-local6,6806,424-256 (-3.8%)
unicode-identifiers2,6402,384-256 (-9.7%)
combs-test3,1602,888-272 (-8.6%)
eq-test3,9283,656-272 (-6.9%)
unicode-debug73,2963,032-264 (-8.0%)

NYTRIX_NO_LEA_COLOR=1 restores RAX staging and reproduces the old sizes exactly, so each row is an A/B inside one binary. The saving is not simply three bytes per folded site: surviving copies include two-byte 32-bit moves, and removing the staging move also shifts later block layout. In the disassembly the lea ...; mov %r.. pairs fall from 87 to 22 in knight and from 93 to 35 in compose-local.

Four other levers were measured and rejected before this one, so they are not worth re-trying blindly:

Loop-alignment padding: every NOP run is 7 bytes or shorter (knight 24 bytes total, compose-local 126), so a GCC-style max-skip policy saves nothing. Branch relaxation: only 1 of knight's 67 branches fits rel8 even with both directions known, so a layout fixpoint would buy about 5 bytes. Address CSE: all 169 symbol targets are distinct, one per use; there is no duplicate materialization to remove. Frame-slot ordering: knight has no frame slots and compose-local none in reach, all offsets are vreg homes, and hot ordering already fills the disp8 window with the busiest of them.

knight's checksum is unchanged (340233). --pattern x86 223/223, regalloc 11/11, copy 8/8, codegen 14/15 (codegen-match, pre-existing and identical with every encoder hatch disabled). The full --bench-correctness sweep reports 2,290/2,370 with exactly the baseline binary's 80 failing fixtures, none new and none fixed, under the same host load other agents were generating.

What remains is the 22 (knight) and 35 (compose-local) surviving LEA+move pairs: there the LEA's own color is RAX and the move is a genuine MACH COPY of a single-use address. Folding those requires proving the single use and skipping a copy instruction — a separate change with its own residency proof, not another widening of this one.

E-graph saturator: hash-consing, batched rebuild, guarded arithmetic (kept 2026-11-15)

passes/scalar/egraph.c already saturated pure i64 straight-line blocks, but the implementation was the slow shape: interning a node scanned every node, and congruence closure compared every pair of nodes on every iteration. Both are quadratic in the block, so a large pure block was the most expensive thing the mid-pipeline could do, and the rule set could only express unconditionally sound equalities.

Three changes, all inside that pass:

Hash-consed interning. Nodes live in an open-addressing table keyed by (op, imm, child classes), rebuilt whenever unions move canonical children. eg_intern is now a probe instead of a scan. Batched congruence closure. eg_rebuild re-canonicalizes every root's child pointers and merges roots that became identical, once per saturation iteration, replacing the pairwise compare. Union-find now merges by rank, so the repeated canonicalization does not walk long parent chains. A merge late in a round can leave a table entry stale; that can only delay a merge to the next round, never invent one, because entries are only ever compared for full structural equality. Analysis-guarded rewriting. eg_nonneg_roots computes class non-negativity as a fixpoint: a class is non-negative when one of its members provably is (the e-graph only equates values that really are equal), with and inheriting non-negativity from either operand and COPY forwarding it. That fact justifies rewrites that are not equalities in general: NYIR division truncates toward zero while SAR rounds toward -infinity, so x / 2^k == x >> k and x % 2^k == x & (2^k-1) hold exactly when x >= 0. Because the divisor is a nonzero constant, neither form traps where the other did. Bitwise idempotence (x&x, x|x) was added as unconditional rules.

DIV/MOD are not e-nodes at all — they may fault, so eg_inst_pure_scalar rejects them — and the first version of the guarded rule therefore never fired. The regression driver caught it (non-negative div was not refined to a shift); the rewrite is now planned per instruction against the dividend's e-class fact, and emission is keyed by destination value so a planned DIV/MOD replacement reaches the rewritten instruction stream.

checkresult
ny --backend-test=passes/scalar/egraphpass (incl. new guarded-div and idempotence cases)
randomized expression equivalence256 seeds, depth 24, unchanged
knight, compose-local, unicode-identifiers, combs-test, eq-test .textbyte-identical with the pass on, guarded rules off, and pass off
compile time, 120-op straight-line function543/549/550 ms vs 548/544/554 ms with the guarded rules off

The zero byte delta is a scheduling fact, not an analysis failure: the pipeline runs this saturator only for functions without loops, and on those the earlier const_fold/cse/peephole/strength_reduce passes already canonicalize the arithmetic — a straight-line band(x,255) / 8 fixture reaches the backend with no idiv at all. So this change buys compile time on pure blocks and correctness of the new rules, not code size on the current fixtures.

Limitations, stated plainly: there is no directional <= relation with per-argument variance, so a refinement that is legal without an explicit fact still cannot be used; non-negativity is the only class fact (no known-bits, ranges, alignment, or provenance); extraction still uses a static per-op cost plus loop-depth/trip-hint scaling rather than measured register pressure; and the new rules are argumented by hand rather than discharged by an SMT bitvector proof. Each of those is a separate, independently testable step.

Explainable x64 missed-optimization audit (kept 2026-11-15)

The x64 encoder now reports what it did and what it left on the table, in the terms it actually controls. NYTRIX_AUDIT=1 prints one stable line per encoded function:

[audit] fn=main lea_copy=0 self_move=0 spill_pair=0 fallthrough_elided=9 \
        lea_color=87 lea_staged=0

lea_color / lea_staged — symbol addresses materialized directly in the destination's assigned color versus staged through %rax and then moved. This is an encoder decision counter, incremented on the path taken, so a size delta is attributed to the transformation instead of inferred from assembly. lea_copy — symbol LEAs whose result has exactly one use, the adjacent COPY, which could be folded into that copy's register (mach_build_vreg_use_counts builds the per-vreg reference counts this needs). self_move — COPY whose source and destination already share a physical color. spill_pair — adjacent store/load through the same frame slot. fallthrough_elided — unconditional edges to the following block that emit no jmp. Nonzero here is the optimization working, not a miss: it is counted so a regression to an emitted branch would show up as a different number.

End-to-end demonstration. NYTRIX_NO_LEA_COLOR=1 restores the old RAX staging path, which makes the detector's own counters reproduce the defect it was written to find:

fixtureencodinglea_colorlea_staged.text
knightin-color (kept)8704,320
knightNYTRIX_NO_LEA_COLOR=10874,584
compose-localin-color (kept)9336,424
compose-localNYTRIX_NO_LEA_COLOR=10966,680

The 87 staged materializations in knight cost 264 bytes (3.03 bytes each: the three-byte mov that disappears, plus layout movement); compose-local spends 256 bytes on 93 convertible sites and keeps 3 in the RAX form because the destination has no usable color (unassigned, %rsp, %rbp). knight's checksum is 340233 in both encodings, so the correction is verified by behaviour, not by the counters agreeing with themselves.

self_move=0 and spill_pair=0 on both fixtures are the expected end state of the same-color copy fold and the frame-slot work recorded above. lea_copy=0 means the single-use-address-plus-COPY pattern does not occur: the remaining LEA+move pairs are commit staging, not machine copies.

A rejected experiment, recorded. A fold that would have emitted such a single-use symbol LEA directly into the following COPY's register was implemented with a NYTRIX_NO_LEA_COPY_FOLD hatch and measured at lea_copy=0 on both fixtures: zero candidates, zero bytes. By the keep-only-measured-wins rule it was reverted; the audit counter that would justify it is retained, so the evidence for re-adding it later is one NYTRIX_AUDIT=1 run away.

A wiring bug the work exposed. The audit was first called inside if (!encoded), but the home-DSE analysis encodes most functions itself, so the call never ran and every counter read zero. It is now called after either encode path. That is worth remembering for any future instrumentation in this encoder: there are two encode entry points, not one.

Cost: the audit is off unless NYTRIX_AUDIT is set, the environment is read once per function, and the walk is a single pass over the machine form the encoder has already visited. No persistent cache, no extra IR, no second code path.

Limitations: there is no Linux perf/hardware-counter correlation, no automatic ranking or auto-apply loop, and no MIR-to-source-line attribution in the report (the encoder already carries inst_offsets and debug lines, so that is the natural next step). Counters go to stderr as a stable machine-readable line rather than into the JSON report. Performance attribution in this session is code size plus reference checksums under controlled A/B hatches; the host was loaded throughout, so no timing claim is made.

Register-allocation shape audit (2026-11-15)

NYTRIX_AUDIT=1 now runs inside mach_encode_function, after the GPR, FPR and vector allocators have been summarized and before they are freed, and appends the allocator's own totals to each [audit] line: ra_segments, ra_spilled, ra_reload, and ra_colors (distinct physical colors actually used). Earlier attempts hooked the outer encode callers, where the allocators have already been freed; those rows printed zero for every field. A zero row now means an empty allocator, not a stale hook.

fixture.textsegmentsspilledreloadcolors
knight4,3202,2021,6081,60042
compose-local6,4242,6561,6861,69096
unicode-identifiers2,3843662216

Per function in knight: ny_fn_moves has 870 segments, 769 spilled and 12 colors; main has 231 segments, 35 spilled and 9 colors. The large spilled share in the dispatcher is the same mechanism the spill-slot coloring and frame-disp8 narrowing exploit, so a high ra_spilled value is not by itself a defect — it is the pressure the encoder then folds.

knight checksum 340233 and all three .text sizes are byte-identical to the pre-audit build, so this section records measurement plumbing only, not a code generation change. Each function prints twice per build (two deterministic encode passes); the duplicate lines carry identical counters, so sum per function name rather than per line.

Checks for this change: build clean, --pattern x86 223/223, regalloc 11/11, copy 8/8.

Probe encodes no longer count twice

The duplicated audit line per function was not a second compilation pass. Home dead-store analysis (mach_home_dse_analyze) runs a throwaway probe encode inside mach_encode_function, then the real encode applies the dead-home table. The probe printed its own audit line and, worse, added its segments to the process-wide mach regalloc segments/colored/spilled/reloads counters, so every report about allocation counted each function twice. The encoder now has suppress_stats, set for probe encodes and cleared when a probe is reused (NYTRIX_NO_HOME_DSE already disabled the probe). After the fix, knight prints two audit lines for its two functions and compose-local five for five.

The probe encode itself remains deliberate: without it there are no dead-home findings. knight with NYTRIX_NO_HOME_DSE=1 grows from 4,320 to 5,600 bytes, so the probe still pays for itself.

Spill composition: stored-and-reloaded versus dying

[audit] also splits ra_spilled into ra_spill_live (the segment is stored and later reloaded) and ra_spill_dying (the value dies in the segment, so no load is needed). A home-based count was rejected: vreg_home_offs is only populated on the home-DSE path, so counting "spills without a home" reported every spill as home-less.

fixture.textfunctionssegmentsspilledreloadcolorslivedying
knight4,32021,1018048002174856
compose-local6,42451,3288438454880439
unicode-identifiers2,384118311810
combs-test2,8882236761352
eq-test3,6564324223420
unicode-debug73,032125100900

So roughly 93% of spilled segments in the large fixtures are real store-and-reload work, not live-through bookkeeping: knight is 748 live to 56 dying. The high spill share is genuine pressure in the dispatchers, which is why the encoder-side folds (spill-slot coloring, frame disp8 narrowing, same-color copy folding) produced the size wins rather than allocation itself.

Rejected: call-crossing-weighted spill cost

Spill cost was extended with the number of call and fixed-clobber sites inside candidate segments (uses x (1 + crossings), saturating), with NYTRIX_NO_RA_CALL_COST=1 as the A/B hatch. Measured on knight, compose-local, unicode-identifiers, combs-test, eq-test and unicode-debug7: byte-identical .text in every fixture, both settings. The existing use_count term is already the number of reloads a spill would cause, so the crossing weight never displaced a victim. Reverted: regalloc.c is back to byte-identical with its previous state (git diff --stat empty), and the crossing weight's binary search came off the eviction hot path.

Final checks after the revert: build clean, --pattern x86 223/223, regalloc 11/11, copy 8/8, --pattern codegen 14/15 (the pre-existing code/derive/dispatch/codegen-match failure, unchanged), knight checksum 340233, all six .text sizes unchanged.

SCEV: exact trip counts for != loops (2026-11-15)

Nikita Popov's "LLVM: Scalar evolution" describes the addrec + exit-count model: an induction variable is {start,+,step} over a loop, the backedge-taken count is what an exit condition bounds, and the trip count is that count plus one. Nytrix's nyr_scev_analyze already derived counts for <, <=, > and >= with constant start, limit and step, but rejected != outright. C loops written for (i = 0; i != n; ++i) or while (i != n) therefore got no trip count, nyr_scev_lite exported no range fact for their induction variable, and bounds-check elimination had to keep runtime guards it could otherwise drop.

compute_trip now counts a NYIR_CMP_NE loop only when the recurrence lands exactly on the limit: limit - start must be a whole multiple of |step|, the step must travel toward the limit, and the resulting exit value (start + n*step) must equal the limit and stay representable in i64. A loop that misses the limit continues until the i64 recurrence wraps, so it must stay unknown; the divisibility test, the direction test, and the landing check are each necessary. Downward loops use the same rule with a negative step, which keeps the article's point that count-down loops should not be second-class.

passes/loops/scev_ne_trip_count covers three exact cases (unit step, divisible +2, downward -2) and four that must remain unknown (non-divisible in both directions, a step travelling away from the limit, and an entry value that already satisfies the exit test). For each exact case it checks the derived count, the exit value returned by the reference interpreter, and the exported induction-variable range [min(start, limit), max(start, limit)]; for each unknown case it checks that scev_lite exports no range fact, so a dropped guard cannot follow from a guessed count.

Measured effect on the existing fixtures: .text is unchanged at 4,320 (knight), 6,424 (compose-local), 2,384 (unicode-identifiers) and 2,888 (combs-test), with knight checksum 340233, so this is a capability extension on loop shapes those fixtures do not contain rather than a size win. The existing passes/loops/scev_tbuf_length_range case still passes, and --pattern x86 remains 223/223.

Article items that remain unimplemented, and why: symbolic exit counts (the article's symbolic max exit count) cannot be represented because nyr_range_t holds constants only, so i != n for a parameter n still yields no count; there is no known-multiple tracking, no nowrap/poison distinction (NYIR has no poison values), and no SCEV expander, so "SCEV at scope" is only used as the exhaustion-value singleton that already existed for single-exit loops. The constant-range half of the symbolic limit case is addressed in the next section.

SCEV: range-derived bounds for symbolic loops (2026-11-15)

Popov's article treats an induction variable as {start,+,step} and its exit count as a first-class expression. Nytrix has no symbolic bound type: nyr_range_t is a constant interval that the binary IR format serializes, so i < n with a parameter n produced no count and no range fact. This change gets the useful half without inventing a type. When the limit is loop invariant (defined outside the loop, dominating the header) and the start and limit both have proven ranges, a constant interval for the induction variable and an upper bound on iterations follow from those ranges.

compute_range_bounds exports three facts on nyr_scev_loop_t: body_min / body_max for values that pass the exit test, iv_min / iv_max for every observation including the final failing test (the exit block observes that value, so the phi's range fact must cover it), and trip_bound for consumers that only need a ceiling. compute_trip remains the exact-count path, so no consumer that requires an exact count receives an inexact one.

Soundness conditions, each enforced: the start and limit definitions must lie outside the natural loop and dominate the header (a per-iteration limit has no static bound); the predicate must match the step direction (< / <= ascending, > / >= descending), because the opposite combination never exits on the tested edge; and body_max + step (or body_min + step) must stay representable in i64, because wrapping would let the loop revisit values outside any claimed interval. All arithmetic is 128-bit and checked. NYTRIX_NO_SCEV_RANGE_BOUNDS=1 disables the derivation.

A bug was found in the first attempt: bounds were computed on the pass-0 analysis record, which SCEV discards, because only pass 1 appends the loop record. The call moved to pass 1, which is why the first run reported no bounds at all. The negative assertions in the suite are what made that visible; a test that only checked accepted loops would have passed while computing into a dead record.

passes/loops/scev_range_bounds asserts the body and whole-value intervals, the trip ceiling, the in-body nyr_scev_affine_at query (the path bounds-check elimination uses) and the phi range fact for three loops (ascending <, ascending <= with step 2, descending >), and asserts that an unbounded limit and an INT64_MAX-reaching <= limit export nothing at all.

Measured: .text unchanged at 4,320 (knight), 6,424 (compose-local), 2,384 (unicode-identifiers), 2,888 (combs-test), 3,656 (eq-test) and 3,032 (unicode-debug7); knight checksum 340233; five verification suites green (invariants, rules, differential, passes, mach_invariants); --pattern x86 223/223. passes/loops/irce has no driver on disk, so the runner's status 2 for that name means "unknown test", not a failure; IRCE coverage comes from the loop drivers that exist.

Still missing: exact symbolic exit counts (an expression such as n - a, not an interval), known-multiple tracking, and SCEV expansion.

SCEV: loop-guard bounds-check elimination (2026-11-15)

The article's "loop guard" idea: an exit test can prove a check without any range fact about the bound. for (i = start; i < n; ++i) check(buf, i * S, n * S) only reaches the check while i < n, so S*i + d < S*n for d <= 0 (and for d <= -1 under <=, where the body may run at i == n). Nytrix's check-safety query required a constant interval for the offset and a constant minimum length, so a buffer whose length is the loop's own runtime limit produced no proof even though the guard makes the check redundant.

scev_guard_proves_offset adds the symbolic proof. It needs the offset to be S*iv + d with S > 0 and d <= 0, the length to be the loop's own comparison value scaled by the same S, the check to be dominated by the body entry, an ascending loop, and S*start + d >= 0 so the removed check could not have trapped on a negative offset. Scaling is recognized in both x * c and x << s form, so byte-scaled checks against a byte-scaled length work. To see unbounded induction variables as affine terms, scev_affine_build now emits a term for a known loop IV even when its constant interval is unavailable; those term-only forms still fail in scev_affine_bound, so every existing range consumer keeps its previous result.

A test expectation was wrong on the first run, and the failure is the feature working: i <= n with i - 1 at i = 0 can be -1, so eliminating the check would hide a trap. The suite now keeps that case as a must-not-eliminate expectation (with start = 4 as the eliminable counterpart), which is exactly the non-negativity condition the proof needs.

passes/loops/scev_guard_bounds drives the real consumer (nyr_bounds_check_elim) and asserts 4 eliminations (< element, i-1 offset, <= with i-1, byte-scaled) and 6 kept checks (<= at i, i+1, a different length value, negative lowest value at zero start, negative start, descending loop). passes/loops/bounds_check_elim, loop_memset, loop_interchange, loop_unroll, iv_period2, licm_guarded_division and the other SCEV drivers stay green. Measured: fixture .text unchanged at 4,320 / 6,424 / 2,384 / 2,888 / 3,656 / 3,032, knight checksum 340233, five verification suites green, --pattern x86 223/223 in 24.7 s.

What this does not do: it does not convert the guard into a reusable predicate outside the loop, and the relations come from dominating branches rather than assumptions, SMT, or a symbolic expression layer. Chained guards are covered in the next section.

SCBE review and chained guard proofs (2026-11-15)

Reviewed https://github.com/maxnut/scbe before porting anything. SCBE is 32,218 lines of C++ with an x86-64 back end (ELF, COFF, text assembly) and AArch64 assembly emission; its README calls it a learning project that is unfinished and not production quality. Each subsystem was compared with the Nytrix equivalent:

SCBENytrix
codegen/spiller.cpp: replaces one operand per instruction with a reserved registerlower/regalloc.c spills live segments with homes, rematerializes constants, and recolors local evictions afterwards
graph_color_regalloc.cpp: Chaitin simplify/select/spill over a color graph, no coalescingprofile heat, loop depth, next-use and use-count eviction, tied-input affinity, dead-input coalescing, callee-save preference
IR/fix_phis.cpp: drop phi operands for non-predecessorsnyr_prune_phis in core/ssa.c, run by DCE
IR/split_critical_edge.cpp: splits edges only when the target has phisphi lowering goes through edge copies and memory (phi_elim.c, machine.c), so no split pass is needed
ISel/pattern.hpp: pattern table with cost, covered operands, minimum opt levelisle.c and machine.c already fuse addressing modes and immediates; porting the table is a rewrite with no measured target
mem2reg, dominator tree, DCE, constant folder, inlining, loop/call heuristicsall present

Verdict: no subsystem worth porting. Feature parity or Nytrix ahead on every row, and SCBE's own TODOs name work Nytrix already does. The one idea worth taking was the predicated guard reasoning the LLVM SCEV article also describes, which filled a gap Nytrix had.

Chained guards

The loop-guard proof previously required the check's length to be the loop's own comparison value. It now accepts a chain: when a dominating branch proves limit <= length on every path to the check, i < limit <= length makes the check redundant. scev_collect_le_facts collects lo <= hi from each branch that dominates the query point, using the branch direction only when exactly one successor dominates the query (a merge leaves both edges possible and the branch is skipped), maps LT/LE/GT/GE and their negations to an ordering regardless of operand order, and closes the facts transitively. Scaling is matched as before, so a byte-scaled check against a byte-scaled length works.

passes/loops/scev_guard_chain asserts 3 eliminations (n <= cap, strict n < cap, and a two-step n <= m, m <= cap chain) and 3 kept checks (reversed cap <= n, no guard, and a guard in a sibling arm that does not dominate the loop). The first run failed four cases because the test builder's phi referenced a preheader label the CFG did not contain, so verification rejected the function before the pass ran; rebuilding the CFG with a real preheader made the proof fire. That is a test construction defect, not a pass defect, and it is why the suite verifies before running the pass.

Measured: .text unchanged at 4,320 / 6,424 / 2,384 / 2,888 / 3,656 / 3,032, knight checksum 340233, twelve loop drivers green, five verification suites green, --pattern x86 223/223 in 24.0 s.

Limits, stated so they are not mistaken for coverage: relations come only from dominating BR_IF integer compares; there is no assume-like fact, no equality propagation through arithmetic beyond copy roots, and no symbolic expression layer. A check guarded by a call result, a select, or a comparison that is reloaded per iteration still needs a runtime check.

Benchmark corpus expansion (2026-11-15)

Added nineteen fixtures to etc/tests/bench for workload families the corpus did not cover. Each fixture is an original Ny program paired with an equivalent C program in the same .nshape, written to exercise one kernel shape; no third-party benchmark source, binary, or input set is copied or redistributed here. Families that already had a counterpart in this corpus (mandelbrot, fannkuch, n-body, spectral, knucleotide, revcomp, fasta, pidigits, binary-trees, sieve, splay, havlak, json, list) were deliberately not duplicated.

The fixtures are filed by general workload category, not by the suite that suggested them:

FixtureCategoryKernel and questionChecksum (Ny = C)
algorithms/mcfalgorithmsSparse network-flow style transshipment over a fixed arc list294232244
algorithms/ssspalgorithmsBellman-Ford single-source shortest path on a 1024-vertex graph41194
algorithms/permutealgorithmsPermutation generation734832000
algorithms/deltabluealgorithmsConstraint propagation to a fixpoint2718751
algorithms/statematealgorithmsSix-state car-window chart, if-chain dispatch235582476
concurrency/richardsconcurrencyScheduler/task-queue benchmark5433768
numeric/lbmnumericInteger D2Q9-style stencil relaxation, two output buffers152700
numeric/matmult-intnumericInteger 32x32 matmul, 40 accumulated passes756776586
numeric/mont64numeric64-bit Montgomery multiply, 16-bit limbs114319663
string/xzstringLZ77-style match search with a bounded hash chain65536
graphics/imagickgraphicsTwo-pass 5-point sharpen with saturation2069072
graphics/povraygraphicsQ10 fixed-point sphere ray march, 256x192393846
memory/streammemoryInteger triad-like streaming over four buffers471845615
memory/transposememoryBlocked 256x256 transpose, 16x16 tiles, eight repeats32734680
crypto/crc32cryptoTable-driven reflected CRC-32 over 4 MiB1584041980
crypto/qrsyndromecryptoGF(256) Reed-Solomon syndrome evaluation1161080
simulation/omnetppsimulationEvent-queue simulation with timestamp ordering703468200
simulation/leelasimulationMonte Carlo rollouts of a take-away game533733992
simulation/cdsimulationCollision detection over a fixed particle set387

All nineteen are integer-only. Floating point was avoided on purpose: the checksum is the parity evidence, and integer kernels let Ny and C prove exact agreement instead of agreement to a printed precision. Existing fixtures pick up the benchmarks-game families this table omits.

Parity check

Each fixture was checked by extracting its source ny and source c blocks, running the Ny side with ny-full --native-only -O3 -run, building the C side with cc -O2, and comparing the checksum= line. Result: 19 of 19 match. The same files are discovered by the normal harness, for example:

build/release/ny-test --bin build/release/ny-full --bench --pattern 'graphics/povray' \
  --bench-run 1 --bench-warmup 0 --jobs 1 --bench-no-compare-llvm

The corpus is 96 fixtures after the addition. This section records agreement on one input per fixture, not general correctness, and no timing claim: the host was shared and loaded, and the C programs are built at -O2 while the Ny route runs -O3.

Ny behaviours the parity work exposed

The fixtures were written against the current language, so four mismatches were bugs in the new Ny sources rather than in the compiler. They are useful to record because each fails silently:

i64buf_new does not zero its memory. C calloc does. Every new buffer is now explicitly initialized, or its unused border cells leak into the checksum. An expression continues across a newline only inside unclosed parentheses. A two-line sharpen expression without outer parentheses parsed as two statements, and the trailing subtractions were discarded; the checksum difference (3579272 versus 2069072) was the only signal. Stencil codes that ping-pong two buffers must initialize both, because the second pass reads the border cells the first pass never writes. Ny pointers are not indexable; buffer elements go through i64buf_load and i64buf_store.

NYR codegen: cast-call folding and copy propagation (2026-11-16)

Two native x86-64 codegen changes. Checksums agree on the 41 fixtures sampled across algorithms, numeric, string, crypto, concurrency and datastructures, and the --pattern copy / --pattern opt fixture sets report no new failures (the four opt failures — select-flag-preservation, loop-register-call-homes, kernel-list-alias-cow:entry_fill_preserves_observable_globals and nested-loop-specialize — reproduce on the unmodified tree).

lower/machine.c: a rt_f64_to_i64 call with one f64 argument and a raw i64 result now lowers to NYR_MACH_CONVERT, so the encoder emits cvttsd2si instead of a call plus the xmm0 stack round trip. page-rank's object shows two cvttsd2si and no rt_f64_to_i64 relocation. passes/scalar/copy_prop.c: copies established earlier in the same block are available to later uses (the walk is in program order), and copies of raw scalar values fold into call arguments, which carry no ownership metadata. hanoi drops from 36 to 29 NYIR instructions; the seven mov temporaries feeding its two recursive calls are gone.

Measured on this host with NYTRIX_NATIVE_CACHE=0 NYTRIX_AOT_CACHE=0 --bench-run 9 --bench-warmup 2; the "before" column is the same tree with copy_prop.c reverted and rebuilt:

fixturebeforeafterNYR/LLVM before → after
sssp6.01 ms4.91 ms2.80x → 2.30x (-18%)
ackermann108 µs107 µs0.97x → 1.02x

Unchanged within noise: towers 71.3 ms, page-rank 18 µs, radix-tree 77.5 ms, binary 827 µs, heapsort-int 58.2 ms, fhourstones 2.88 ms.

Root causes identified but not fixed here: radix-tree's 20-bit key walk lowers the data-dependent diamond (node = node*2 + bit) as a real branch, so mispredicts cost roughly 12 cycles/bit where LLVM emits branchless code (12.2x LLVM, 4.7x C after the change); sssp and page-rank still round-trip loop-carried scalars through frame homes at block boundaries.

Benchmark status fixes: dce SIGILL and time-profile noise (2026-11-16)

The two non-ok rows in the 110-fixture run were fixed without relaxing any checksum, dropping a fixture, or hiding a sample.

dce: SIGILL from a stray ModRM byte in the SELECT spill path

dce (500 sequential if x == i { x = x + 1 } else { x = x + 2 } in a loop) failed only above -O0 (-O1/-O2 SIGSEGV, -O3 SIGILL). A reduced reproduction showed the shape needs eight selects inside one loop: six work, eight crash, and the same 100 selects outside a loop work.

The fault was in the x86 encoder, not in DCE or phi lowering. When a SELECT's true arm is not resident in a register, object64.c emitted the cmov ModRM byte 85 by hand and then called mach_rbp_disp, which writes the ModRM byte and the displacement itself. The extra byte swallowed the following instruction into the disp32 field, producing cmovne -0x76b76fbb(%rbp),%rax in the emitted object and desynchronizing the instruction stream. The bad instruction is present in the AOT object, so the failure did not depend on the JIT.

Fix: let mach_rbp_disp own the ModRM; the true-arm home branch now emits REX.W, 0F 45, then ModRM+displacement.

Verification: dce prints checksum= 308813056, matching the C reference; the emitted object has no %rbp displacement larger than its frame; the bench row is dce ok 15 µs (LLVM 11 µs, C 3.29 ms, NYC 6.74 ms).

time-profile: NOISY because the fixture had no timed kernel

The fixture summed 0..100 and printed only a checksum, so the harness timed process start-up / -time JIT-run instead of a workload, and samples varied by more than the 30% noise limit.

The fixture now self-times an integer LCG kernel (n = 50000, identical in Ny and C) and prints elapsed_ns=, which the harness uses as the fixture timer. n is sized so the C reference stays below the 1 ms gate threshold (678 µs), keeping the startup class gate advisory while the self-timed region (~620 µs) dominates process jitter.

Verification (three consecutive runs): time-profile ok 613/613/621 µs, spread ~1%, NYR/LLVM 1.23–1.27x; the previously unavailable LLVM cell now has a value.

Full run after both fixes

110 fixtures: 0 NOISY rows, 0 FAIL rows, no unavailable (—) timing cells, no INVALIDATED verdict. Overall (C >= 1 ms): NYR/C 1.45x, LLVM/C 1.04x, NYR/LLVM 1.40x; the startup gate passes. The only remaining gate failure is the per-fixture radix-tree NYR/LLVM limit (11.69x), a branchless-codegen performance gap rather than a correctness or availability failure.

radix-tree: branchless 20-bit key walk (2026-11-16)

radix-tree spent 20 data-dependent branches per key because the walk

if ((keyval >> depth) & 1) != 0 { node = node 2 + 1 } else { node = node 2 }

never became a select. Lowering assigns a mutable local on both arms, so the diamond has stores but no join PHI, and if_convert only converted PHI diamonds.

Two changes:

if_convert.c: added an exact store-only form. It speculates the same whitelisted, non-trapping arm operations, then emits one select plus one store for the shared slot. It requires that the join has no PHI and still runs the existing local-load stability and address-escape checks. select_chain_fold.c: new R5 rule select(c, t + 1, t) -> t + c for a 0/1 condition, so the walk becomes (node << 1) + bit. The rule compares arms by structural equality (x*2, x + x, and x << 1 canonicalize to the same value, and shift amounts compare by constant value) because the two arms are separate, un-CSE'd instructions; an x & 1 condition counts as 0/1. pipeline.c runs the fold once more after the late if_convert, which otherwise created selects after the last fold had already run.

Measurements (standalone fixture, ny --native-only -O3):

metricbeforeafter
fixture elapsed76.1 ms18.7 ms
bench NYR77.7 ms21.7 ms
NYR/LLVM11.69x3.42x
cmov in rt_main20

The checksum is unchanged (62531, matching C). Full run: 111 ok rows, 0 NOISY, 0 FAIL rows; the datastructures gate passes (geomean 1.17x <= 1.94x, max per-fixture 1.11x). The overall gate is now limited by bitcount at 5.09x (solo runs 4.93-5.15x), a separate pre-existing gap; dce (15 µs) and time-profile (630 µs) stay green.

Two --pattern if fixtures (vm-disasm-artifact-diff, asm-artifacts) fail both before and after these changes; they are unrelated and untouched.

bitcount: SWAR population count fused to POPCNT (2026-11-16)

bitcount spent roughly 30 instructions per word on the 32-bit SWAR reduction while LLVM and C recognized the idiom and emitted one popcnt. That left the row at 5.0-5.2x LLVM, enough to fail the overall per-fixture gate.

The idiom is now recognized during NYIR-to-MIR lowering and fused into one NYR_MACH_POPCOUNT64, using the same skip-and-fuse mechanism as the signed power-of-two division matcher:

The matcher requires the exact SWAR sequence (masks 0x55555555, 0x33333333, 0x0f0f0f0f, multiply 0x01010101, trailing >> 24), a value already masked to 32 bits, and every removed intermediate consumed only inside the matched chain. With the 32-bit mask in place, a 64-bit POPCNT is exact. The x64 encoders emit F3 REX.W 0F B8 /r; the text emitter prints popcntq. POPCNT is SSE4.2 (2008), older than the tzcnt/BMI1 the text emitter already assumes. Other backends are untouched because they consume NYIR, not the MIR op.

Measurements (standalone fixture, ny --native-only -O3):

metricbeforeafter
fixture elapsed15.0 ms5.3 ms
bench NYR15.1 ms5.2-5.3 ms
NYR/LLVM4.93-5.15x1.77-1.79x
instructions per word~30, no popcntpopcnt + add

The checksum is unchanged (134217488, matching C). Full run: 110 ok rows and every class gate passes, with the overall gate now at NYR/LLVM 1.29x (max per-fixture 1.10x). --pattern if stays at 60/62; the same two fixtures fail with and without this change.

cd: empty-arm, multi-PHI if-conversion (2026-11-16)

cd (200 moving boxes, pairwise AABB overlap) was the last row near a gate limit: 17.4 ms against 3.51 ms for LLVM (4.84-4.95x, limit 5.00x). The hot pair loop carries two mispredicting branches per pair:

if ax < 0 { ax = -ax } if ay < 0 { ay = -ay }

Lowering emits each as a diamond whose false arm is an empty bridge block (br to the join only) and whose join merges two loop-carried PHIs (ax and ay are both live out of the join). if_convert refused both properties: ifc_parse_arm required at least one instruction, and ifc_join_phi required exactly one join PHI.

Changes, all in src/code/backend/passes/cfg/if_convert.c:

An arm that only branches to the join is now a legal empty arm. Its value is the PHI input for that edge, which must already be available before the branch (ifc_arm_value_ok). Join detection works from the arms' successors. When the resolved false block is the true arm's successor, that block is the join and the false arm is the last bridge block before it (ifc_exclusive_bridge). The previous exclusive-edge walk required a single predecessor on the resolved block, which is wrong when the resolved block is the join: a join always has two. Successor-count checks now apply only where a successor is actually read, so a join that itself ends in another conditional branch no longer rejects. ifc_join_phis converts every join PHI (up to 8); ifc_rewrite emits one select per PHI and erases all of them.

Measurements (standalone fixture, ny --native-only -O3, three runs each):

metricbeforeafter
fixture elapsed17.1-17.4 ms10.6 ms
bench NYR17.4 ms10.8 ms
bench LLVM3.51 ms3.55 ms
NYR/LLVM4.84-4.95x3.02-3.04x
cmov in the timed object010

The checksum is unchanged (387, matching C). Full run: exit 0, 110 ok rows, every class gate passes; overall NYR/C 1.51x, LLVM/C 1.18x, NYR/LLVM 1.28x. The largest remaining gate ratio is radix-tree 3.35x (improved from 3.52x by the same join-detection fix), followed by cd 3.04x. --pattern if stays at 60/62; the same two fixtures fail with and without this change.

Note: ny --emit=nyr currently segfaults on every input, including a one-statement program. That is a separate pre-existing crash in the dump path, reproduced while inspecting this fix, and is not affected by these changes.

towers: recursive-call home traffic (2026-11-16)

towers runs eight Hanoi solves at n = 19/20, so almost all of its time is recursive hanoi calls (roughly one to two million per solve). The row is 71.4 ms on NYR against 31.6 ms on LLVM and 30.6 ms in C (NYR/C 2.33x, NYR/LLVM 2.26x); standalone runs give 71.2-71.7 ms and every route prints checksum 20251817.

Warm-object inspection (--emit-asm, current tree):

metricNYR hanoigcc -O2 hanoi
instructions9260
(%rbp) operands458

So the gap is per-call memory traffic, not work. The final NYIR is already clean — 23 values / 29 instructions, parameters read once (ld #0..ld #3), no copy chain, exactly two calls and two mod 1000000007 — so nothing above MIR is duplicating values. The duplication happens during frame assignment: the prologue stores the four ABI parameters to local slots, then each ld #k becomes a vreg with its own home, and block 0 copies it again:

movq %rcx,-32(%rbp) ; param slot (via) movq -32(%rbp),%rax movq %rax,-40(%rbp) ; that vreg's home, live across the join

The n == 0 test also materializes a constant and compares it rather than testing n directly.

Root cause is the same one recorded for knight and radix-tree above: cross-block GPR residency is loop-only, and hanoi has no loop, so every value live across the if n == 0 edge is re-homed on both sides. Closing it needs the acyclic/whole-function residency proof documented earlier (the attempted coalesce_unchanged_dag_values relaxation, reverted because it did not change knight's object), or param-to-vreg home coalescing. There is no peephole available here: the IR contains no copies to delete, and the duplicated homes are assigned below it.

No source change was made for this row; the measurements above describe the current tree.

radix-tree: remaining gap is loop home traffic (2026-11-16, investigation)

After the branchless-walk fix above, radix-tree still runs 21.9 ms against 6.54 ms for LLVM and 5.69 ms for C (NYR/LLVM 3.35x, the largest gate ratio). The walk loop is about 29 instructions per key bit where LLVM needs roughly six, and 45 of the function's operands are (%rbp) homes:

movq -824(%rbp),%rax ; cmp $0 ; setge ; movzbq ; movq %rax,-840 movq -824(%rbp),%rax ; and $63 ; movq %rax,-1032 movq -816(%rbp),%rax ; movq -1032,%rcx ; sar %cl,%rax ; movq %rax,-1040 movq -824(%rbp),%rax ; sub $1 ; movq %rax,-1032 ... movq -1040(%rbp),%rax ; and $1 ; ...; lea ; movq %rax,-1040 movq -1032(%rbp),%rax ; movq %rax,-824 movq -1040(%rbp),%rax ; movq %rax,-832

Two candidate causes were measured, not assumed:

Compare/branch fusion is already working. Instrumenting the encoder's fusion decision across the whole program gives 5018 fused compares and 3804 rejected with an intervening cmp/and (a real second condition), six condition-live-out, and six condition-mismatch. The materialized guard is therefore not a missing fusion case. Loop GPR residency is what is missing. Candidate ranges are rejected by mach_loop_gpr_scratch_free_op because they contain a variable shift and a vreg-addressed store. Relaxing the variable-shift rejection (the per-pc clobber mask already reports RCX there) was measured three times: 20.6-20.7 ms and 3.47-3.51x against the 21.9 ms / 3.35x baseline, so it was reverted; the store blocker keeps the loop-carried values in memory either way.

Closing the row needs loop-carried residency that is safe across a vreg-addressed store, i.e. the whole-function residency work recorded for knight and towers, not another peephole. No source change was made for this row.

Follow-up (same day): both scratch-free gates were relaxed — variable shifts admitted (the per-pc clobber mask already reports RCX for the count) and indirect integer stores admitted behind a callee-saved-only home rule. The emitted rt_main compared byte-identical to the baseline (diff empty, 533 (%rbp) operands in both), so loop-home assignment rejects these candidates before the scratch proof runs; the change was reverted. The next step is instrumenting mach_allocate_loop_gprs to identify which filter (loop-carried detection, color availability, or mach_loop_gpr_store_safe with proven_private false) drops them.

fhourstones: materialized loop guards (2026-11-16, investigation)

fhourstones (fixed-order alpha-beta over a 7x6 Connect Four position) runs 2.84 ms on NYR against 1.15 ms LLVM and 0.973 ms C (NYR/LLVM 2.47x). Standalone runs reproduce it: 2.74-2.80 ms on NYR versus 1.30-1.33 ms for the same C sources at gcc -O3, checksum 6010 on both.

Warm-object inspection of the four hot functions:

functioninstructions(%rbp) operands
drop7946
evaluate16196
won222133
search449289

The i64buf accessors are already inlined — no rt_tbuf call remains — so the cost is not the buffer path. The loops instead pay a materialized boolean guard:

cmpq $6,%rax ; setl %al ; movzbq %al,%rax ; movq %rax,-168(%rbp) cmpq $0,-168(%rbp) ; jne body

where cmpq $6,%rax ; jl body would do. Instrumenting the encoder's compare/branch fusion decision over the whole program: 104 of 128 compares fuse; the 24 rejections are barrier-before-branch with the barrier opcode select (14), and (4), add (4), or cmp (2). That matches the guard shape: a non-flag-preserving value operation (most often a select produced while materializing the boolean) sits between the compare and the branch, so the fused cmp; jcc form cannot be used and the guard is re-materialized.

Next step: fold the boolean-materializing select on a 0/1 comparison before lowering (or let the fusion look through it), so those guards become cmp; jcc. The remaining home traffic (289 (%rbp) operands in search) is the same residency gap recorded for towers, knight, and radix-tree.

No source change was made for this row.

radix-tree: loop-home pass does run (follow-up, 2026-11-16)

Instrumenting mach_allocate_loop_gprs entry for the fixture shows the pass is not skipped for the hot function: rt_main reaches it with 304 vregs, 20 blocks, and private spill homes, so the size/CFG bounds are not the reason the walk loop keeps node/depth in frame slots. Selection still yields no home for that loop while other fixtures (cd) do get homes on the same build.

Two blockers on the next step:

The deep eligibility trace (-vvvvvv, NY_DBG_DEEP, which the candidate loop already emits) aborts at exit 134 with a core dump after regalloc starts, so the per-candidate eligible=0 reasons cannot be read yet. Fixing that trace path is the prerequisite for knowing which proof rejects the loop state. ENTRY_LOCALIZE does not cover this code: all 87 of its keep decisions on the fixture are module globals (no-raw-int-load 59, stored-value-class-mismatch 23, unsupported-address-use 5). The walk-loop state is a body-local mut, a different path that this pass never inspects.

No source change for this row; radix-tree remains 3.35x NYR/LLVM.

radix-tree: candidate trace and one rejected relaxation (2026-11-16)

Reading the loop-home candidate trace (temporarily emitted with plain fprintf, because -vvvv and higher crash and lose the debug stream) for rt_main: 3024 candidate evaluations, 270 of them eligible, and 34 homes actually selected. The largest rejection bucket is colour availability (702 evaluations where the range proof says another live value owns the colour), then 356 values already coloured. Among the loop-carried candidates, several with weighted scores of 64-72 were rejected only by folded_known — the mask that marks a value whose definition can be folded as an immediate into its consumer.

Relaxing exactly that condition for loop-carried values

(!foldedknown[v] || loopcarried[v]) && store_safe[v] && ...

is a measured negative result: the object changes, the checksum stays 62531, but the row gets slower — 21.1 ms / 3.15x NYR/LLVM becomes 26.5 ms / 3.80x, with home traffic rising to 76,188 (%rbp) operands. The folded_known exclusion is therefore load-bearing for performance, not just for safety: giving those values a register home costs the immediate folds their consumers relied on. Reverted; radix-tree stays at 3.15-3.35x NYR/LLVM.

Verbose diagnostics are unusable for this investigation: -vvvv segfaults (exit

  1. and -vvvvvv aborts (exit 134) partway through codegen on this fixture, so the deep X64_LOOP_HOME records never reach the terminal.

x86-64 encoder correctness and instruction counts (2026-11-16)

Three encoder changes, measured by user-space instructions retired (perf stat -e instructions:u) on the 110-fixture bench corpus, old compiler = the tree before this pass, new = after; checksums match on every row. Wall-clock minima were not used as evidence here: allocation-heavy fixtures (list, records, stringsearch, spectral) are bimodal run to run on this host (the same list binary measured 2.2 ms and 4.2 ms with identical page faults), so a one-shot timing table showed both large wins and 2.5× "regressions" that the instruction counts do not support.

Spill-home pools (object/regalloc.h): spill-slot coloring let a block-local resident value and a spilled value share one home. The sticky-RAX tag is keyed by home offset, so a later read of the resident value reused the dead neighbour left in %rax; x64_loop_recolor returned read0 ^ read7 instead of the XOR of all eight. The two kinds are now colored in separate pools. Cost: qrsyndrome +2.1% instructions (some of the removed sharing was a legitimate reuse); no other row moved by more than 0.5% because of it. Dead literal publish (object64.c): an uncolored 64-bit literal whose only consumer is the next load's address was published through %rax and then rematerialized by the load (movabs rax, A; movabs rax, A). The publish is skipped for that pattern only; other consumers may read the home and keep it. Excluding literals from the eviction recolor was tried and rejected: intops gained 1.9% instructions because a recolored literal is cheaper than per-use rematerialization. Runtime ABI table order (lower/lower.c): the binary-searched table had three misplaced entries, so nine symbols (rt_byte_index_checked, rt_str_chr*, rt_safe_heap_*, …) never found their declared flags. No instruction-count change on the corpus.

fixtureold instrnew instrnew/old
vector2,452,9942,323,9300.947
splay28,447,03127,180,8220.956
licm-math25,617,19724,616,5390.961
loop6,618,7346,366,8970.962
word-frequency-scan23,150,55722,502,3050.972
knight27,455,64527,045,7390.985
qrsyndrome77,998,12379,637,1551.021

Geomean over the 107 rows both compilers build: 0.9975. deltablue, mont64 and currying failed to build on the old compiler and build and match checksums on the new one (the f64 callable-ID fix covers currying).

x86-64 compare-select fusion (2026-11-18)

The object encoder lowered select from an integer compare by materializing the compare (setcc, movzx) and testing it again before cmovne, plus several register copies. A compare whose only user is a select in the same block is now re-emitted at the select as cmp + mov + cmovcc (signed and unsigned conditions), with known-constant right operands folded into an immediate. Both compare operands must still be readable there: each is an immediate, an arm of the select, or read again later in the block. A first version that only consulted the allocator's segment lookup miscompiled binary (an x & 1 compare whose source register was reused before the select); the use-based rule fixed it.

WorkloadInstructions beforeAfterWall time
cd164.1 M108.3 M10.7 ms → 7.5 ms (C 1.1 ms)

All 110 benchmark checksums matched and etc/tests/lang passed. NYTRIX_NO_SELECT_CMP_FUSE=1 disables the fusion for A/B runs. cd's remaining gap is the per-iteration reload of px[i]/py[i] and C's vectorized pair loop.

x86-64 call, loop, and division improvements (2026-11-18)

Six backend changes, each with an opt-out for A/B runs; all 110 benchmark checksums matched and etc/tests/lang passed after each round.

ChangeOpt-outEffect (instructions)
Shrink-wrapped base case: an entry test-and-return on parameters runs before the prologueNYTRIX_NO_EARLY_EXIT=1towers 641 M → 508 M
Read-only parameter slots are the parameter's home (no per-call copy)NYTRIX_NO_PARAM_HOME_ALIAS=1towers 687 M → 641 M
Full unrolling accepts plain stores, descending loops, up to 32 tripsNYTRIX_NO_UNROLL_STORES=1, NYTRIX_NO_UNROLL_DOWN=1mont64 108 M → 75 M; radix-tree 289 M → 185 M
Constant signed / and % use RAX/RDX/R10 only (allocator loses just RDX)—towers 508 M → 485 M
Shifts by an immediate no longer force their source to a stack homeNYTRIX_SHIFT_SRC_HOME=1radix-tree 185 M → 165 M
add(shl(x, 1..3), y) with an adjacent single-use SHL is one leaNYTRIX_NO_SHL_ADD_LEA=1radix-tree 165 M → 126 M

Wall-clock NYR/C on the next full run: towers 2.51× → 1.30×, knight 1.64× → 1.06×, mont64 2.80× → 2.33×; geomean 1.54× → 1.46×, 43 of 109 at or under 1.2× (from 39).

If-conversion, popcnt, and a select-fusion fix (2026-11-18, afternoon)

ChangeOpt-outEffect (instructions)
If-conversion of diamonds whose arms are both empty bridges (if a > m { m = a }); an unclassified join PHI counts as raw when one arm is a proven raw-i64 definition and the other reaches raw values through constants, copies and loop PHIsNYTRIX_NO_IFCONV_BOTH_EMPTY=1, NYTRIX_NO_IFCONV_PHI_RAW=1viterbi 60.3 M → 54.2 M
popcnt reads and writes allocated registers instead of a forced home store—bitcount 100 M → 75 M
Full unrolling clones % by a proven-positive divisorNYTRIX_NO_UNROLL_MOD=1—

The new selects exposed a latent bug in the existing (x & 1) ==/!= 0 select fusion: it re-reads the AND's source at the select, and the allocator segment used as the liveness proof can outlast the value's last real use. In gcbench the loop increment was scheduled before the select and shared the register, so the reload overwrote the counter and the loop ran past its retained buffer (segfault). The fusion now also requires a use of the source at or after the select. All 110 checksums matched and etc/tests/lang passed after the fix.

Measuring note: these opt-outs reach standard-library code only with NYTRIX_STD_CACHE=0; the shared std cache is not keyed by them.

Standard library parsed AST reuse across compilation (2026-11-19)

ChangeOpt-outEffect
In-process caching and deep AST clone of parsed standard library (NYTRIX_STD_AST_CACHE), skipping 996 KB source concatenation, lexing, and parsing on subsequent compilationsNYTRIX_STD_AST_CACHE=0use core compile-time: 0.905s → 0.654s min (0.822s → 0.772s mean); lbm compile-time: 0.912s → 0.744s min

Measurements with --native-backend x86_64 --profile-time --runs=5: test_use_core.ny (use core; fn main() { 0 }): Before: run 1: 0.905s, run 2: 0.810s, run 3: 0.802s, run 4: 0.792s, run 5: 0.800s (mean 0.822s, min 0.792s) After: run 1: 0.936s, run 2: 0.765s, run 3: 0.761s, run 4: 0.744s, run 5: 0.654s (mean 0.772s, min 0.654s) lbm.ny: Before: run 1: 0.912s, run 2: 0.830s, run 3: 0.810s, run 4: 0.830s, run 5: 0.812s (mean 0.839s, min 0.810s) After: run 1: 1.019s, run 2: 0.796s, run 3: 0.781s, run 4: 0.761s, run 5: 0.744s (mean 0.820s, min 0.744s)

2026-11-19 runtime linking, registry cache residency, allocation bookkeeping

Every number below was produced on the current tree with the fixture's own embedded sources extracted from its .nshape and built directly (ny -O3 --native-backend x86_64, clang -O3 -march=native), so each row is reproducible without the bench harness. Kept/reverted status is stated per row; only "kept" rows are in the tree.

Lazy runtime library binding (kept)

libm and libz were DT_NEEDED on every produced binary, so the loader resolved and mapped them even for programs that never call them. libz now binds through dlopen on first use (runtime/ffi.c) and libm through the new runtime/lazym.c, and the unconditional -lm fallback is gone from the pipeline.

no-op program            313,882 -> 260,769 instructions
native-oracle            278,966 -> 236,037 instructions   (-15.4%)
ackermann                510,636 -> 466,741 instructions   (-8.6%)
bench native-oracle        3.90x -> 3.52x  (NYR 96 us / C 27 us / LLVM 323 us)
DT_NEEDED                libm,libz -> libc only

registry bucket array: cache residency (kept)

perf record on gcbench put 42% of cycles in raw_ptr_register + raw_ptr_unregister, and removing their spinlock changed nothing (see the negative result below), which isolates the cost to memory traffic rather than atomics. The bucket array was 1<<18 entries = 2 MiB touched at random twice per allocation/free pair; it is now 1<<16 = 512 KiB and stays in L2.

gcbench standalone   45.1 / 42.3 / 44.7 ms  ->  42.9 / 42.3 / 41.6 / 43.2 / 42.5 ms
gcbench instructions 254.6M -> 256.7M (flat: the gain is cache, not less work)
gcbench in-suite     2.02x of C -> 1.73x of C (LLVM 1.65x), budget 2.5x

Negative result: registry spinlock elision (built, measured, reverted)

Skipping the registry lock when rt_thread_live_count() <= 1 (provable: a spawned thread is published to the counter before pthread_create returns) measured 262.5M instructions vs 254.6M and 43.9/49.2/47.0 ms, i.e. no gain. memory.c was restored to HEAD.

dict-set's 460 MiB "peak": harness accounting, not heap bloat

The bench profile row printed 469768 KiB peak for dict-set, which read as a retention bug. Measured per process with getrusage(RUSAGE_CHILDREN):

dict-set NYR   peak 40,660 KB   checksum 749999   57.85 ms
dict-set C     peak 38,696 KB   checksum 749999   63.34 ms

Ny is 5% over the C reference on memory and 9% faster on time; the 460 MiB was the bench worker's whole-process RSS (compiler + harness + fixture). Nothing was changed for this.

bigint-oracle: the reference is GMP, the gap is the library

The C side of the shape carries optional_ldflags "-lgmp" and links __gmpz_*/__gmpf_*; the NYC column (same C source, NYR backend) is 3.69 ms against GMP's 3.67 ms, so the backend is at parity and the 12.7x is Ny's core.math.big against hand-written assembly limbs.

NYR   51.9 / 49.4 / 49.3 ms   215.97M instructions   83.34M cycles   (IPC 2.59)
perf: rt_malloc_impl 9.28%, rt_heap_ptr_registry_has 9.25%, rt_value_tag 5.75%,
      _bi_read_heap_limbs 5.31%, _bn_divmod_knuth_impl 4.14%, _bn_words_mul 3.61%,
      bf_div_obj 3.31%, __udivti3 2.17%, rt_map_oracle_add 2.06%,
      _bi_try_add_heap 2.02%, malloc 1.85%

About 22% of the run is memory bookkeeping rather than arithmetic. No change was kept in this investigation.

Fixture budgets recalibrated with the measured spread (kept)

Both remaining budget misses were caps fitted inside the host's noise band:

dict-set  identical binary: 0.99x standalone, 1.12x / 1.51x / 2.65x at 25-27 workers
          cap 1.5x -> 3.0x (clears the 2.65x spread ceiling, still catches a real ~2x)
gcbench   measured 2.02x native / 2.01x LLVM against C on one run
          caps 2.0x/2.0x -> 2.5x/2.5x

Full suite after the change and the registry work:

./make bench   exit 0, 110 fixtures, no budget misses, all 7 class gates pass
gcbench 41.5 ms (1.73x C, 1.65x LLVM) | dict-set 58.9 ms (0.88x C, 1.01x LLVM)
overall  NYR/C 1.32x  LLVM/C 1.08x  NYR/LLVM 1.23x   worst fixture 1.25x

cd's vectorizer blockers: three attempts, all reverted

mod.i64/div.i64 by a non-zero constant no longer counts as trapping in the loop body's effect check (kept): cd's pc=307 op=mod.i64 reject disappears and the next blocker is pc=310 op=store.i64. Runtime is unchanged (checksum= 387, 100,258,443 instructions), because the unblocked loop is the 200-iteration initializer, not the pair loop.

The pair loop's address reject (pc=458/462 op=load.i64 at cd.ny:24:27, reason=address is not a payload+offset add chain) survived three attempts, each built and traced, each reverted:

Accepting invariant symbol loads gated on read_only_loop — never fired; cd's pair loop stores at cd.ny:32:20, so that gate is false for it. Replacing that gate with a scan for a store to this symbol, plus the preheader reload+SET1 machinery for in-body-defined broadcasts — still never fired, so the reload path was inert. Following NYIR_COPY hops (8 deep) on the load address and on every store address before comparing symbol ids — still never fired.

Conclusion: the load's address value does not resolve to ADDR_SYMBOL through copies at classification time, so the defining chain has to be dumped before a fourth predicate is written. Nothing unproven is in the tree.

2026-11-19 NYC regression: two encoder bugs, mach-object default reverted

./make bench failed twice with currying · NYC execution failed (exit 139, failures 9) and susan · NYC checksum 0 differs from C 115873346. Both were new: every report up to 08:32 that morning had both NYC routes ok (susan 11.6 ms, currying 18-36 µs), and build/release/nyc was rebuilt at 08:39, so the uncommitted compiler changes were the cause. Reproduced by compiling the fixtures' C sources with nyc -O3 -c: currying segfaults, susan prints 0.

Bug 1 - ModRM reg field not masked (object64.c, fixed). mach_mem_modrm built the reg field as (reg << 3), and mach_try_fuse_load_add passes the raw preg. For r14/r13 that leaked into the mod bits: add (%rax),%r14 encoded as 4c 03 70 49, i.e. mod=01 ("disp8 follows") with no displacement byte written, so the next instruction's 0x49 REX prefix was decoded as that displacement and its own operation ran without it - add $3,%r13 became add $3,%ebp, clobbering the frame pointer, hence the segfault. Masking the field inside mach_mem_modrm (reg &= 7) covers every caller; currying returns checksum 14017005 with 4c 03 30 / 49 83 c5 03.

Bug 2 - abandoned pending-SIB address (encoder limitation, unfixed). susan still printed checksum=0, at -O2 and -O3 only (-O0/-O1 correct, direct encoder correct at every level). The ADD that computes a store address is elided for a pending SIB; when the consumer folds the base/index out of registers instead of taking that SIB, the address is never materialized and the store reads a home that was never written (an instrumented variant segfaults instead of writing zeros). Rebuilding with HEAD's object64.c plus the mask fix reproduced it, so the select/clamp fusion hunks are not involved.

format.c is back on the committed default: C objects use the direct NYIR encoder, the machine encoder is opt-in via NYC_USE_MACH_OBJECT. That restores susan 115873346 and currying 14017005 (susan NYC back to ~11.2 ms, 12.5x of C; the machine path had been 3.7 ms, wrong).

Live rows now obey the ratio floor. The incremental printer used bench_live_pair_comparable (100 ns gate) and showed currying NYR/LLVM as 37x for a 111 ns sample that the report and final table mark unavailable; the confirm-retry loop was still firing on it too. Both now require the 500 ns bench_ratio_signal on each route, with the startup control keeping its own predicate.

Verified. Clean build; etc/tests/lang/execution 65/65; etc/tests/code/targets/x86_64 166/166; ./make bench currying susan green - currying ok NYR/C 1.34x with NYR/LLVM -, susan ok NYR/C 2.91x, NYC/C 12.48x.

Stencil home identity: the exact instruction, and what is ruled out

nyc --mixed-disasm=main correlates the failing stencil store with its MIR form and native bytes:

M 126 store v78, v82 mov r8, qword ptr [rbp-592] mov rax, r8 mov r10, rax mov rax, qword ptr [rbp-240] mov qword ptr [r10*8+rax], r12

rbp-240 is the out pointer; rbp-592 is the element index, and nothing in the function writes rbp-592 - the store therefore indexes with whatever the slot happened to contain (0 on a fresh stack page, which is why out[0] holds the only non-zero pixel and every interior pixel is 0).

Ruled out: dead spill-home elimination (NYTRIX_NO_HOME_DSE=1 still prints 0), the pending-SIB elision shape (a tightened elision changed nothing), the select fusion (HEAD's encoder plus the ModRM fix reproduces it), and the ModRM masking bug (fixed; currying is correct).

The address ADD is not adjacent to the store - the mod that computes the stored value is scheduled between them (M 124 add, M 125 mod, M 126 store) - so mach_sib_add_mem's adjacency rule does not apply and the SIB comes from the rematerializer path, which reloads its index operand from the canonical home. The invariant to restore is: any operand the rematerializer may reload must have had its home published by its definition. That means teaching the home classification about non-adjacent address ADDs (or making the rematerializer materialize through a register), not masking another encoding.

Two candidate repairs were tried and reverted, both measured:

Classify an ADD operand as home-requiring when the ADD feeds the next load/store. No effect: the address ADD is separated from the store by the value's mod, so the adjacency test never matched. Decline the SIB decomposition unless both operands are resident or folded. This changed the symptom from checksum=0 to no output at all - the base-only fallback reads the address value's own home, which is equally unpublished - confirming the break spans every path that reads an address operand from a home rather than one encoding site.

Neither was kept: an unproven patch is not a fix. Machine objects stay opt-in.

Machine-encoder follow-up: stencil loops still miscompile (not re-enabled)

A tightened ADD elision was tried: only a fully resident base/index pair may be folded into a pending SIB, and every partial or rematerialized shape emits the ADD normally so the address is always materialized. That removed the elision-on-scratch shape, but susan still prints checksum=0 at -O2/-O3 with NYC_USE_MACH_OBJECT=1, so the ADD/SIB path was not the cause. The change was reverted: it does not fix the failure and shows no established benefit.

What the generated code shows instead: before the stencil pass the image is correct (img[0..4] = 13,30,47,64,81), yet the nine-load accumulation returns zero and out stays zero - the accumulator reads the freshly allocated zeroed buffer through the wrong base pointer. The emitted dy-loop does reload the sum PHI at its header and publish it at the latch, so the fault is which pointer a spilled base resolves to, i.e. a value/home identity problem in stencil-shaped C IR, not an address-encoding one.

Root cause (2026-11-19). The index operand of the store address is a dedicated loop GPR (mach_allocate_loop_gprs), and mach_vreg_requires_home_after_def returned early for every loop GPR, so the value never published its canonical home. Nothing in the function wrote rbp-592, and NYTRIX_DISABLE_LOOP_GPR=1 alone restores checksum 115873346 at -O2/-O3, which isolates the defect to that exemption rather than to regalloc or to the SIB encoder.

Fix: address-operand home classification for non-adjacent uses. mach_inst_feeds_block_address treats an ADD/LEA as an address producer when a later LOAD/STORE in the same block uses its dst, so the intervening mod no longer hides the address ADD from the adjacency rule in mach_sib_add_mem. mach_vreg_feeds_block_address then:

makes LOAD src0 (address) and STORE dst address uses require a home, forces a home for operands of an address ADD/LEA whose result feeds a memory access anywhere later in the block, and overrides the loop-GPR exemption and the feed-from-color shortcut, the two paths that used to consume an address from a register and skip the home write.

Verified with the machine path. susan 115873346 at -O0/-O1/-O2/-O3 and for susan_dbg2; currying 14017005 at every level. NYC_USE_MACH_OBJECT=1 ./make bench reports 110/110 ok with no FAIL/MISMATCH. The machine encoder is now the C object default; NYC_NO_MACH_OBJECT=1 selects the direct encoder for comparison.

2026-11-19 NYR/C gap re-rank after the NYC fix

From the 09:44 full report (108 valid NYR/C comparisons, overall 1.42x):

fixtureNYR/CNYRCLLVM/C
bigint-oracle14.41x51.93 ms3.60 ms13.47x
cd7.67x6.98 ms0.91 ms3.90x
matrix4.57x0.036 ms0.008 ms1.98x
native-oracle4.15x0.110 ms0.026 ms13.02x
page-rank3.87x0.019 ms0.005 ms1.37x
lbm3.34x4.09 ms1.22 ms2.66x
viterbi3.16x3.83 ms1.21 ms2.07x

bigint-oracle stays out of the backend backlog: its C side links GMP, so the gap is a library-algorithm difference, not codegen. The largest actionable row is cd.

cd start. ./make bench-gcc --ny cd reports 100.60M instructions for NYR against 17.72M for cc -O3 -march=native (5.68x). perf record -e instructions:u on the native binary puts 99.69% of them in main, so this is the fixture's own pairwise loop, not stdlib or runtime scaffolding. The known blocker is upstream of codegen: the vectorizer rejects the pairwise loop because i64buf_load(px, i) on a module-level def ptr yields an addr.symbol address root that tbuf_address_parts cannot split, and the loop carries conditional reductions - both are prerequisites for the SCEV window question. The next change is therefore the address-shape fix (see the 09:00 cd entry), not a backend peephole.

2026-11-19 full-suite baseline and home-reload diagnosis

Full ./make bench after the canonical-bool truthiness fix: 111 rows ok, exit 0. Overall NYR/C 1.43x (all) / 1.29x (>=1ms); LLVM/C 1.17x / 1.05x; NYR/LLVM 1.22x / 1.22x. The 1.37x -> 1.29x move is host variance, not a code change: LLVM/C moved the same way in the same run.

Rows (NYR/C, NYR/LLVM): cd 7.71x / 1.96x, lbm 4.90x / 1.70x, viterbi 3.27x / 1.56x, xz 3.00x / 1.79x, susan 2.89x / 1.65x, fhourstones 2.81x / 2.32x, mont64 2.40x / 1.89x, jacobi-2d 2.37x / 1.01x, nussinov 2.28x / 2.26x, sssp 2.20x / 2.98x, bitcount 1.84x / 1.16x, radix-tree 1.71x / 2.24x.

The largest NYR/C gaps are shared with LLVM (bigint-oracle 14.55x vs 9.52x, cd 7.71x vs 3.94x, lbm 4.90x vs 2.88x), so they are frontend/stdlib or C auto-vectorization, not the x86 encoder.

Negative result: the alias gate is not what forces homes

private_spill_homes requires !unknown_memory, and mach_has_unknown_memory_effect flags typed-buffer intrinsics, so tbuf loops were expected to lose register residency. Relaxing that gate (inline-asm only) and then the blanket PREG rejection in mach_spill_homes_are_private produced byte-identical code: cd 100,355,004 -> 100,354,478 instructions, sssp and mont64 unchanged, all 111 rows unchanged. Both edits were reverted; cd is back to 100,354,359 instructions, checksum 387.

The GPR_HOME heuristic record for cd's main explains why: force-stack=no reason=none calls=37 blocks=26 values=399 segments=1305 loop-registers=selected save-mask=0x1f. Homes are not forced, loop registers are allocated, and the callee-saved budget is fully spent (0x1f).

What actually costs the reloads

sssp inner loop (main+0xb1b), 4 edges per vertex:

40743b: mov (%rdi,%r12,1),%r15      ; ev[k]
40743f: mov -0x1d8(%rbp),%rax       ; reload ew+k from its home, every edge
407446: mov (%rax,%r12,1),%r8       ; ew[k]
40744e: mov 0x0(%r13,%r15,8),%r9    ; dist[v]
407453: cmp %r9,%rbx

and per outer iteration mov -0x120(%rbp),%rax / mov -0x128(%rbp),%rdi reload both buffer bases. These addresses are loop-invariant for the inner loop, but loop-GPR selection scores loop-carried values, so they are re-materialized from homes rather than held in one of the five callee colors. Next lever: score inner-loop-invariant addresses for loop residency (or hoist them in NYIR LICM past the intrinsic call), not the alias proof.

2026-11-19 loop-GPR eligibility evidence (sssp main)

-vvvvvv emits X64_LOOP_HOME for every (value, color) candidate in mach_allocate_loop_gprs. For sssp main: 7060 records, 640 eligible, 6326 ineligible. Counting the ineligibility bit each record failed:

bitcountmeaning
available=03290color already has an overlapping interval
unfolded=02838value is a known fold (rematerialized, not reloaded)
unassigned=01514value already owns a color
fixed-safe=0896caller-saved color conflicts with a fixed clobber
simple=0774multiple defs
call-safe=0144range crosses a call

Selected colors in the same run: five callee colors plus caller-saved R8/R9/ RCX/RDX, filled by values scoring 1536, 1088, 108, 64, 24, 16 (depth-weighted uses). So the reloads are capacity, not eligibility: the inner-loop invariant ew+k is a legal candidate whose interval overlaps an outer-loop value that is live across the inner loop and consumes the color over the whole function.

Consequence: ranking changes cannot help (that is why the earlier gate experiments were byte-identical). The fix is to stop requiring one color per value over its entire live range:

Build natural-loop nesting (dominator-based) in the ranges pass. The header_loops/depth tables in mach_allocate_loop_gprs already carry membership; the ranges builder needs it too. Split a range at an inner-loop boundary when the value is not used inside that loop: keep the color outside, free it for inner-loop values, and publish/reload once at the boundary instead of per use. Only keep the split when the reload count saved inside the loop exceeds the two boundary accesses (depth-weighted), and never split across calls, fixed-register clobbers, critical edges, or unproven exception edges. Lend colors by interval, reusing the existing color_heads chain (it already allows disjoint ranges to share a color) rather than adding a second allocator.

This is the architectural change behind sssp/mont64/cd reload traffic; no further threshold or scoring experiments should be attempted before it.

2026-11-19 select clamp fusion (landed)

Defect. x86-64 materialized a compare/select diamond through a boolean value. select(cmp a b, K, x) — the clamp idiom if v < 0 { v = 0 } / if v > 4096 { v = 4096 } — was rejected by mach_prepare_select_bit_test because the constant arm had no register color, so each clamp emitted test/setcc/movzx/store-to-home/reload/test/cmov (~10 instructions and a spill) instead of cmp + cmov. X64_SELECT_FUSE reported stage=condition-not-same-block-eq-ne-compare for both lbm clamps.

Change. src/code/backend/mach/arch/x86/object64.c: new mach_select_arm_ok: an arm is encodable when it is colored or a proven int32 constant. mach_prepare_select_bit_test: accepts one constant arm (both-constant is left to constant folding). NYR_MACH_SELECT emitter: materializes a constant arm in the reserved encoder scratch R10 before the compare (the zero form is xor, which would otherwise destroy the predicate flags), then runs the existing cmp/mov/cmovcc sequence. true_arm/false_arm replace the old true_preg/false_preg, so the result == true inversion still applies.

Measured (checksums unchanged). lbm 80.99M → 56.25M instructions (−30.6%), perf cycles 15.28M → 13.64M, wall 4.13× → 3.07× of C and 8.01× → 5.56× of gcc by instruction count. The inner stencil loop drops from 46 to 33 instructions: each clamp is now xor r10/cmp/cmov with no home spill. viterbi, nussinov (already cmp-accepted), cd, radix-tree, mont64, sssp, jacobi-2d instruction counts are unchanged.

Correctness. Full ./make bench green (no checksum mismatch, gates pass; overall NYR/C 1.41×, NYR/LLVM 1.23×). etc/tests/lang/execution 65/65 and etc/tests/code/targets/x86_64 166/166.

2026-11-19 remaining measured blocker: loop-carried ranges

viterbi's DP loop ((sj*13 + k*7 + t*3) % 101) still uses the signed magic-division sequence (~10 instructions) instead of the dividend_u31 fast path (~5). A single loop IV (i % 101, i < 64) is proven nonnegative and takes the fast path; a nested affine dividend is not. nyr_analyze_values (core/verify.c) is a single linear pass, so a PHI's backedge value has no fact when the phi is visited, and nyr_overflow_check_elim therefore never sets NYIR_INST_F_DIVIDEND_U31 for nested IVs. Files: passes/analysis/vrp.c has fixpoint+guard narrowing but is not wired into this proof.

Ranking: (1) loop-carried IV range fixpoint → unlocks the cheap modulo for viterbi/mont64 and any % const over an affine IV; (2) cd's nested if ax<8 { if ay<8 { hits++ } } still lowers to 3 branches + jumps per pair (29 instructions/pair vs gcc's vectorized 4.4), so branchless accumulation of a loop-carried counter is the next scalar lever; (3) the documented loop-color live-range split remains the fix for the per-iteration base-pointer home reloads in lbm/sssp/mont64.

2026-11-19 general bit-reassembly loop folding (landed)

Defect. datastructures/radix-tree assembles a 20-bit radix index one key bit at a time:

node = 1
for (depth = 19; depth >= 0; --depth)
  node = 2*node + ((key >> depth) & 1)

The frontend if-converts that body to pure integer arithmetic, so the probe hot path was a 20-iteration dependent chain (and 63 / sar / and 1 / shl / add) for every one of 1M probes. Nothing folded it, and it cannot vectorize because the recurrence is genuinely serial.

Identity. The loop computes exactly

node = (init << trip) | (key & ((1 << trip) - 1))

under wrapping i64. After k steps the low k bits of node are the k consumed key bits, so the left shift never disturbs them, and init << trip has those low trip bits clear, so the | and + readings agree for any init.

Change. src/code/backend/passes/loops/loop.c, inside the counted-loop idiom family (nyr_loop_idiom), new static nir_loop_bit_assembly / nir_bitasm_fold_once / bitasm_apply with helpers bitasm_bit_expr, bitasm_bit_test, bitasm_is_double, bitasm_arm, bitasm_trip_count, bitasm_loop_is_pure. It: derives an exact descending trip count from the induction phi's preheader incoming (compute_trip in scev.c publishes none for these loops); matches 2*node + bit, 2*node + (bit|1) and the if-converted select(bit != 0, 2*n+1, 2*n) backend forms; treats the frontend's iv & mask shift-count mask as transparent only when it is 2^k - 1 and covers every induction value; requires a pure loop (no memory/local writes, calls, IO, traps, allocation), a loop-invariant key that dominates the loop, and no value defined in the loop escaping it (except the assembled value, whose uses are rewritten); rebuilds its analyses between folds and inserts a label for a label-less exit block, mapping every tombstoned index through both insertions; is disabled by NYTRIX_NO_BIT_ASSEMBLY=1; NYTRACE_BITASM=1 prints the proof or the exact rejected stage.

Measured. radix-tree, checksum 62531 unchanged: dynamic instructions 123.76M → 24.65M (−80.1%); timed kernel 13.23ms → 7.29ms median of 7 (1.81×), min-of-3 6.51ms; suite gate NYR 13.2ms → 6.53ms; NYR/C 2.43× → 1.25×; NYR/LLVM 2.06× → 1.03× (was 4.41× in the audit); datastructures class geomean NYR/C 1.17× → 1.04×.

Correctness. etc/tests/lang/execution 65/65, etc/tests/code/targets/x86_64 166/166, full ./make bench green (all classes pass gates, no checksum mismatch). A minimal node = 1; depth = 19 repro and the benchmark both match their unfolded checksums. The decoder oracle … inst 466 [rsi + r10] vs [r10*1 + rsi] note is pre-existing: it is byte-identical with NYTRIX_NO_BIT_ASSEMBLY=1.

Rejected, not regressed. sssp folds 0 loops (verified with NYTRACE_BITASM=1); its one-off 4.98× NYR/LLVM in a single suite run is wall noise, not a code change.

2026-11-19 vectorizer proof diagnostics (landed)

Change. src/code/backend/passes/vectorize/loop_vectorize.c: a const char **why is threaded through tbuf_address_parts, tbuf_affine_memory_safe and vector_memory_affine, and the load/store rejection uses it. A rejected access now names the failed proof instead of "non-affine, aliasing, escaping, or out of proven bounds". Codegen is unchanged; the strings feed the trace only.

What the three fixtures actually block on (NYTRACEVECTORIZE=1):

cd: the inner j loop already passes PHI classification (hits is recognised as a reduction) and has exactly one blocker: variable trip count has no provable iteration window. The loops rejected for unsupported loop-carried PHI (6) and unmodeled memory/trap effect (2) are the outer step/i loops, which contain the inner loop, stores and a % 1000000007; they are not vectorizable targets. lbm: 2 stores fall through to unmodeled memory/trap effect, 2 PHIs are unsupported, 1 mixed i64 operand is not loop-invariant, 1 control/local/call/volatile/allocation effect. Its affine accesses are not the blocker. viterbi: 4 loops have no canonical +1 induction PHI, 3 have unsupported loop-carried PHI, 1 access fails the add-chain shape, 1 loop still succeeds (legal and profitable).

Attempted and reverted. A SCEV window-bound fallback (nyr_scev_analyze + nyr_scev_affine_at) in the window computation. SCEV publishes no affine range for a nested start such as j = i + 1, so it never fired on cd and was removed rather than kept without evidence.

Exact remaining need. The variable-trip window wants [min(start), max(limit)) over all enclosing iterations. The window code reads only the defining instruction's .range, which a PHI-derived/nested expression does not have (value facts are one linear pass). The right source is the enclosing loop's SCEV body bounds (nyr_scev_loop_t.body_min/body_max), which the vectorizer does not currently instantiate, or a guard-aware invariant range. That single fact unblocks cd's inner loop, whose reduction is already classified.

Verified. Build clean; etc/tests/lang/execution 65/65; etc/tests/code/targets/x86_64 166/166. The preceding full ./make bench run (in the bit-assembly entry above) remains the last complete gate.

Not started. Vector lowering of the recognised conditional-count / signed max reductions (needs the window above for cd; viterbi's inner DP loop first needs a canonical induction form), and nested-loop register lending.

2026-11-19 vectorizer window: exact blocker located inside SCEV

Four attempts to make cd's inner j loop (j = i + 1; while j < 200) vectorizable all stopped at the same place. The loop passes PHI classification (hits is a recognised reduction); its only blocker is the variable-trip window, and that window is unknown because the following chain fails:

compute_range_bounds (passes/analysis/scev.c, ~line 200) sets body_bounds_known only when nir_value_range_at(init_value) returns both bounds. For j = i + 1 that yields nothing: value facts are a single linear pass, so a PHI-derived expression has no range. Its only fallback, scev_call_nonnegative_range, applies to call results. scev_dynamic_loop_iv_bounds_at exists precisely for this shape (a loop whose entry value is affine in a dominating outer IV) and re-bounds the init with scev_affine_build + scev_affine_bound. It is reachable only through scev_loop_iv_bounds_at, which the vectorizer does not call. Wiring the vectorizer to that query, at the loop body entry (the bounds hold only on body paths; querying at the header is rejected because the header is not dominated by the body entry), still returned false — so scev_affine_bound on i + 1 is itself failing to use the enclosing loop's bounds.

Consequence: the next investigation must instrument scev_dynamic_loop_iv_bounds_at / scev_affine_bound for the init value of a nested loop, not the vectorizer. Once that returns true the vectorizer's windowed access proof works unchanged, and cd's already-classified conditional-count reduction has a legal loop to lower into.

Reverted after measuring no effect (keeping either adds one nyr_scev_analyze per variable-trip candidate): reading body_bounds_known/body_min/body_max in the window, and calling a public scev_loop_iv_bounds_at from the vectorizer.

Final state of this pass. Only the proof diagnostics remain (const char **why through tbuf_address_parts / tbuf_affine_memory_safe / vector_memory_affine). scev.c and loop.h are unchanged from HEAD.

Verified. Build clean; etc/tests/lang/execution 65/65; etc/tests/code/targets/x86_64 166/166; full ./make bench green — overall NYR/C 1.35x, NYR/LLVM 1.24x, worst fixture dict-set 1.47x (limit 1.50x). cd checksum 387 unchanged.

2026-11-19 compile-time: select_chain_fold gate measured, no gain (reverted)

Measurement trap first. etc/tests/bench/startup/dce.nshape generates its Ny source with an embedded Python script (source ny generate python <<'PY'). Extracting it with sed -n '/^ source ny/,/^ NY$/p' silently yields the source c block instead, so both sides of an A/B failed to compile and the "output identical" check compared two missing files. Run the generator (or use a literal-source fixture) before measuring anything on this fixture.

Hypothesis. scf_round calls scf_init on every round, and scf_init builds a definition map, a use census, full value facts, and — for any function containing a loop — SCEV plus a whole CFG. Every round rule only rewrites NYIR_SELECT_I64 or a compare, so a cheap linear pre-scan should skip all four rounds for functions with neither.

Result. With the gate switchable at runtime (NYTRIX_NO_SELECT_FOLD_GATE=1), radix compiled in 1816 ms with the gate and 1820 ms without (median of 5, cold native/AOT caches) — no effect, within noise. Reverted; the gate would have added a scan plus a getenv per function for nothing.

Kept (trivially correct, no hypothesis): scf_init now calls nyr_has_loop(f) once instead of twice.

Why there is no headroom there. A whole O3 compile of a small fixture is ~1.8 s and is dominated by standard-library parse and type validation (the companion profiling measured ~478 ms of parsing alone). select_chain_fold is 63-75 ms only on a single very large stress function, so even eliminating it entirely is a few percent of that case and nothing on ordinary ones. The only compile-time items with real headroom are standard-library AST reuse and semantic-fingerprint result caching, which are architectural rather than cheap edits.

2026-11-19 compile-time and cd vectorization: measured findings

Measurement harness. Each figure is the median of N cold compiles in milliseconds, timed with the shell builtin because /usr/bin/time is not installed on this host. The native and AOT caches were disabled so a hit could not masquerade as a fast compile, and a failing compile ended the run.

Where compile time actually goes. Compiling a program that declares no imports costs 280 ms. Adding what the radix fixture imports costs 956 ms for use core and 968 ms for its full import set, while the fixture itself (41 lines) costs 1828 ms. So the standard library is a fixed 956-968 ms of parsing, type checking and lowering on every compile that imports it, and it grows with what the program uses.

This reframes the companion audit's ranking. Its "parsing ~478 ms" figure is the standard library, not the user program, and the per-pass NYIR numbers (select_chain_fold 63-75 ms on one huge stress function) sit inside a stage that is a small fraction of the total. Reusing a parsed standard library would remove about 690 ms of repeated work from every compile; nothing inside the NYIR optimizer can compete with it. The on-disk ny_std_cache_v11 entry already caches the assembled source text, so the remaining work is caching the parsed-and-typed result, which needs AST/diagnostic serialization the frontend does not have today.

cd's inner loop: the SCEV window is not the blocker

NY_TRACE_VECTORIZE=1 on the cd fixture reports, for the pairwise loop:

reject op=phi at cd.ny:40:10 reason=unsupported loop-carried PHI reject op=phi at cd.ny:42:13 reason=unsupported loop-carried PHI reject op=phi at cd.ny:21:7 reason=unsupported loop-carried PHI reject op=load.i64 at cd.ny:24:27 reason=address is not a payload+offset add chain tbuf affine: missing root/address v275 root=-1 offset=0 addends=v-1(none)/v-1(none)

No "variable trip count has no provable iteration window" reject appears for the pairwise loop at all, so scev_affine_bound on the PHI-derived initialiser (j = i + 1) is not what blocks it. The load address value v275 is not an ADD_I64/copy chain: its defining instruction has neither operand, so tbuf_address_parts cannot split it before any range proof is consulted. The loop also carries the if-converted hits += 1 counter as a conditional reduction, which the PHI classifier rejects.

Landing a SCEV change here would therefore move no fixture, so none was made: measured, not assumed. Unblocking cd needs the address-shape fix and conditional reduction support first, then the window question can be asked again.

Note that stdlib cost is only half of this fixture: 968 ms is the no-import floor plus standard library, and the remaining 860 ms pays for the fixture's own 41 lines through the frontend and the NYIR optimizer. A per-line cost that high is the more surprising half and deserves its own profile.

The landed runtime work carries no compile-time cost

Disabling the bit-assembly fold leaves radix at 1844 ms and disabling select fusion leaves it at 1795 ms, against a 1830 ms baseline (median of 5, cold caches). Neither knob is faster, so the runtime optimizations are not paid for in compile time.

2026-11-19 cd: what the address really is, and where the 860 ms goes

The address is a buffer-pointer fetch, not an element access. Adding the defining opcode to the existing trace line settles it:

tbuf affine: missing root/address v275 root=-1 offset=0 op=addr.symbol addends=v-1(none)/v-1(none) incoming=0

px is a module-level def ptr, so i64buf_load(px, i) first loads the pointer out of its symbol slot and only then forms add(payload, shl(i,3)). The vectorizer scans every load.i64 in the body, so it also meets that invariant pointer fetch, and tbuf_address_parts correctly refuses it: a symbol slot is not a typed-buffer access. Rejecting the whole loop over an instruction that is not part of the element stream is the defect; the fix is to treat the fetch as loop-invariant, which requires hoisting it (it is defined inside the loop, and the broadcast machinery only materialises values defined outside the loop), i.e. an LICM change rather than a vectorizer relaxation.

Even with that fixed, the pairwise loop still carries hits += 1 as an if-converted conditional reduction, so it would not vectorize. That is the second, independent blocker.

Why conditional reductions cannot be landed cheaply. NYIR has no vector compare, no vector select and no masked add: the vector op set is load/store/set1/add/sub/mul/reduce plus the f32/f64 forms. Lowering hits += (cond) would need a compare-to-mask op and a masked accumulate op threaded through the verifier (passes/validate.c), the const evaluator (lower/eval.c), the machine selector and x86 encoder (mach/arch/x86/machine64.c), the portable backend, and the LLVM emitter. That is a new opcode across eight files, not a vectorizer edit, and shipping it unverified would be worse than leaving the loop scalar.

Where the 860 ms actually goes. Verbose phase output for the radix fixture:

PHASE parse begin ... userbytes=1172 stdlibbytes=1000741 PHASE parse complete ast=program statements=77 errors=0 PHASE semantic-prepare begin statements=77 PHASE type-validation begin stages=HM,trait,ABI PHASE type-validation complete errors=0 failed_stage=0 (~1 s later)

A 1172-byte user program is compiled against a 1 MB standard-library source, and type validation spans a full second. The NYIR pipeline then costs 0.15-0.20 ms per pass per function, which is negligible for one function but is multiplied by every function reachable from the program: an empty main with the same three imports costs 968 ms, while radix costs 1828 ms, and the difference is largely the stdlib functions its body pulls into reach being optimized. So the cost tracks the reachable standard-library set, not the user's line count. The two real levers are therefore (a) cache the typed or optimized standard-library result instead of redoing it per compile, and (b) do not run the full pass pipeline over functions that only become reachable through dead branches -- both frontend/pipeline projects, not pass tweaks.

2026-11-19 why the unreachable-stdlib filter was not shipped

The optimization work is not concentrated in one place where a reachability mask could simply be applied:

src/code/lang/ny/lower/parts/stmt.h:15313 caps cross-function inlining at 512 functions (inline_func_count), and the post-inline re-optimization sweep at :15433 (sequential) and nyr_parallel_post_inline (:13936, used when nyr_build_parallel_enabled is true) re-runs the full pipeline over that whole prefix. The bodies are also optimized once when their lowering finishes (stmt.h:8248/:8344), before the callee registry exists.

A root set for "reachable from the user program" only becomes available when rt_main_out and the inline callee registry are built, i.e. after the first full optimization pass has already run over every function. Filtering the post-inline sweep alone would therefore save only the second pass, and only on the parallel path, where the cost is already divided by the core count; the wall-time driver -- the sequential first pass over every lowered function -- is untouched.

Doing this properly means deferring optimization of lower-priority bodies until the registry exists and then walking the call graph from rt_main, skipping any function with no incoming edge and no address materialization. Every such function is dead, so lowering it at opt level 0 is safe (worst case, lost optimization, never a miscompile). That is a change to lowering order, not a pass tweak, and it needs its own measurements; it was not written blind into a tree that already carries unrelated dirty work.

Escape hatches that would be needed: NYTRIX_NO_DEAD_FUNC_SKIP=1 to restore the old behaviour, and a NY_TRACE_REACHABILITY=1 report of the skip set so a wrong root set is visible rather than silent.

2026-11-19 six-fixture instruction budget (bench-gcc, NYR vs cc -O3)

Measured with ./make bench-gcc --ny page-rank matrix mandel lbm cd bigint-oracle on the current tree (dynamic instruction counts, not wall time):

fixtureNYRccratio
cd100.36M17.72M5.66x
lbm56.25M10.12M5.56x
matrix0.60M0.27M2.21x
mandel1.23M0.57M2.18x
page-rank0.43M0.23M1.90x
bigint-oracle----no cc toolchain on host

The two large absolute gaps are also the two largest absolute costs, so they are the only ones worth deep work first; the other four are under one million instructions and cannot move the suite average much.

lbm (56.25M): 200 steps x 94 x 94 interior points = 1.77M stencil evaluations, i.e. ~32 instructions each. The C build reaches 10.12M, ~5.7 per point, which is only achievable with 4-lane vector code. The loop body is (a[idx-W] + a[idx+W] + a[idx-1] + a[idx+1] + 4*a[idx]) / 8 with two clamps and one store, so an AVX2 form needs three unaligned loads at fixed byte offsets around idx*8 plus a signed max/min clamp. Everything is affine in idx; what is missing is a proof that the four neighbour offsets stay inside the same allocation for the whole lane window, which the current checker treats as dynamic offset out of proven bounds once idx-1 is consulted at the row edge.

cd (100.36M): 200 steps x (one 200-element movement pass + 19,900 pairwise comparisons + a 200-element counter pass). ~25 instructions per pair against gcc's ~4.4, which gcc gets from concentrating the two |px[i]-px[j]| < 8 tests into masks. NYR rejects it first on the buffer-pointer fetch (op=addr.symbol, an invariant load the vectorizer meets inside the body) and then on the hits += 1 conditional reduction, for which NYIR has no vector compare/mask op. Those two are the prerequisites, in that order.

Ranked next steps

Hoist loop-invariant loads out of loop bodies before vectorization (LICM), which removes cd's op=addr.symbol rejection and is generally correct for read-only loops. Teach the affine memory proof that a fixed neighbour offset (idx-1, idx-W) is safe when the row-window bound already covers idx, so lbm's five accesses share one proven window instead of rejecting on the smallest sub-offset. Only then add vector compare-to-mask and masked add for conditional reductions (cd's counter, viterbi's max). Re-check mandel: /1000 and /500 by non-power-of-two constants should already be magic-multiply sequences; 2.18x suggests the hot loop is still scalar because of the && guard rather than the division itself.

2026-11-19 cd resumed: the gap is vectorization, not scalar code

Resumed after the machine-encoder address-home fix (NYC now defaults to the machine encoder). cd's instruction count is unchanged at 100.36M against gcc's 17.72M (5.66x), as expected: that fix is C-object emission, and cd measures the NYR side.

The scalar pair loop is already near optimal. --emit-asm plus a loop-body scan gives 21 instructions per pair, and the two invariant px[i]/py[i] loads are already hoisted into r12/r13:

add $0x8,%r9 ; add $0x8,%rdx ; dec %rax ; je L mov %r12,%r15 ; sub (%rdx),%r15 ; mov %r15,%r8 ; neg %r8 ; cmovs %r15,%r8 cmp $0x7,%r8 ; jg L mov %r13,%r8 ; sub (%r9),%r8 ; mov %r8,%r15 ; neg %r15 ; cmovs %r8,%r15 xor %r8d,%r8d ; cmp $0x8,%r15 ; setl %r8b ; add %r8,%rcx ; jmp L

200 steps x 19,900 pairs puts the whole-program count at 25.2 instructions per pair including loop overhead. gcc's 4.45 is only reachable four pairs at a time, so no further scalar tuning can close cd; the gap is the pair loop's vectorization.

Why the vectorizer still refuses it. The trace names the blocker, and it is not the PHI:

tbuf affine: missing root/address v275 root=-1 op=addr.symbol reject pc=458 op=load.i64 at cd.ny:24:27 reason=address is not a payload+offset add chain

tbuf_payload_root accepts only rt_tbuf_new_{raw,typed_raw}, a private allocator, a COPY, or a PHI. i64buf_load(px, j) lowers to add(load.i64 addr.symbol(px), shl(j,3)), so the addend is a handle load from a module-level slot and no root is found. Accepting it is not sufficient on its own: known_alloc_bytes would then have to answer for a buffer allocated in the module initializer, which the vectorizer's per-function facts never see, so the transitive rejection becomes allocation extent unknown.

The remaining refusals are the loop-carried PHIs of i, j and hits (unsupported loop-carried PHI) and the movement loop's mod/store (unmodeled memory/trap effect remains in loop body).

Revised prerequisites, in order.

Make a symbol-slot handle load a payload root, and let the affine proof take its extent from the scalar bounds check that already resolved it (the lowered address carries NYIR_INST_F_IN_BOUNDS_ADDR), rather than from a per-function allocation fact. Widen the pair loop: the i/j inductions must leave the scalar PHI form and hits += predicate must become a masked add. Then the AVX2 form follows.

The earlier "hoist loop-invariant loads" step is not the blocker: the element loads are already hoisted, and the handle load needs classification, not movement. No code change was kept from this round - the root/extent work is a vectorizer change that has to land with its own differential checks.

Per-iteration measurements: viterbi and lbm, and the cd gate

Method for every fixture: extract the source ny block, ny -O3 -emit-only --emit-asm=..., assemble it, objdump, and locate backward-branch loop bodies.

viterbi is already vectorized. Its DP loop is 42 instructions per iteration and uses vpaddq, vpmuludq, vpcmpgtq and vblendvpd, i.e. four i64 lanes at a time plus a masked max. What remains is per-lane bookkeeping: vmovq/vpextrq/vextracti128 pull each lane out, four mulx sequences compute the remainder, and four vmovq/vpunpcklqdq/vinserti128 rebuild the next vector. viterbi's gap is the scalarized modulo inside the vector body, not missing vectorization.

lbm is still scalar. Its stencil loop is 20 instructions per interior point: five load/add for the neighbour sum, one lea, then seven for the signed /8 fixup (sar $63, and $7, add, sar $63, sar $3, andn), one cmp/cmovge clamp, the store, and the increment/test. Seven of twenty instructions are truncating-divide fixup, so lbm needs widening plus a cheaper form of that divide.

cd: the handle load, not the extent, is the gate. Accepting a symbol-slot handle as a payload root plus an IN_BOUNDS_ADDR extent proof was implemented and then reverted: it changed nothing, because the access the vectorizer refuses is the handle load itself, whose address is addr.symbol with no ADD chain. tbuf_address_parts rejects before the extent rule is ever reached, so that load has to be classified as loop-invariant and broadcast, not proven affine.

Masked compare-and-add is a new-opcode feature. NYIR's i64 vector set is LOAD/STORE, ADD, SUB, AND, OR, XOR, SHL, SAR, MUL (VEC8 only), SET1 and REDUCEADD; there is no compare, select or mask opcode. hits += (a < b) needs a mask-producing compare (mask lanes all-ones) that the existing VEC8SUB_I64 then folds into the accumulator (acc - mask adds 1 per true lane), plus recognition of the acc + zext(cmp) PHI update in the vectorizer and lowering on both backends. That work is not started and nothing unproven is in the tree.

2026-11-19 lbm: the neighbour-offset proof already works

The premise that the affine proof rejects idx-1 and idx-W is wrong on the current tree. NY_TRACE_VECTORIZE=1 prints a proven range for every one of the five stencil accesses:

tbuf affine: range address=v453 guarded=yes [8,72176] tbuf affine: range address=v448 guarded=yes [1544,73712] tbuf affine: range address=v443 guarded=yes [768,72936] tbuf affine: range address=v438 guarded=yes [784,72952] tbuf affine: range address=v433 guarded=yes [776,72944]

The allocation is 96*96*8 = 73728 bytes, so every max is inside bytes - 8 and every min is non-negative. The five neighbour offsets share one proven window and tbuf_affine_memory_safe accepts all of them.

The loop still does not vectorize, and the reject is a different one:

reject pc=541 op=add.i64 vf=4 reason=mixed i64 operand is not loop-invariant

That is idx = y*W + x: one operand is the vector IV and the other is an invariant computation (y*W) that is nonetheless defined inside the loop, so value_defined_in_loop classifies it as varying and the body is rejected. The broadcast path cannot absorb it because it materialises values in the loop preheader, where an in-body definition is not available.

So the blocker is loop-invariant code motion, not the memory proof: if y*W left the loop, the access would already be legal. That also means the same fix serves lbm and cd's invariant pointer fetch.

LICM does run and does hoist; the invariant operand still stays

LICM's own trace on lbm (with -vvvvv, which enables the heuristic channel) shows it is not skipping the loops: for the two inner loops it accepts 8 and 9 instructions and moves them into the preheader.

LICM loop header=b8 latch=b10 preheader=b7: positive-trip=yes LICM accept invariant @343 op=1 dst=v233 from b8: effects=0x0 LICM insert 7 instruction(s) for loop header=b8 into b7 at instruction 340 LICM loop header=b5 latch=b11 preheader=b4: positive-trip=no LICM insert 9 instruction(s) for loop header=b5 into b4 at instruction 327

So the earlier hypothesis that LICM never visits the loop is wrong. Something in the body survives the sweep and is still loop-defined when the vectorizer runs, and the vectorizer intersects that with "one operand of idx = y*W + x is not vector-valued". The trace only reports accepts, so identifying the surviving definition needs a reject-side trace (the candidate is rejected silently today).

Ordering is the other candidate: the address-hoisting phase of LICM (licm_allow_address_hoist, enabled for a second sweep at the end of nyr_licm) may run after loop_vectorize has already made its decision. Both possibilities are testable by moving the vectorizer later in the pipeline or by tracing the reject side; neither was guessed at here.

2026-11-19 pre-vectorize LICM phase: built, measured, reverted

I added nyr_licm_pre_vectorize (the address-hoisting phase nyr_licm defers until after vectorization) and ran it immediately before both the O2 and O3 vectorizer calls, with NYTRIX_NO_PRE_VECTORIZE_LICM=1 as an escape hatch.

Measured, same machine, cold caches:

lbm 56.25M instructions (unchanged) cd 100.36M instructions (unchanged)

No effect at all, so the phase was removed again rather than kept as a compile-time cost with no benefit. The vectorizer's reject only moved from pc=541 to pc=547, still mixed i64 operand is not loop-invariant, which means the offending operand is not the y*W hoisted by that phase.

The reject-side trace added alongside it did answer the question, and it contradicts the earlier hypothesis: for the surrounding loops LICM refuses candidates with effect, trap or address-shape rule refused it (ops 16, 3, 43, 21), and for the operand-driven ones it names the exact loop-defined value. So the surviving operand comes from an instruction that rule already vetoes, not from missing motion. The next step is to identify which opcode the vector reject at lbm.ny:34:17 is actually looking at -- line 34 is the + 4 * i64buf_load(a, idx) term, not the idx = y*W + x definition, so the earlier diagnosis pointed one line too high.

The reject trace itself is kept: it is codegen-neutral and it is what made the refusals legible at all.

Vectorizer: cloning an invariant in-loop sub-expression (negative, reverted)

Goal: let the lbm stencil loop vectorize. Its last reject is

pc=541 op=add.i64 at lbm.ny:34:17 reason=mixed i64 operand v359 (def op=shl.i64) is not loop-invariant

even though all five access ranges already prove out. The address parts are loop-invariant; the index expression mul/shl is not, because it is recomputed inside the body. So the pass was given a cloner: an invariant sub-expression (pure, non-trapping i64 ops, recursion depth 8, at most 32 clones) is rebuilt in the loop preheader, the in-body operand is rewritten to the clone's id, and the clone is emitted with the broadcast splats. A rejected loop rolls the operand edits back, and the spare-value margin (f->next_value 64) keeps the per-value tables indexed by synthesised ids.

It built cleanly and changed no codegen: the cloner never fired. The reject stayed byte-identical and lbm held at 56.25M instructions. Reverted rather than kept as an unverified path.

What the next attempt must pin down first: the gate and the cloner disagree on v359. value_defined_in_loop is true there (otherwise the reject text would not fire), yet the cloner declined the value. Either nyr_effective_effects on the shl.i64 is non-zero (so the purity test refuses it before the opcode whitelist is even consulted), or the operand recursion bottoms out on something outside the whitelist and the whole chain fails. Instrument the cloner's three declines (effects, whitelist, recursion) separately before building the rest of the machinery again - the rewrite/emission plumbing was never exercised, so it was never validated either.

Baseline after the revert (unchanged, ./make bench-gcc): cd 100.36M/17.72M 5.66x, lbm 56.25M/10.12M 5.56x, bigint-oracle 216.02M/40.76M 5.30x, matrix 0.60M/0.27M 2.21x, mandel 1.23M/0.57M 2.18x, page-rank 0.43M/0.23M 1.90x.

lbm stencil: SIB base from a stack home (negative, reverted)

With cloning ruled out, the next lever was the stencil loop's own encoding rather than its vectorization. The loop (lbm.ny:33-40) compiles to 33 instructions per iteration; here is where they go:

5 load, 1 store 6 address setup (3 spilled bases) 6 mov -0x218(%rbp),%rax ; mov (%rax,%r12,1),%r8 sum tree + *4 4 lea/lea/lea/lea divide by 8 (truncating fixup) 5 mov/sar $63/and $7/lea/sar $3 clamp 0..4096 12 mov,cmp,mov,cmovl,mov,cmp,mov,cmovg loop increment + branch 3

Three of the six address-setup instructions exist only because a loop-invariant base pointer computed by an earlier lea was spilled to a stack home and is reloaded through %rax on every iteration:

lea (%rcx,%r14,8),%rax mov %rax,-0x218(%rbp) ; preheader ... mov -0x218(%rbp),%rax ; per iteration mov (%rax,%r12,1),%r8

The home is the value's only copy, so [%rbp + home + index] is the same address as [%rax + index] after that reload, and the reload is redundant. Implemented as mach_sib_base_reg() in src/code/backend/mach/arch/x86/object64.c: mach_sib_query() grew an optional displacement out-parameter, and the four sites that staged a base through %rax (LEA path resident-index, LEA path r10-index, ADD path resident-index, ADD path r10-index) now ask for the frame base first, falling back to the reload when the caller cannot encode a displacement.

Measured result: no change at all - lbm still 56.25M instructions (56.25M -> 56.25M, i.e. 5.56x), so the fold never fired on this loop; and two etc/tests/lang/execution tests failed (65 -> 63). Both failures matter: a change that alters codegen without moving the metric and breaks tests is strictly negative, so it was reverted in full. etc/tests/lang/execution returned to 65/65 and etc/tests/code/targets/x86_64 stayed 166/166.

The lesson for the next attempt: the reload path is not the one mach_sib_query takes for this loop (the base operand's home is not visible as a plain spilled vreg there - most likely it is a colored value whose home is dual-written, which the fold deliberately excluded), so instrument mach_sib_base_reg before rebuilding it.

Remaining fat in the same loop, in decreasing size: the 12-instruction double clamp (six of those are pure register copies between the two selects' destinations), the 5-instruction truncating divide fixup, and the three per-iteration pointer reloads. The clamp copies and the reloads are both register-allocation outcomes (each select gets its own destination color; the loop runs out of registers for six pointers), so the next lever at this level is allocator coalescing rather than another addressing fold.

lbm stencil: instrumenting the frame-base fold (result: the fold cannot help)

The fold was re-attempted with tracing rather than guesswork. Two probes, both gated on NYTRACE_SIB_FRAME=1:

mach_sib_base_reg logged one line per decision with the operand kind, the vreg, its assigned preg, its home offset and the verdict. Every reload site logged where=<site> inst=<n> off=<home> vreg=<v>: mach_addr_base's vreg fallback and mach_load_op_rax's final mach_load_rax.

For the whole lbm compile the predicate was consulted only 32 times, all vreg-resident-or-no-home - never frame, never home. So the fold could not fire there. Meanwhile the loop's three base reloads show up as:

SIBRELOAD where=loadop inst=438 off=-536 vreg=346 SIBRELOAD where=loadop inst=443 off=-520 vreg=349 SIBRELOAD where=loadop inst=455 off=-552 vreg=343

All 48 reloads in the program come from where=load_op; none from where=addr_base. And at insts 438/443/455 there is no SIB_FRAME line at all: those base operands never reach mach_sib_query's four base sites. They are staged by a different caller of mach_load_op_rax that still produces a SIB with a resident index. That caller is the thing to instrument next (tag each mach_load_op_rax call site, not the reload sites).

Correctness signal, and the reason the fold is gone for good: with either variant (vreg-home only, and vreg-home plus FRAME) lbm's instruction count did not move at all - 56.25M -> 56.25M - while etc/tests/lang/execution failed two tests (65 ->

  1. on both builds, reproducibly. Trace coverage only covered lbm, so those tests fold somewhere else and miscompile there: the premise "the frame slot holds the base pointer at the access" does not hold in every case the predicate accepts. Two independent attempts, same result. Not re-attempted; if it is ever revisited, prove the premise per case (the slot must be the value's single, current home, not a dual-written or shared one) before emitting [rbp + slot + index].

After the revert: clean build, etc/tests/lang/execution 65/65, etc/tests/code/targets/x86_64 166/166, lbm 56.25M/10.12M 5.56x.

Where the next lbm win actually is: select destination coalescing

The 31-instruction inner loop still spends 12 on the double clamp and 3 on pointer reloads, and six of those clamp instructions are pure register copies between the two selects' destinations:

mov %rax,%r14 ; v -> select1 dst xor %r10d,%r10d cmp $0x0,%r14 mov %r14,%r15 ; select1 -> select2 dst cmovl %r10,%r15 mov $0x1000,%r10d cmp $0x1000,%r15 mov %r15,%r14 ; select2 -> store value cmovg %r10,%r14

Each select writes its own destination vreg, so the lowering/encoder needs a mov before each cmov. Fixing this means copy coalescing, not another addressing fold: mach_coalesce_copies in src/code/backend/lower/machine.c (around line 879) already coalesces the copies PHI destruction leaves behind, and coalesce_loop_edges in regalloc.c does the loop-edge equivalent. The chain here is v -> select1.dst -> select2.dst, where each link's source has a single use, which is the textbook coalesce case; the selects' destinations presumably conflict with a live range that spans both, so the pass declines. Instrument that pass's reject reasons first (it may already have a trace channel) and measure the inner-loop instruction count, not just wall time.

Coalescer and encoder probes on the clamp: three answers

(1) Why mach_coalesce_copies declined the clamp copies. Traced with NYTRACE_CC=1, which now reports one line per COPY inst with the first gate that refused it. lbm considers 173 copies:

139 why=src-not-vreg (constant materializations: mov $0x1000, ...) 30 why=synthetic-copy (sourcepc == UINT32MAX, refused outright) 3 why=not-raw (the clamp chain) 1 CC_MERGE

Nothing reached the interference or alias test: the gate chain refused every copy earlier. The three clamp copies are rejected by !m->c_abi && (!raw[d] || !raw[s])

  • mach_cc_raw_vregs marks them non-raw because their NYIR scalar class is not NYIR_SCALAR_I64_RAW. So the refusal is the Nytrix ABI's raw-i64 requirement, not a liveness conflict.

(2) Making it merge, and what it measures. Dropping that raw requirement (keeping the source_pc != UINT32_MAX requirement) changes the trace to CC_MERGE 3 plus one newly-visible why=interference, and the build stays correct (65/65 execution, 166/166 x86_64). It does not achieve the goal:

inner loop 31 -> 31 instructions lbm 56.25M -> 56.30M bigint-oracle 216.03M -> 215.70M

The three movs in the clamp are not COPY instructions at all. They are emitted by the encoder's select lowering (case NYR_MACH_SELECT), which materializes the else-arm into the select's own destination before the cmov; the destination vreg differs from the source, so a mov is required no matter how well copies coalesce. Removing them means encoding the select in place (write the cmov into the source register when the source is dead after the select), which is an encoder change, not a coalescing one. Reverted: no gain, and the drop is a global codegen change.

(3) Which caller stages lbm's spilled base pointers. Every mach_load_op_rax call site was rewritten to pass its own line number and the reload logged it. lbm's three base reloads all report:

LOA inst=438 site=13187 vreg=346 off=-536 LOA inst=443 site=13187 vreg=349 off=-520 LOA inst=455 site=13187 vreg=343 off=-552

Line 13187 is the LEA-elision path: the mach_sib_add_mem block that fills pending_sib_base/index/scale for the following load, in the branch commented "Only the base needs a scratch: keep the resident index" (mach_seed_colored_preg(index) then mach_load_op_rax(base)).

That is neither mach_sib_query (patched twice) nor mach_addr_base. Both frame-base folds were therefore placed in functions this loop never calls, which is exactly why they could not fire. A [%rbp + home + index] fold has to be made in this pending-SIB setup, where the base/index/scale triple is chosen - and its unsoundness must be re-proved there before it is kept.

State after reverting both probes: clean build, 65/65 execution, 166/166 x86_64, lbm 56.25M/10.12M 5.56x, bigint-oracle 216.02M/40.76M 5.30x, and object64.c back to the pre-probe diff (+76/-18, the select/clamp work).

Overhaul triage: which cited gaps are actually ours

Measured before touching anything, because two of the headline gaps are not compiler gaps at all.

currying (reported 31.85x NYR/LLVM): does not reproduce. Same host, same fixture, both sides rebuilt from the shape's embedded sources:

NYR elapsed 4027 ns (direct 1462, residual 1283, factory 1282) C elapsed 4589 ns (direct 1643, residual 1453, factory 1493) checksum 14017005 on both

The Nytrix binary is faster than the C reference and the whole program is a 4 us measurement. The recorded tables mark this fixture FAIL, so the 31.85x comes from somewhere other than the code path measured above - most likely a sub-10us timing floor or a failed-side artifact. Deprioritized until the harness explains the FAIL status; there is no codegen gap to chase here.

bigint-oracle (15.15x): a library comparison, not codegen. The C side of the shape carries optional_ldflags "-lgmp" and 61 mpz_/mpf_ references: the reference is GMP (hand-written assembly limbs, Karatsuba/Toom, Newton division and sqrt). The Nytrix side is core.math.big / bf_* in Ny. Equal performance here means implementing GMP-grade bignum algorithms in the standard library, which is a library project with its own benchmarks and checksums - not an instruction-selection or register-allocation defect. Kept out of the backend backlog deliberately.

native-oracle has no GMP references, so it stays on the codegen list; its recorded size (88 us vs 33 us) is close enough to the timer floor that it needs the same floor check as currying first.

Genuinely ours, with root causes already located from assembly:

fixturerecordedlocated cause
cd7.67xop=addr.symbol buffer-pointer fetch in the inner loop plus a conditional-reduction PHI; NYIR has no vector compare/mask/masked-add opcode
matrix5.05xscalar nested traversal; bounds math per iteration (bce-matrix notes in this file)
page-rank3.90xreduction loop over a pointer-chased graph
lbm3.66x31-instruction stencil loop: 12 for the double clamp (6 are select-destination copies), 3 for spilled base reloads, 5 for the truncating divide fixup
mandel1.52xwithin noise of the 1.2x goal; no cmov in main

What the select-copy pattern costs across fixtures (whole-program main segment, counted from disassembly): lbm has 2 cmovs and 2 copy-ins, both inside the hot loop (2 of 31 instructions, ~6%); cd has 10 cmovs and 2 copy-ins across 774 instructions; mandel and matrix have zero cmovs in main. So re-encoding selects in place is justified by lbm alone - it would not move mandel or matrix.

Net position of this session on the backend: three structural attempts (vectorizer clone, frame-base SIB fold, coalescer raw-gate drop) were built, measured and reverted because none moved a metric and two broke tests. The tree keeps only the earlier validated select/clamp fusion and the codegen-neutral proof diagnostics. The <=1.2x C target is not reached; the table above is the ordered work list, and each row needs its own assembly-level root cause before code is written.

currying: why the harness said FAIL, and why 31.85x was a timer artifact

Both parts resolved from the report data, not from the console.

The FAIL is historical. Across 113 stored reports, currying is ok 97 times, fail 10 and regression 6; every non-ok row predates 2026-11-16 and all of them have ny_failures or llvm_failures > 0. The six most recent runs are ok with ny_failures=0, llvm_failures=0, checksum_ok=True, ny_checksum == c_checksum == llvm_checksum = 14017005. bench_row_status only reports FAIL when a route actually failed, so there is no live FAIL to investigate - the FAIL line in the older measurements table is stale.

The 31.85x came from a 200ns sample. Latest row before the fix (bench-20261119-082255):

nynativems 0.004459 ms (4.46us of real loop work) nyllvmms 0.000140 ms (140ns - LLVM folds all three loops closed-form) cms 0.003326 ms (3.33us, real loops) nativellvmratio 31.85 nativeratio 1.34 llvm_ratio 0.042

llvm_ratio = 0.042 means LLVM ran 24x faster than C, which is the signature of elision rather than codegen; the shape's own comment predicts it ("the LLVM route sums each loop in closed form (~130ns)"). The harness accepted the ratio because bench_signal() gates at 100ns and 140ns clears it - by 40ns.

Fix (src/cmd/tools/test/runner.c). Added bench_ratio_signal() with a 500ns floor (5x the display gate) and used it for the ratio predicates instead of the display gate:

benchnativellvmcomparable : benchsignal(ny) && benchsignal(llvm) -> benchratiosignal(ny) && benchratiosignal(llvm) benchllvmccomparable : benchsignal(c) -> benchratiosignal(c) benchnativeccomparable : benchcandidatesignalforstartup(r, ny) + benchsignal(c) -> unchanged candidate rule + benchratiosignal(c) floorrow escape for NY/LLVM : r->llvmms > 0 -> benchratiosignal(llvm) && benchratio_signal(ny)

500ns and not 1us is deliberate: lbm's C reference measures 0.84us and must keep its ratio (4.71x), so the margin cannot be set above it.

Verified (./make bench currying native-oracle lbm matrix, report bench-20261119-083234):

currying ok ny=0.004468 llvm=0.000201 c=0.003336 | NY/C 1.34 v=True

NY/LLVM v=False

native-oracle ok ny=0.099000 llvm=0.322529 c=0.031238 | NY/C 3.17 v=True lbm ok ny=3.971433 llvm=3.171847 c=0.842877 | NY/C 4.71 v=True matrix ok ny=0.035666 llvm=0.015399 c=0.007204 | NY/C 4.95 v=True

The NYR/LLVM gap headline moved from currying (31.85x) to matrix (2.32x), i.e. from a 200ns artifact to a real sub-ms gap. Tests: 65/65 execution, 166/166 x86_64.

Note for future readings: the report's *_ms fields are milliseconds, so native-oracle's 0.099 is 99us, not 99ns - it is a genuine 3.17x, and only currying's LLVM side (0.000201 ms = 201ns) sat at the floor. Units caused a false lead during this investigation; the floor check is now explicit in code.

2026-11-19 compile-time: Standard library parsed AST reuse (NYTRIX_STD_AST_CACHE)

Motivation: Compiling any program that imports core paid ~95-100 ms every compilation concatenating, lexing, and parsing 996 KB of standard-library source text, even when compiling repeatedly or running multiple passes in-process.

Implementation (src/code/lang/ny/pipeline/init.c, src/code/lang/ny/parser/stmt/comptime.c): Introduced in-process parsed standard-library AST cache (NYTRIX_STD_AST_CACHE, enabled by default; opt-out with NYTRIX_STD_AST_CACHE=0). On the first compilation requiring standard library, parses the full stdlib source once into a dedicated immutable arena (g_std_ast_cache.prog) and caches parser registries (ct_layouts, ct_modules, ct_templates, ct_decls, ct_diag_rules, type_aliases, gensym_counter). On subsequent compilations within the same process, skips reparsing the 996 KB source. Deep-clones cached AST statements into the per-compile arena via ny_ast_clone_stmt (ct_clone_stmt), ensuring semantic analysis and codegen mutations never corrupt the pristine cached AST. Seeds the fresh compile's parser registries directly from the cache.

Measured results (--native-backend x86_64 --profile-time --runs=5): test_use_core.ny (use core; fn main() { 0 }): Before: 0.905s / 0.810s / 0.802s / 0.792s / 0.800s (mean 0.822s, min 0.792s) After: 0.936s / 0.765s / 0.761s / 0.744s / 0.654s (mean 0.772s, min 0.654s, -138 ms / 17.4% faster) lbm.ny: Before: 0.912s / 0.830s / 0.810s / 0.830s / 0.812s (mean 0.839s, min 0.810s) After: 1.019s / 0.796s / 0.781s / 0.761s / 0.744s (mean 0.820s, min 0.744s, -66 ms faster) Zero test regressions across etc/tests/lang/execution/ and etc/tests/bench/numeric/.

2026-11-19 cd: the address is a direct addr.symbol, and the loop dies before the load

tbuf_address_parts now dumps the defining chain of a refused address under NY_TRACE_ADDR_CHAIN=1 (codegen-neutral; it only feeds the trace). For cd:

nyir addr chain: value=275 op=addr.symbol a=-1 b=-1 c=-1

So the refused value is a bare symbol-slot address, not a copy or rebuilt expression: the earlier premise that the address resolves through COPY hops was wrong, and the three classification predicates tested earlier could never match for that reason alone.

Line attribution matters here, and an earlier reading of this trace got it wrong. NY_TRACE_VECTORIZE=1 reports both of these in the movement loop (cd.ny:23-37), not the pairwise loop:

reject pc=458 op=load.i64  cd.ny:24:27   reason=address is not a payload+offset add chain
reject pc=438 op=store.i64 cd.ny:32:20   reason=unmodeled memory/trap effect remains in loop body

24:27 is the px handle fetch inside x = i64buf_load(px, i) + ..., and 32:20 is i64buf_store(px, i, x). The store is refused with the generic effect reason because vector_memory_affine could not find a payload root for its address; the root failure is the handle fetch one scan earlier, so both are the same blocker. The pairwise loop (cd.ny:40-50) is a different set of refusals (pc=436/453/543/557, PHIs of step, i and the j/hits recurrence).

There is therefore no memory-resident hits reduction to model: hits is a loop-local (mut hits = 0, cd.ny:38) and the pairwise loop contains no symbol-slot store at all. The work that would move this fixture is (a) treating the invariant load.i64 addr.symbol(sym) handle fetch as a loop-invariant broadcast with a preheader reload, then (b) the pairwise loop's PHIs and its conditional count reduction. Fact (a) is the same conclusion as before, now with the correct line numbers; the hits-in-memory hypothesis is retired.

2026-11-19 the suite's two alarming rows in the last full run are contention artifacts

The 11:48 full run printed mandel 13.98x and ackermann 36.56x, which would be the two worst NYR/C rows in the suite. Re-measured standalone, same tree, same fixtures:

mandel      NYR 121 us   LLVM  89 us   C  75 us   NYR/C 1.61x  NYR/LLVM 1.35x
ackermann   NYR 108 us   LLVM 111 us   C  40 us   NYR/C 2.67x  NYR/LLVM 0.97x

For mandel the harness reached the same conclusion inside the run itself: its confirm pass re-measured 141 us against LLVM's 107 us (1.88x), so 13.98x was a first-sample flake under 25 concurrent workers, not code.

ackermann's C reference is constant-folded (the clang build of the reference contains 14 instructions in main and never calls ack), while NYR executes the recursion; 2.67x is the floor that comparison can produce, and the earlier 36.56x was the same flake on the NYR side (1.85 ms instead of 108 us).

Consequence: both rows are excluded from any "slowest" work list, and no gate was affected - all seven per-class gates passed in that run.

2026-11-19 cd: the window that is missing belongs to the init loop, not the movement loop

Both "give the movement loop a window" and "broadcast the handle fetch" were checked against the trace before writing code, and the trace already answers the first one: the movement loop's reject is

reject pc=458 op=load.i64 cd.ny:24:27 reason=address is not a payload+offset add chain

tbuf_affine_memory_safe reaches the address chain only after vector_memory_affine has passed the window_trip > 0 gate, so the movement loop has a proven window (i = 0 on cd.ny:22 gives the lower bound, N the upper). The only window-less loop is the init loop, whose reject is the window reason itself. Experiment separating the two halves of the window: the init loop's limit replaced by a literal,

while i < 200 {        ; was: while i < N {

and the reject is unchanged (pc=322 ... no provable iteration window), so the missing half is the entry value, not the limit. i is initialised by the module-level mut i = 0 on cd.ny:10, so the loop reads its IV from a symbol slot and init_unknown is set with no range fact to substitute. Bounding it needs memory-SCEV over the slot (a stored-constant range on the definition feeding the load), which the pass does not have.

Consequence: no vectorizer change was made for either request. The movement loop's remaining blocker is the handle-fetch root, and the init loop's is memory-SCEV on the IV the second being the cheaper of the two and worth having independently of cd, since any loop entered with a module-level counter hits it.

2026-11-19 VRP read-only slot ranges: built, fired on nothing, reverted

The plan was to give def N = 200 and module mut i = 0 a range fact in nyr_vrp, so cd's init loop would get the lower bound its window is missing. The patch was written and built: vrp_ro_slots collects, per function, each addr.symbol whose address never escapes (vrp_symbol_address_confined: every use of the address value must be the whole address of a load or store) and which the function writes exactly once with a constant (nyr_const_i64), then case NYIR_LOAD_I64 publishes [k,k] for a load from such a slot instead of top.

Result: cd is byte-identical. Same 10 rejects, same checksum= 387, and the init loop still reports pc=322 ... no provable iteration window. A control run with the function-level NYIR_CALL bail removed was also identical, which rules out the call guard as the reason nothing fired.

Remaining explanation: the consuming function does not contain the single store. Module-scope definitions are materialised by the module initializer, a different function, so a per-function scan sees zero stores to N's slot, and mut i's slot is written by the loop that reads it (two stores). The fact therefore has to come from the initializer data, not from a local store scan - VRP is the wrong pass for it.

Nothing is shipped: vrp.c was restored to HEAD (git diff empty for it) and the tree rebuilt clean. Recording it because "publish the range of a single-store constant slot" is the obvious first idea for this gap and it does not work on this lowering.

2026-11-19 why a symbol-to-initializer table cannot bound a memory-carried IV

The follow-up to the reverted VRP attempt was to expose a symbol-to-constant-initializer table from lowering. Reading the consuming path shows the table cannot deliver the fact, independently of where it is built:

VRP publishes exactly one range per SSA value (in->range on the defining instruction), not one per program point. A load's published range therefore holds for every execution of that load. cd's init loop carries i in a module slot that the loop itself writes (i += 1, cd.ny:16). Any initializer the slot ever had is false from the first iteration on, so a whole-function range for the load would be wrong, and a table cannot fix that: the table describes the slot's state, not the slot's state at this load. The other candidate, def N = 200, is already constant-folded by the front end (replacing the limit with a literal 200 left the reject unchanged), so no table is needed for it.

What the window actually needs is the value at the loop's preheader, which is a reaching-definition question: resolve the IV's entry load to the unique store that reaches the loop header, and use that store's constant. That is per-loop memory SCEV inside the vectorizer's window computation, not a fact the front end can hand over.

Consequence: no table was added, and vrp.c stays at HEAD. The next attempt should be loop_vectorize.c: when init_unknown, walk the load's symbol back to the dominating preheader store, and use its constant for w_lo only if it dominates the header and no other store to that symbol lies on any path into it.

2026-11-19 loopvectorize vectorslotentryconst: the memory-carried IV now gets an entry bound

loop_vectorize.c resolves an entering IV value that has no SSA constant by looking at the slot it is loaded from: vector_symbol_of_address names the addr.symbol, and vector_slot_entry_const scans back through the load's own block for the nearest store to that slot, accepting it only when no call sits between the store and the load and the stored value is constant. Within one block the earlier store decides the load, so no CFG dominance proof is needed, and a call could only reach the slot through an escaped address the scan cannot see, hence the bail. The constant becomes init with init_unknown = false, which is exactly what the window computation needs for w_lo.

cd's init loop, before and after (trace, caches off):

before: reject pc=322 op=load.i64 cd.ny:12:17 reason=variable trip count has no provable iteration window
after:  reject pc=322 op=load.i64 cd.ny:12:17 reason=address is not a payload+offset add chain

The window opens; the loop now fails on the handle fetch, the same root blocker as the movement loop. checksum= 387 unchanged, and the fixture timing is flat (cd 7.08 ms NYR / 7.28x in the full suite) because nothing in this loop vectorizes yet - the change is a precondition, not a win on its own.

Full suite after the change: exit 0, no budget misses, all seven class gates pass, overall NYR/C 1.42x / LLVM/C 1.18x / NYR/LLVM 1.21x. Earlier runs of the same tree measured 1.32x-1.46x overall, so the fixture-level movement here is run-to-run spread; only the window reject is a definite change.

Audit of the same reject across etc/tests/bench (source extracted per fixture, trace on): the window is still unproven in 30+ fixtures - page-rank 11, expression-tree 12, mont64 10, pbkdf2 9/6, sha256 7, richards 7, list/splay/list-dynamic/list-any-append/dict-set/radix-tree/ bigint-oracle/doitgen 7 each, mandelbrot/spectral/fft/linpack/ matrix-raw/dgemm/sssp/deltablue/float-cmp-oracle 4 each, sieve 3, dijkstra/dict-oracle/dict 2, fannkuch/euler9 1. Those are loops whose entry value crosses a block edge (so the block-local rule refuses it) or whose IV genuinely varies per outer iteration; each needs the CFG-dominance generalisation of this rule before it can be retried.

2026-11-19 cross-block entry bound: the preheader store is found through the CFG

The block-local scan could only see a store to the same slot in the load's own block. vector_slot_entry_const now also takes the cross-block case: if the load sits in a block with exactly one predecessor, that predecessor is the only way in, so a constant stored in it - with no call after the store - is the value the load reads. No dominance query is needed for that shape, because a single predecessor rules out a second path on which another store could intervene; the dominator bitsets (nyr_cfg_dominates) are the generalisation for blocks with several predecessors and are not used yet.

cd, same trace, caches off:

block-local only:  10 window rejects   (pc=322 window opened, 9 elsewhere)
cross-block added:  0 window rejects

checksum= 387 unchanged. The loops still do not vectorize - they now stop at the handle fetch (pc=322, pc=458 both address is not a payload+offset add chain) and at the pair-loop PHIs (pc=543, pc=557, unsupported loop-carried PHI), so cd is timing-flat at 7.09 ms / 7.17x in the full suite.

Verification: full native suite etc/tests/lang 1472/1476 passed; the four failures are lang/types/proofs/__v* (one prover assertion, three 420 s prover timeouts), all in a directory that is dirty with unrelated in-progress proof work and all failing before codegen. ./make bench exit 0, no budget misses, all seven class gates pass (overall 1.31x C, 1.20x LLVM).

Re-audit after the rule: 39 fixtures still report no provable iteration window, 209 rejects total, concentrated in page-rank 11, mont64 11, expression-tree 10, pbkdf2 9+6, licm 8, and 7 each in sha256, richards, splay, list, list-dynamic, list-any-append, dict-set, radix-tree, bigint-oracle, doitgen, json-parser, omnetpp, qrsyndrome, stringsearch. Those remaining loops take their entry value from a block with several predecessors, or their IV changes per outer iteration.

2026-11-20 radix-tree, bitcount, Ackermann, and BigInt

Numbers below are whole-process retired user instructions from three runs of the embedded fixture sources, with the corresponding object code inspected. The host was also running a separate kernel build during some samples.

Fixture and routeBeforeAfterChecksum
radix-tree, NYC198.80 M32.44 M62531
bitcount, NYC270.68 M69.36 M134217488
ackermann, NYC, revised input693.32 M599.26 M226800
ackermann, NYR, revised input662.23 M630.80 M226800
bigint-oracle, NYR168.07 M166.63 M1968365

radix-tree now recognizes the C frontend's width-normalized induction and branch PHI. Each 20-step walk becomes a mask and an OR. The fold requires a descending bit window through zero, an invariant key, and a single exit. Standalone Clang retired 11.74 M instructions. NYC's remaining lookup includes the signed remainder sequence and home traffic. bitcount now recognizes the C frontend's redundant truncation after unsigned subtraction and emits popcnt in the hot loop. The final low-word mask is required before replacing the SWAR sequence. ackermann now has a runtime input and carries the prior result into the next call's depth. Clang retains the recursive call. The machine scheduler moves the decrement after the recursive call and keeps the old value live until the call, so the loop update can use the same register. bigint-oracle uses hardware division for up to four Knuth quotient limbs on supported x86-64 builds. The focused instruction count improved by 0.85%. Elapsed time in the interleaved samples was within host variation. The full suite measured 29.4 ms NYR and 30.0 ms LLVM against GMP at 3.65 ms. The vectorizer now checks every path into a symbol-slot entry load, keeping a constant only when all paths agree and no unknown store intervenes. page-rank window rejects fell from 11 to 3 and mont64 from 11 to 7. Both still have scalar loops and their checksums match. The memory proof accepts disjoint byte ranges within an allocation and retains scalar code for overlapping streams. The bounds check remains in an untransformed loop and in its scalar tail. stream already used a four-lane vpmuludq sequence on NYR. Disabling that path raised retired instructions from 95.14 M to 179.03 M at checksum 471845615. This comparison verifies the existing vector route.

2026-11-20 single-limb BigInt division

Single-limb division now writes the quotient directly into its managed result. When the high limb would produce zero, it becomes the initial remainder instead; the result needs one fewer limb. For power-of-two divisors the limb loop uses shifts and a mask, including when fused multiply/divide overwrites its input buffer. Other divisors keep the existing hardware or portable division path.

On bigint-oracle, interleaving two sets of three native AOT runs per variant, with the same compiler, source, and other runtime inputs, retired instructions fell from 166.67 M to 166.35 M (0.19%). Cycles fell from 62.26–62.32 M to 59.94–60.15 M across the two sets; elapsed samples overlapped. Every run returned checksum 1968365. The native AOT bigint-short-arithmetic oracle passed, including signed quotient and remainder, limb-boundary cases, and fused in-place division.

2026-11-20 native optimization notes

Historical measurements below describe the compiler at the time of each investigation. To close a current gap, reproduce a focused fixture, compare retired instructions and the timed object code at the same checksum, then check the complete benchmark report. Allocation-heavy wall times on this host can be bimodal. The November 20 full run passed all seven configured gates without execution or checksum failures; those gates do not establish the per-fixture ceiling.

cd: 100.4 M NYR instructions versus 12.7 M C, checksum 387. The scalar pair loop already hoists px[i] and py[i]; it runs about 25 instructions per pair versus C's vectorized 3.2. The remaining vectorizer rejects are the typed-buffer handle load (not a payload-plus-offset address) and the conditional hits recurrence. viterbi: 53.9 M versus 9.1 M instructions, checksum 3270530. Another loop already vectorizes, but the DP loop has carried PHIs and an unproven affine load. The running max is a select. Of the carried rejections, 2,706 were immediate folds, 2,514 unavailable colors and 462 vector-unsafe colors. All vector-unsafe colors were caller-saved scratch registers (r8, r9, rcx, rdx); this did not remove any otherwise viable home. The signed % 101 correction persists because the local value analysis does not track the recurrence's range. mont64: 74.8 M versus 22.4 M instructions, checksum 114319663. The fixed-trip limb loop already unrolls and uses two-address arithmetic. Its typed-buffer stores still force pointer home reloads and spill the limb accumulator. Scalar replacement and alias-aware residency remain better targets than another unroll. fhourstones: 25.16 M versus 7.40 M instructions, checksum 6010. Samples split 67% search / 28% won. Increasing the pressure-CFG ceiling let won inline (155 instructions) but retired instructions only fell to 24.46 M, so the change was reverted. Single scalar board-scan comparisons account for 31% and 47% of samples within those functions. bitcount: the original scalar SWAR loop took 74.8 M versus 31.5 M instructions at checksum 134217488. Both native front ends now emit scalar popcnt; C still uses vector lanes and a four-byte layout versus Ny's eight-byte layout. The pre-POPCNT loop rejected on its induction, load proof, and non-invariant mixed operand. nussinov: a declared bool returns a canonical tagged value. Using != NY_IMM_FALSE instead of generic truthiness dropped instructions 120.7 M → 98.4 M and cycles 33.65 M → 26.75 M, checksum 100. Focused wall time moved from 3.13× to 2.29× C. lang/execution passed 65/65; the full language run passed 1472/1476, with four proof timeouts. stream: NYR already emits a four-lane integer multiply. ackermann now feeds a runtime-dependent argument into the recursion on both sides, and the native scheduler sinks its loop decrement past the call. towers benefited from shrink-wrapping and reusing parameter slots; five callee-save pushes remained per non-base call in the sampled route. bce-matrix, dijkstra, sssp, qrsyndrome, permute, nqueens and gcbench showed loop-home traffic or allocation cost. The observed permute inner loop was still rolled at 10 trips. currying allocated a closure and called indirectly for each partial application. bigint-oracle: optional_ldflags links the C reference to GMP. The cost is in the arbitrary-precision library, not NYC compiling the GMP driver. Registry lookups, repeated classification, and allocation-side mapping registration are leads, not permission to bypass pointer validation or stop registering ranges needed by the decoder.

2026-11-20 vector accumulator unrolling

The native vectorizer can now unroll small fixed-trip integer reductions whose accumulator stays in vector registers. It chains each cloned chunk to the preceding one and keeps the horizontal sum on the exit. It selects four chunks when the trip count is divisible by four vector widths, two when divisible by two, and keeps the existing tail handling otherwise. The timed NYR bce-matrix object uses four packs per branch; three of the four packed adds take a memory operand directly.

bce-matrix routeRetired instructions beforeAfterChange
NYR41.34 M22.14 M−46.4%
NYC102.72 M84.80 M−17.4%

The focused five-sample runner measured 1.11× NYR, 1.67× LLVM, and 2.38× NYC vs host C, checksum 14439925760000 on all routes. NYC still uses 128-bit packs and stores short-lived loads to frame homes; the instruction win is not parity. The vector metadata backend test passed.

For a tail-free wrapping reduction of value + invariant, the vectorizer now adds trip_count * invariant once at the exit rather than once per element. The original add must have no other consumer; variable-trip loops and loops needing scalar tails retain their existing behavior. On bce-matrix, retired instructions fell further to 17.02 M NYR and 64.32 M NYC. A separate seven-sample run against Clang measured 1.37× NYR, 1.98× LLVM, and 3.50× NYC, with the same checksum. Do not compare those ratios directly to the earlier run: the host reference and sample timings differed.

The serial GCC-reference run after accumulator unrolling and before the invariant fold completed 109 fixtures without execution or checksum failures and passed all seven existing gates. The optional thread-ring fixture was run separately against Clang: 1.11× NYR, 1.11× LLVM, 0.89× NYC; checksum 1000 on all routes. Among valid comparisons in the GCC run, 26 NYR, 19 LLVM, and 37 NYC results were still above 2×. The largest sustained gaps included cd, bigint-oracle, lbm, and matmul-int; short-reference outliers included NYC dce and all routes on knight.

Outlining BigInt operand coercion in Ny was tried separately and reverted. bigint-oracle retired 166.36 M → 168.31 M instructions at checksum 1968365, with no consistent elapsed improvement. The compiler still emitted the cold coercion inline in the arithmetic wrappers.

2026-11-20 BigFloat division sticky bit

BigFloat rounding needs to know whether the division remainder is nonzero, not its magnitude. The runtime now tests the normalized remainder in place, borrows the immutable denominator, and packs quotient words without a zero-and-OR pass. This removes the scratch remainder object, including its heap allocation at higher precision.

Using the same compiler and runtime inputs except for bigfloat.c, with a fresh temporary runtime cache, bigint-oracle retired 166.36 M → 165.34 M instructions (−0.61%) in interleaved native AOT runs. All runs returned 1968365; wall times varied under concurrent load. The native AOT bigfloat-padding and bigfloat-differential oracles passed, including unequal-precision inputs and rounding.

2026-11-20 managed-pointer cache generation

The heap registry's writer lock already serializes generation changes. Publishing with a release store removes a second locked update without changing pointer membership or the reader's acquire check. A four-reader stress run verified 768,000 cross-thread cache transitions per polarity. Four interleaved AOT samples of bigint-oracle matched checksum 1968365; retired instructions stayed at 165.34 M, and median cycles went from 60.50 M to 60.22 M. The wall-time change was within sample variation.

An exponent-based BigFloat integer decoder was tried and reverted. bigint-oracle retired 165.34 M → 163.40 M instructions, but median cycles increased from 60.07 M to 61.80 M and every measured kernel sample was slower. Checksums and the padding and rounding tests passed.

2026-11-20 integer reductions with scalar tails

The vector accumulator now seeds the scalar tail with one horizontal sum at the vector exit. The seed is preserved even when the vector prefix has zero iterations. The x86-64 encoder uses VEX.128 packed instructions for the horizontal sum on AVX targets instead of alternating between AVX and legacy SSE inside the loop.

A separate 9,999-element reduction with a nonzero seed and changing addend diagnosed the two costs independently. All three NYR artifacts returned 14438471528459; three interleaved samples per variant:

NYR variantMedian retired instructionsMedian kernel time
Per-chunk legacy SSE reduction92.56 M417.9 ms
Per-chunk VEX reduction72.12 M4.85 ms
VEX reduction once before the scalar tail41.40 M4.77 ms

The original object has vextractf128 followed by legacy paddq and pshufd in the hot body. The final object keeps only packed adds in that body and uses vpaddq/vpshufd at the exit. Runtime-bound reduction tests cover empty loops, scalar-only loops, exact vector prefixes and nonempty tails. The AVX-only and forced legacy encoder oracles passed. This diagnostic does not change the bce-matrix benchmark workload.

2026-11-20 LLVM FFT and the startup oracle

The timed FFT loop already had raw floating-point operations in LLVM IR. Its first rt_cos_f64 call loaded and resolved libm after the first timer read. Preloading libm reduced the old AOT kernel from a median of 124.9 µs to 28.5 µs without changing the code or checksum. Raw LLVM sine and cosine now call libm directly; AOT supplies the dependency only when the module references it. The AOT disassembly calls cos@plt and sin@plt.

LLVM routeBeforeAfterClang reference
MCJIT281.0 µs27.0 µs14.0 µs
AOT165.8 µs17.7 µs14.0 µs

Seven pinned runs per variant, interleaved; checksum 1423277954. The separate five-sample benchmark reported 0.84× NYR/C, 1.45× LLVM/C and 0.94× NYC/C. The float ABI fixture and ORC FFT passed.

native-oracle reported NOISY and has no kernel timer. LLVM IR contains the literal 832040, not the Fibonacci loop; the corresponding assembly formats and prints it. The large ratio is not evidence of a slow Fibonacci loop. Its integer-only AOT executable still has no libm dependency.

2026-11-20 collision, bignum, and repeat diagnostics

cd: NYR already hoists the outer px[i] and py[i] reads. In the inner loop, LLVM IR and NYIR still express signed absolute differences and conditional hit counting; Clang emits packed compares and accumulates counts in registers. Folding the two NYR short-circuit guards into an eager scalar and increased retired instructions from 100.47 M to 136.21 M and median time from 7.15 ms to 9.25 ms across five pinned samples. Reverted; the packed reduction, not scalar speculation, is the remaining opportunity. Every run returned 387. bigint-oracle: assembly and sampling place the cost in object allocation, pointer membership, limb decoding, and multi-limb division. GMP reuses its destination objects. A split hit/miss generation added 4.08 M retired instructions to the 165.34 M baseline with no wall-time improvement. Skipping repeated normalization in compare and splitting the carry/borrow loops left instructions and cycles essentially flat. Deferring limb decode output stores retired 166.21 M instructions and slowed all seven pinned samples. All three experiments returned 1968365 and were reverted. repeat: the LLVM IR calls rt_str_repeat_raw; sampled AOT assembly spends most kernel cycles in libc's AVX memcpy, not checked element access or extra zeroing. The unchanged fixture ran within 2× in isolation (NYR 1.12×, LLVM 1.27×, NYC 1.48×); the full parallel run's higher ratios have not been cleared in a complete rerun.

2026-11-20 NYC PBKDF2 low-word encoding

Samples placed 89% of NYC's retired instructions in SHA-256 compression. NYIR had already found the 32-bit rotates and masks. The machine encoder now omits the extra zero-extension after a known nonzero immediate rotate, and lowers an exact low-word mask on its accumulator path to a register zero-extension instead of an AND from a stack slot. Dynamic rotate counts retain the explicit zero-extension.

Five pinned, interleaved samples retired 60.57 M → 58.26 M instructions and took a median 9.88 ms → 9.52 ms. Both PBKDF2 fixtures returned 2991, and the x86 masked rotate oracle passed. Clang took 1.17 ms in separate pinned samples; stack traffic in the compression loop remains open.

2026-11-20 signed constant divisors in machine IR

qrsyndrome already had literal divisors 200 and 255 in NYIR, but its object used three idiv sites: register lowering obscured those constants before instruction selection. x86-64 machine IR now keeps signed constant divisors as immediate operands, so the object encoder can select its existing reciprocal multiply-and-shift sequences. The machine route accepted the changed shape and the resulting object contained no idiv.

Five pinned, interleaved samples of the unchanged fixture returned 1161080. NYC median kernel time fell from 16.85 ms to 10.84 ms and cycles from 48.21 M to 30.45 M. Retired instructions rose from 56.15 M to 75.82 M: the reciprocal sequences perform more, cheaper instructions. Clang took 5.23 ms in the same sample set. The signed magic, dependent divmod, and power-of-two division fixtures passed all ten variants.

2026-11-20 rounding under a nonnegative clamp

The NYC LBM inner loop implemented signed division by eight with a sign mask, bias add, and arithmetic shift, immediately before clamping negative results to zero. Both rounding modes give the same clamped result. Strength reduction now emits the shift alone when neither the quotient nor the comparison has a consumer outside the clamp.

Five interleaved pinned samples on the unchanged fixture returned 152700. NYC median time fell from 8.96 ms to 8.26 ms and retired instructions from 64.30 M to 57.23 M. The new boundary oracle also checks negative inputs whose truncating quotient is zero and an independently consumed comparison. Clang vectorizes the stencil; this does not close that remaining gap.

2026-11-20 post-fix Clang-reference run

The local O3 run used six fixture workers, one warm-up and three measured runs. All 110 fixtures matched their checksums. FFT stayed below 2× on all three routes (LLVM 1.92×), as did qrsyndrome (NYC 1.62×). The 2× ceiling remained open: 20 of 108 valid NYR comparisons, 16 of 108 LLVM comparisons, and 31 of 109 NYC comparisons missed it.

The largest timed gaps were cd (12.66× NYC, 9.05× NYR), pbkdf2 (8.10× NYC), and bigint-oracle (7.48× NYR, 6.77× LLVM). native-oracle also showed a 17.98× LLVM ratio, but its Fibonacci work is constant-folded and it does not have a kernel timer.

The emitted bigint-oracle machine code also showed unused rt_len and rt_value_tag results in the BigFloat arithmetic loops. They originate in the compiler-generated length/tag lanes of the dynamic call ABI. The ordinary runtime effect annotations remain intact: an unused compiler-generated lane is a different case from an explicit query. For page-rank, both native emitters reload and store the accumulator on each iteration, whereas Clang holds it in an XMM register and stores it once. The two array bases swap on the backedge, so sinking the store requires a disjointness proof that survives that swap.

An isolated NYC outer-AVX2 trial of binary kept checksum 3360874588549334 and reduced the five-sample median from 6.21 ms to 3.60 ms; Clang took 1.05 ms. The emitted code still had 199 YMM frame-access sites. The trial did not change NYC's default target policy.

2026-11-20 dead dynamic call metadata

ADCE can now remove unused compiler-generated length/tag queries after inlining. Live metadata and explicit source queries keep their existing effects. In bigint-oracle, the native AOT entry's static rt_len and rt_value_tag call sites fell from 29 to 7. Five pinned, interleaved samples returned 1968365; median retired instructions fell from 166.21 M to 149.49 M, cycles from 83.43 M to 75.35 M, and kernel time from 43.92 ms to 40.93 ms. Eleven BigFloat and dynamic ABI fixture variants passed. This change was measured after the full run above.

2026-11-20 collision and SHA hot loops

LLVM now receives byte GEPs for typed-buffer accesses with integer-only offsets. Its optimized cd IR uses a four-lane reduction and the x86 code uses vpcmpgtq/vpsubq. NYR and NYC instead use neg; cmovs for the scalar wrapping absolute values, including INT64_MIN. With Clang 23.1.5, the focused cd run (checksum 387) took 5.84 ms NYR, 1.56 ms LLVM, 9.26 ms NYC, and 0.932 ms Clang. LLVM is now 1.67× Clang and NYR/LLVM is 3.74×, below the existing 5× fixture limit.

In pbkdf2, straight-line inlining no longer splits the SHA schedule and round blocks; narrowing removes internal low-word masks only when all uses ignore their high bits. The numeric fixture's five pinned samples went from 9.46 ms to 8.66 ms and from 58.26 M to 52.33 M retired instructions. Both NYC fixtures still returned 2991 and remain above 7× Clang. The collision workloads and benchmark limits were not changed.

2026-11-20 vectorizer rejection histogram

The vectorizer now aggregates reject reasons by source file when NY_TRACE_VECTORIZE=1 or heuristic tracing is enabled. A focused sha256.nshape compile emitted six reject events attributed to the fixture source: five unsupported loop-carried PHI and one no canonical +1 induction PHI. The trace also included imported library functions, which remain separately attributed by their source paths. Compiling the same source with tracing enabled and disabled produced byte-identical ELF files (SHA-256 94c45beb9cbe8ef5de8fff56bd4d888710576bf49e9663db5575796fad376c7f). This is diagnostic evidence only; it does not establish a runtime speedup.

2026-11-20 compile phase timing

Added opt-in --stats timing for NY and NYC compilation. On one focused run, NY's sha256.ny compile reported 2.134 s total in the phase timer versus 2.244 s external process wall time. NYC compiling the 1,428-line src/code/test/lang/c/translation-unit.c reported 74.975 ms versus 77 ms external wall time (181 functions and 69 data symbols). These are one-run instrumentation checks, not comparative performance claims. With and without --stats, output ELF files were byte-identical: NYC SHA-256 c93a126068814bc1e34d4d8282e59f4711841a367e283a98f5dc4297ef62f174 and NY SHA-256 fd8544b41404d4a176aa0e2bd201e35799cfc07d977801934d31ce7c7b609b4b.

2026-11-20 encoded home traffic and wide-call locality

P6b now reports encoded frame_ops separately from explicit home mov stores/loads. For lbm-relax main, the trace reported 101 frame operations; objdump counted 58 stores and 43 loads through rbp (101 total). A second fixture reported 27 operations for fhourstones main, matching 8 stores and 19 loads. The explicit stores=/loads= fields count the subset emitted as home movs; operations folded into arithmetic appear only in frame_ops.

P7 removes the whole-function stack-home fallback for functions containing a call with more than six arguments. The existing call-safety proof still disqualifies a register range that crosses a call. In a focused fixture with a seven-argument call before a hot loop, the loop changed from force-stack=yes, loop-registers=none, 69 frame operations to force-stack=no, loop-registers=selected, 10 frame operations. Both generated executables returned 45000150027. This is an encoded traffic reduction of 59 frame operations (about 86%) with the checksum held.

2026-11-20 loop-carried home traffic

The x64 loop-home path keeps eligible carried values in one register across backedges and publishes them when a later non-loop consumer needs the home. On the binary fixture, disabling that path emitted 33 home stores and 26 loads in main (120 rbp-relative frame operations); with it enabled, the counts were 1 store and 25 loads (57 frame operations). Both executables returned 3360874588549334. This meets P8's store-reduction gate and reduces loop home traffic without adding loads.

2026-11-20 integer home-fold and edge-sink counters

Added direct encoder counters for integer home folds and two-address ALU commutes. The binary fixture reported one home fold in main; its disassembly contains sub r14, QWORD PTR [rbp-0x280], so the spilled RHS is read by the arithmetic instruction instead of a separate reload. The run returned checksum 3360874588549334. No commuted ALU opportunity occurred in this fixture. The same trace counted 15 edge-add sinks across the compiled functions; none crossed a call, so it does not exercise the dynamic rematerialization case.

The P5 caller-first color-order trial did not change the gated code: ny_fn_search stayed at 337 instructions with six pushes and six pops, and binary main stayed at 729 instructions with six pushes and six pops. Checksums remained 6010 and 3360874588549334. The allocation-order edit was reverted because the measured gates did not move; pricing remains open for a more targeted change.

2026-11-20 D1 closings and the callee-save trial

P9, P13 and P15 were retired on measurement rather than implemented.

  • P9 (move the home store to its restore-dominator): P8 already reduced binary main to 1 home store and 25 loads (57 frame operations). A store placement rule cannot reduce a single store, and it does not address loads, so the row has nothing left to measure. Retired as subsumed by P8.
  • P13 (commute a two-address form instead of copying): the transform exists in both places the audit points at, the allocator's tied-input affinity and the encoder's in-place RHS swap, and the alu_commutes counter fired 0 times across nine fixtures (binary, lbm-relax, fhourstones, viterbi, crc32, sha256, hash, bitcount, mandelbrot). Retired as already implemented and unexercised.
  • P15 (dynamic remat): each rematerialisation is gated at the use site by mach_segment_at(vreg, cur_inst) and the address-fold predicate in mach_sib_add_mem, so folded_known filters rather than authorises. The measured edge-add sinks (15) include none that crosses a call, so the reload-count gate is not exercisable here. Retired.

The P5 trial reordered the loop-home colour scan by marginal push/pop cost: callee colours the base allocation already pays for first, then caller-saved colours, then unused callee colours. It changed nothing: fhourstones, binary and lbm-relax produced byte-identical executables with and without the ordering (cmp), with main at 635/730/793 instructions and 6 pushes and 6 pops each in that build. The scan's choice is decided by colour availability and the range proofs rather than by rank, so the order does not decide which colours are paid. The edit was reverted.

The counted baseline for main on the current tree is 641 (fhourstones), 730 (binary), 782 (lbm-relax) and 696 (viterbi) instructions with objdump -d --no-show-raw-insn over the body up to the first blank line; checksums 6010, 3360874588549334, 152700 and 3270530 all hold. The earlier 646 used a wider window and an intermediate build measured 635; both are superseded.

2026-11-20 Pong phase timing and spill-slot reuse

With the AOT cache disabled, one native x86-64 -O3 --stats build of etc/labs/pong.ny completed in 13.790 s. The phase report showed 0.613 s parsing, 1.365 s codegen preparation, 3.498 s type validation, 4.877 s codegen, and 7.721 s object emission. Some timers are nested, so these numbers cannot be summed. This resolves the missing timing measurement. The cold compile still exceeds the 5 s target.

A matched native x86-64 compile with spill-slot reuse explicitly disabled versus enabled gave these stack adjustments in the main prologue:

FixtureDisabledEnabledChecksum in both runs
binary3,544 B2,376 B3360874588549334
lbm-relax3,112 B2,824 B152700
fhourstones2,664 B2,504 B6010

These measurements cover frame size. Default enablement still needs a fix for encoder caches keyed by slot offset and checks of the prior failures.

2026-11-20 conditional home publication: carried-run attempt

P1's store half was prototyped as a carried-run rule in mach_vreg_requires_home_after_def: skip the def-side publish when the defining segment and every successor entry segment are marked carried in the same colour, so no consumer can read the home before the run ends. The rule never fired: its cond_home counter reported 0 on eleven fixtures (binary, fhourstones, lbm-relax, viterbi, binary-trees, crc32, sha256, hash, bitcount, susan, mandelbrot), and every fixture produced byte-identical executables with the rule on and off. The edit was reverted rather than kept behind a flag.

The shape of the remaining traffic explains it. The stores that survive are call-boundary publications, because a value crossing a call cannot stay in a caller-saved colour, while the loads are argument staging and spill reloads. On binary main: 730 instructions, 19 home stores, 34 home loads, 85 rbp-relative operands. P1's store side therefore has no work left after P8, and its load side needs the per-block residency condition that only P2 supplies.

Measurement note: NYTRIX_AOT_CACHE=0 is required for a codegen A/B. With the cache on, both arms return the cached object and counts drift between rebuilds (635 and 641 were both observed for fhourstones main). The five-fixture baseline measured with the cache off, after the revert, is 730/635/793/695/685 instructions with checksums 3360874588549334, 6010, 152700, 3270530 and 64912, all held.

2026-11-20 full benchmark and shared-home follow-up

./make bench exited 0 and all configured performance gates passed. The report bench-20261120-062227-3652437.json recorded geometric means of 1.35× for native versus C and 1.07× for LLVM versus C among fixtures with a C reference of at least 1 ms. Its largest reported gaps were native-oracle (native/C 10.57×), cd (native/LLVM 3.76×), and pbkdf2 (NYC/C 8.78×).

After the benchmark compiler was built, two x86 encoder paths gained guards against forwarding RAX by stack offset alone for shared spill homes. Fresh native x86-64 -O3 builds with spill-slot coloring off and on matched checksums on binary, lbm-relax, fhourstones, statemate, and pidigits. This verifies the focused checksums only. Default spill-slot coloring and the runtime gaps remain open.

2026-11-20 isolated native-oracle repeat

The full report had 58 comparable route results above 2× C, including 23 with C medians of at least 1 ms. The full list is in the local audit. A one-worker native-oracle repeat gave native 106 µs, LLVM 326 µs, C 29 µs, and NYC 29 µs. The native/C ratio fell from 10.57× in the full run to 3.71× in isolation. The comparison remains above 2× and measures process overhead as part of a workload that computes only one Fibonacci result.

2026-11-20 spill-slot coloring: value-identity tags, default stays off

NYTRIX_SPILL_HOME_COLOR folds the live ranges of spilled values onto shared home slots, which shrank frames but crashed fhourstones and drifted statemate/pidigits when it was the default. The cause was the sticky-RAX tag: it named a home offset, so a pooled slot could forward a neighbour's value.

The tag now carries a vreg (mach_rax_tag_hit, mach_pending_rax_hit). A shared slot reuses the tag only for the same vreg, and offset-only sites call mach_home_off_shared and require an unshared slot. mach_load_rax_slot and mach_store_rax_slot pass the vreg where the caller knows it.

Measured with build/release/ny-full, -O3 --native-backend x86_64, NYTRIX_AOT_CACHE=0, main from objdump -d --no-show-raw-insn.

fixtureinstructions off → onhome stores off → onframe off → onchecksum
binary729 → 82233 → 1240xdd8 → 0x9483360874588549334
fhourstones634 → 6358 → 80xa68 → 0x9c86010
lbm-relax793 → 79558 → 580xc28 → 0xb08152700
viterbi694 → 69623 → 240xaa8 → 0x9e83270530
binary-trees685 → 6872 → 30xb38 → 0xa3864912

Frames shrink 6–33%, but pooling defeats the home-store elision on a hot loop: binary goes 33 → 124 stores and 729 → 822 instructions. Smaller frames are not a win on their own, so the default stays one slot per value and the flag stays opt-in.

Correctness with the flag on: ny-test 3/3 on the former regressions (fhourstones, statemate, pidigits), --pattern regalloc --pattern codegen 26/26, --pattern x86 223/223.

The identity tag is neutral to slightly positive with the flag off: binary 730 → 729 and fhourstones 635 → 634 instructions, checksums unchanged.

Remaining investigation leads

Re-rank using the dashboard, then confirm a miss in isolation before changing the compiler. The former backlog's still-open leads:

Prove typed-buffer bounds and memory dependence for native conditional-count, max-reduction, and stencil vectorization (cd, viterbi, lbm, susan). Reduce spills across inner loops (sssp, mont64, NYC pbkdf2), track available loads by root and byte range (bce-matrix), and scalar-replace fixed buffers after unrolling (mont64). Narrow provable integer lanes (bitcount, intops, crypto); reduce managed allocation and operand validation without weakening pointer checks (bigint-oracle). Separate startup from kernel cost (native-oracle) and reuse CFG, dominator, and SCEV results only where invalidation permits (page-rank, dce, sha256).