Skip to content

Reduce repeated CFG and optimizer work; restore driver size compliance - #172

Merged
vishvananda merged 3 commits into
mainfrom
perf/simdjson-compile-analysis
Nov 16, 2026
Merged

vishvananda merged 3 commits into
mainfrom
perf/simdjson-compile-analysis

Conversation

@vishvananda

@vishvananda vishvananda commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Optimized simdjson compilation repeatedly builds control-flow and dominator facts during jump threading. Phi demotion was building an intermediate graph that its caller immediately changed again without reading. Defer that rebuild until after the caller redirects the edges, and share CFG ordering's DFS preorder and parent links with Lengauer-Tarjan instead of traversing the graph twice.

These two changes reduce total compiler instructions by another 5.19% for scalar simdjson and 3.79% for SSE, compared with the initial micro-optimization patch. Cycles fall 4.26% / 3.41%; paired local wall estimates are about 4% lower, but A/A scheduling noise prevents a precise timing claim. Frozen O3 instructions fall 0.38%. No transformation limits or ordering change, and measured output remains byte-identical. The report records call-chain attribution, controls, remaining opportunities, and the rejected alternative dominator solver.

Also retain instruction-to-block maps across operand-only propagation and dead-code removal, bound an ineligible jump-threading search, and use dominance intervals before ancestor walks. Extract Wasm stack-size parsing from driver argument dispatch, reducing parse from 243 to 231 code lines with identical diagnostics.

Filter front-end name lookup with per-scope name bits. Each analyzer scope and each parser scope keeps 64 bits, one per name hash, set when a name is entered in that scope. A clear bit answers a scope search without a probe of the shared name table. On 16 LLVM units, 61% of the analyzer's 15.8M scope searches are in scopes that do not declare the name, and these probes are cache misses. Against 0.9.4 over 9 paired rounds on the same units, cycles fall 4.1% syntax-only, 3.6% at -O0 and 2.8% at -O2; instructions fall 0.19–0.26%. Objects are byte-identical at -O0 and -O2.

Validation: full strict course report, debug-info tests, PA36 smoke, self-host through PA5, inception, architecture/file/placement audits and CI-pinned formatting. PA36's source-identity check compares all 467 compiler objects; scalar/SSE/frozen objects match at O0–O3. Independent vertex-removal reachability validates dominance on 1,000 random graphs with handler edges and reused storage, plus a 20,000-block chain. The earlier twelve parser probes match exit status and output. No LTO, PGO, benchmark-input or reference changes. For the name-bit commit: full strict course report, debug-info tests, self-host through PA5, architecture/file/placement audits and CI-pinned formatting.

🤖 Generated with Claude Code

@vishvananda vishvananda changed the title Reduce repeated optimizer walks and restore driver size compliance Reduce repeated CFG and optimizer work; restore driver size compliance Nov 16, 2026
@vishvananda
vishvananda merged commit 8b7e8b4 into main Nov 16, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant