sutro-problems

Weighted-Lifetime Matmul Hill Climb

This run moved the 16x16 matmul artifact from the 67,6xx range to a verified 66,707.

Files

Verify:

python3 matmul/submissions/weighted_lifetime_copyelim_66707.py

Expected:

weighted_lifetime_copyelim_66707.ir  cost=66,707

Core Idea

The successful reframing was:

energy ~= sum(reads * address_cost)

So the useful hill-climb target was not operation count, which my initial agents tended to target. The better target was considering the lifetime weighted future read pressure:

pressure ~= future_reads * future_lifetime_span

The objective then becomes:

Which values will be read many times over a long future span,
and how do we make those reads happen in cheaper addresses/windows?

What Worked

  1. Pressure-ranked suffix splits Copy a value after an early read, redirect the later reads, then recolor. This creates short hot intervals that can be placed cheaply.

  2. DP chain coloring Convert trace values into intervals. This finds hot zones of reads.

    define_time, last_read_time, read_count
    

    Then assign compatible high-read intervals to low addresses.

  3. Mixed A/B/derived pressure search B-only and derived-only helped, but the best path combined them.

  4. Generalized copy elimination After pressure splitting, many copy windows became removable. If the source stayed live, reads of the copy destination could be redirected back to the source. This made the trace cheaper without changing the final result.

  5. Repeated cleanup waves Late improvements were mostly forward copy-elim waves. Each accepted move usually redirected 4 reads and saved about 2 points.

Score Path

Approximate path:

~67,631
-> pressure-ranked suffix/pre-evict search
-> under 67,000
-> copy elimination
-> 66,876
-> mixed A/B/derived pressure
-> 66,795
-> generalized copy elimination
-> 66,761
-> repeated copy-elim waves
-> 66,707

What Did Not Work

Reproduce The Search Pattern

Pressure search:

python3 matmul/submissions/search_preevict_pressure.py START.raw.ir \
  --kinds A B derived \
  --rank pressure \
  --top 500 \
  --max-iters 12 \
  --write-best OUT.ir \
  --write-raw OUT.raw.ir \
  --checkpoint-each-accept

Copy elimination:

python3 matmul/submissions/search_copy_elim_general.py OUT.raw.ir \
  --top 1700 \
  --max-iters 10 \
  --write-best NEXT.ir \
  --write-raw NEXT.raw.ir \
  --checkpoint-each-accept

Useful loop:

pressure search until plateau
copy-elim until plateau
pressure/prepush check
copy-elim continuation

Prompt Pattern That Helped

Generally prompt types I used to get here:

What worked best was reformulating the scorer into something the agent could hill climb directly: total lifetime cost of future reads. In this case, that meant time-weighted read pressure.