What "as good as Rosetta 2" means

Rosetta 2 is the reference for four properties. Translated code runs at a large fraction of native speed. Translation costs the user once and nothing after. Code that appears only at run time still works, through a JIT that runs rarely. And the guest sees exact results, with a precise guest state at a fault. ScarletNX has the second and third properties in a strong form already on hosts with a JIT. The first and fourth need work, and none of the four is measured today.

The targets below are proposals. The measurements of part 9 give the current values, and the targets should be revised once those numbers exist. Each metric is measured on every host that can run the test.

MetricHow it is measuredProposed target
Speed ratioThe same C kernels built natively for the host and as AArch64 Linux programs, the latter run through scarletnx-gnuabi with a warm cache (T1). The ratio is native time over translated time, as a geometric mean. On an AArch64 host the native build is the guest program itself.Reported in CI first. Then 0.7 or better for integer kernels on x86-64, and 0.9 or better on AArch64.
Call costMemory operations and host instructions for each guest BL and RET pair, from the recompile's statistics (T3) and the calls kernel of tests/native_bench.c.Half of the memory operations measured at the start.
AOT coverageThe share of executed guest functions that came from the AOT module rather than the JIT, from the runtime counters (T2).99.9 percent after one recompile with hints, and no new hints after two sessions in the same scenes. On hosts with no JIT, no miss at all.
Miss latencyTime from rt_miss to the guest thread running again (T2).Record the baseline and tail latency. No tiered-compilation target gates current work.
Recompile timeWall time of scarletnx -r with an empty unit cache, and after new hints. docs/dev/architecture.md gives 740 s cold and 24 to 28 s warm for a game of 255 units.Half the cold time. Under 60 s for a recompile that only adds hints.
Exactnessctest -R native_qemu_differential, the block-level fuzzer (T5), memory-order litmus tests (M1).No new groups in tests/native_qemu_expected.txt. Every mode that changes results is a setting, and the exact behavior is the default.
Precise faultsA crash report names the guest pc of the faulting instruction.Every fault in AOT and JIT code.

SIMD performance scenarios

For the first milestone, an illustrative scenario is about 5 to 18 percent higher throughput if the selected work accounts for 10 to 20 percent of baseline elapsed CPU-critical work and becomes 2 to 4 times faster. Neither assumption has been measured in a game. This is a conditional calculation, not the expected gain from the full plan or a performance number taken from Rosetta.

For a fixed CPU-limited workload, let p be the fraction of baseline elapsed time affected and s be the speedup of that entire portion, including guards, fixups, spills and remaining fallback. With other work unchanged, Amdahl's law gives S = 1 / ((1 - p) + p / s). Throughput gain is 100 * (S - 1) percent.

Affected fraction of baseline elapsed timeAffected work 2 times fasterAffected work 4 times faster
10 percent5.3 percent higher throughput8.1 percent higher throughput
20 percent11.1 percent higher throughput17.6 percent higher throughput
40 percent25.0 percent higher throughput42.9 percent higher throughput

These are speed increases, not equal percentages of time saved. At p = 0.2 and s = 2, elapsed time falls by 10 percent, giving 11.1 percent more throughput. Helper call counts and summed samples across parallel threads do not by themselves establish p. Identify work that delays completion of the measured workload. GPU overlap, waits and frame caps can hide an execution improvement or invalidate this simple model for frame rate.

Estimate p from the scene profile and s from the complete before/after sequence, then report the model beside observed scene timings. Record any gap rather than treating the calculation as a result. Do not add percentages from several items: their affected work may overlap. A vector intrinsic or four removed lane calls does not establish a 2-times or 4-times speedup. No universal improvement or Rosetta-level speed is promised.


Made from docs/layers/cpu/plan.md at 69237645142c. GPL-3.0-or-later.