|
| 1 | +# cinderx_dev Oracle Environment Specification |
| 2 | + |
| 3 | +Canonical procedure for using cinderx_dev (devgpu004:~/local/cinderx_dev/cinderx) |
| 4 | +as Phoenix-vs-Cinder perf oracle. Closes the env-equivalence gap pythia |
| 5 | +D-1777065234 #3 flagged + assigned to theologian (deferred 2026-04-22, closed |
| 6 | +2026-04-26 post pythia #146 + supervisor 01:30:42Z directive). |
| 7 | + |
| 8 | +## Why This Spec Exists |
| 9 | + |
| 10 | +cinderx_dev oracle was attempted 2026-04-26T01:16:27Z to discriminate Phoenix |
| 11 | +W27c-introduced perf regressions from Cinder-inherited ones. Attempt FAILED: |
| 12 | +- cinderx_dev `-X jit` showed ZERO speedup vs no-JIT for 3 benches (JIT didn't |
| 13 | + activate at warmup threshold, OR `-X jit` is wrong invocation, OR |
| 14 | + interpreter-overhead dominated). |
| 15 | +- ARM64-only cinderx_dev cross-arched against x86_64 Phoenix readings further |
| 16 | + confounded the comparison. |
| 17 | + |
| 18 | +Result: oracle could not discriminate. Phoenix-vs-Cinder verdict on perf |
| 19 | +remained unresolved. PROVISIONAL-PRE-EXISTING labeling could not promote to |
| 20 | +PRE-EXISTING per Alex feedback_assume_phoenix_regression.md. |
| 21 | + |
| 22 | +This spec resolves the env-equivalence gap so future oracle invocations |
| 23 | +discriminate cleanly. |
| 24 | + |
| 25 | +## Required Environment Equivalence |
| 26 | + |
| 27 | +### 1. Build Equivalence |
| 28 | + |
| 29 | +cinderx_dev binary on devgpu004 must match Phoenix build flags as closely as |
| 30 | +possible: |
| 31 | +- **Compiler**: clang (Phoenix uses clang 21 per memory; verify cinderx_dev |
| 32 | + also clang 21+) |
| 33 | +- **Optimization**: `-O2` (RelWithDebInfo) — matches `cinderx_dev build flags |
| 34 | + on devgpu004: NO PGO, NO LTO, RelWithDebInfo (-O2)` per project memory |
| 35 | +- **Phoenix x86_64 build**: also `-O2` non-LTO for fair comparison (LTO |
| 36 | + build is separate baseline; cinderx_dev has none, so use non-LTO Phoenix |
| 37 | + for oracle) |
| 38 | +- **Architecture**: prefer SAME-arch comparison. devgpu004 is ARM64; if |
| 39 | + Phoenix x86_64 readings are the regression source, build Phoenix on ARM64 |
| 40 | + via nbs-remote-session devgpu004 + scripts/build_phoenix.sh and compare |
| 41 | + ARM64 Phoenix vs ARM64 cinderx_dev. Cross-arch comparison is INVALID. |
| 42 | + |
| 43 | +### 2. JIT Activation Verification |
| 44 | + |
| 45 | +cinderx_dev JIT activation cannot be assumed from `-X jit` flag alone. |
| 46 | +Verification REQUIRED: |
| 47 | + |
| 48 | +```bash |
| 49 | +# Method 1: explicit compile + verify |
| 50 | +PYTHONPATH=/path/to/benchmark cinderx_dev_python -c " |
| 51 | +import cinderjit, benchmark_phoenix |
| 52 | +cinderjit.force_compile(benchmark_phoenix.bench_int_arith) |
| 53 | +assert cinderjit.is_jit_compiled(benchmark_phoenix.bench_int_arith), 'JIT not active' |
| 54 | +" |
| 55 | +``` |
| 56 | + |
| 57 | +If `cinderjit.force_compile` or `cinderjit.is_jit_compiled` are not exposed |
| 58 | +in cinderx_dev (different API), use Cinder-equivalent: |
| 59 | +```bash |
| 60 | +# Method 2: cinder API (verify via cinder.is_jit_compiled or _cinder) |
| 61 | +cinderx_dev_python -c "import _cinderjit; print(_cinderjit.get_runtime_helper_addr())" |
| 62 | +``` |
| 63 | + |
| 64 | +If neither method confirms JIT activation, the oracle reading is INVALID |
| 65 | +(JIT didn't run; comparison is interpreter-vs-Phoenix-JIT, not |
| 66 | +JIT-vs-JIT). |
| 67 | + |
| 68 | +### 3. Test-Harness Equivalence |
| 69 | + |
| 70 | +Same benchmark_phoenix.py harness (copy to devgpu004:/tmp/oracle_tools/), |
| 71 | +same `--reps=3` ABBA, same vanilla baseline (`../cpython-vanilla/python` on |
| 72 | +devgpu004 — note W-ARM64-VANILLA-INFRA debt: vanilla path may not exist on |
| 73 | +devgpu004, blocking ABBA; use targeted bench-only invocation with |
| 74 | +explicit timing if vanilla missing). |
| 75 | + |
| 76 | +For targeted bench timing without vanilla baseline: |
| 77 | +```bash |
| 78 | +JIT_ENABLE=1 cinderx_dev_python -c " |
| 79 | +import time, benchmark_phoenix |
| 80 | +benchmark_phoenix.bench_int_arith(50000) # warmup |
| 81 | +times = [] |
| 82 | +for _ in range(5): |
| 83 | + t0 = time.perf_counter() |
| 84 | + benchmark_phoenix.bench_int_arith(50000) |
| 85 | + times.append(time.perf_counter() - t0) |
| 86 | +print(f'median={sorted(times)[2]*1e3:.1f}ms') |
| 87 | +" |
| 88 | +``` |
| 89 | + |
| 90 | +Compare median directly between Phoenix-JIT and cinderx_dev-JIT (no vanilla |
| 91 | +needed for inheritance discrimination). |
| 92 | + |
| 93 | +### 4. Warmup Threshold |
| 94 | + |
| 95 | +cinderx_dev auto-compile threshold may differ from Phoenix (Phoenix=1000 per |
| 96 | +memory; cinderx_dev unknown). Use `cinderjit.force_compile` (Method 1) to |
| 97 | +bypass threshold uncertainty. If force_compile unavailable, run |
| 98 | +`bench(n_iter=50000)` first to amortize warmup, then time subsequent runs. |
| 99 | + |
| 100 | +## Oracle Invocation Procedure |
| 101 | + |
| 102 | +For ANY perf-regression discrimination question (Phoenix-introduced vs |
| 103 | +Cinder-inherited): |
| 104 | + |
| 105 | +1. **Same-arch verify**: confirm Phoenix and cinderx_dev are same arch |
| 106 | + (ARM64 most common since cinderx_dev is on devgpu004). If Phoenix is |
| 107 | + x86_64-only and bench shows regression, build Phoenix ARM64 first. |
| 108 | +2. **JIT activation verify**: run Method 1 (force_compile + is_jit_compiled) |
| 109 | + on cinderx_dev. If verification fails, abort oracle — fix env first. |
| 110 | +3. **Targeted bench timing**: run targeted bench (Method 3) on both |
| 111 | + Phoenix-JIT and cinderx_dev-JIT, 5-run median. |
| 112 | +4. **Discrimination**: |
| 113 | + - cinderx_dev-JIT median ≈ Phoenix-JIT median → INHERITED (close as |
| 114 | + not-Phoenix-introduced). |
| 115 | + - cinderx_dev-JIT median significantly faster than Phoenix-JIT median |
| 116 | + → PHOENIX-INTRODUCED (open bisect against cinderx_dev oracle as |
| 117 | + known-clean reference). |
| 118 | + |
| 119 | +## Failure Modes (Observed 2026-04-26T01:16:27Z) |
| 120 | + |
| 121 | +- **JIT didn't activate** (-X jit insufficient): use Method 1 force_compile. |
| 122 | +- **Cross-arch confound** (ARM64 cinderx_dev vs x86_64 Phoenix): build |
| 123 | + same-arch first. |
| 124 | +- **Vanilla baseline missing on devgpu004** (W-ARM64-VANILLA-INFRA debt): |
| 125 | + use targeted bench median instead of ABBA harness. |
| 126 | + |
| 127 | +## Application |
| 128 | + |
| 129 | +Next oracle invocation: try_except_callee + nn_module_forward |
| 130 | +discrimination per W-PERF-PRE-W27C-BISECT (push 60 PROVISIONAL-PRE-EXISTING |
| 131 | +labels). Apply this spec to obtain valid Phoenix-vs-Cinder verdict. |
| 132 | + |
| 133 | +If oracle confirms INHERITED, PROVISIONAL → PRE-EXISTING (true). |
| 134 | +If oracle confirms PHOENIX-INTRODUCED, open bisect to localize commit. |
0 commit comments