Skip to content

perf: Skip fully-resolved sections in subsequent relaxation iterations#1580

Merged
lapla-cogito merged 1 commit into
wild-linker:mainfrom
lapla-cogito:skip_unnecessary_section_traversal
Feb 21, 2026
Merged

perf: Skip fully-resolved sections in subsequent relaxation iterations#1580
lapla-cogito merged 1 commit into
wild-linker:mainfrom
lapla-cogito:skip_unnecessary_section_traversal

Conversation

@lapla-cogito

Copy link
Copy Markdown
Member

Have collect_relaxation_deltas() distinguish between permanent failures (e.g. unresolvable symbol, invalid register) and
address-dependent failures (e.g. distance too far for jal, value outside c.lui range). Only sections with address-dependent failures are rescanned on subsequent iterations.

@davidlattimore davidlattimore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wall time improvement looks to be less than 1%, but some of the other metrics improved.

Benchmark 1 (577 runs): /home/david/save/wild-riscv/run-with env-rand /home/d/wild-builds/2026-02-21.cg1.b --no-fork
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          51.9ms ± 1.07ms    48.7ms … 55.5ms          8 ( 1%)        0%
  peak_rss            173MB ±  779KB     171MB …  175MB          5 ( 1%)        0%
  cpu_cycles         1.24G  ± 23.3M     1.16G  … 1.31G          12 ( 2%)        0%
  instructions       1.55G  ± 14.6M     1.51G  … 1.62G          14 ( 2%)        0%
  cache_references   34.6M  ±  489K     33.1M  … 36.5M          19 ( 3%)        0%
  cache_misses       6.45M  ±  102K     6.15M  … 6.81M          14 ( 2%)        0%
  branch_misses      2.83M  ± 28.9K     2.73M  … 2.95M          12 ( 2%)        0%
Benchmark 2 (581 runs): /home/david/save/wild-riscv/run-with env-rand target/cg1/wild --no-fork
  measurement          mean ± σ            min … max           outliers         delta
  wall_time          51.6ms ± 1.09ms    48.6ms … 56.7ms          8 ( 1%)          -  0.6% ±  0.2%
  peak_rss            173MB ±  779KB     171MB …  176MB          6 ( 1%)          +  0.0% ±  0.1%
  cpu_cycles         1.20G  ± 22.8M     1.14G  … 1.34G          12 ( 2%)        ⚡-  2.6% ±  0.2%
  instructions       1.53G  ± 14.2M     1.49G  … 1.63G          14 ( 2%)        ⚡-  1.4% ±  0.1%
  cache_references   33.9M  ±  542K     31.9M  … 37.2M           7 ( 1%)        ⚡-  2.2% ±  0.2%
  cache_misses       6.15M  ± 97.1K     5.82M  … 6.53M           8 ( 1%)        ⚡-  4.7% ±  0.2%
  branch_misses      2.72M  ± 28.4K     2.64M  … 2.93M          14 ( 2%)        ⚡-  3.8% ±  0.1%

@lapla-cogito

Copy link
Copy Markdown
Member Author

I'm considering merging the section address calculation logic in finalise_layout() and compute_section_and_symbol_addresses() since a significant portion of their functionality overlaps. This should have a greater impact on wall time than this change.

@lapla-cogito lapla-cogito merged commit 1b705e6 into wild-linker:main Feb 21, 2026
20 checks passed
@lapla-cogito lapla-cogito deleted the skip_unnecessary_section_traversal branch February 21, 2026 10:05
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.

2 participants