feat: add Topic 17 v1.3 — linear scan register allocator, bottleneck scenarios, dev & design docs - #34
Conversation
- restructured compute_live_intervals to single-pass O(N+V) scan - fixed self-spill handling: proper SPILL_ prefix, no spurious sw - fixed spill code insertion order (sw at correct instruction position) - fixed peak_active tracking position (after allocation, not before) - added allocator report: peak_active, phys_regs_used, spill details - comprehensive 9-scenario benchmark with v1.0 vs v1.2 comparison - added regalloc_scenario_analysis_report_v1.2.md
Full scenario-level analysis covering 64 test cases across two rounds: - 9 high-dimension scenarios (dense_60, spiral_60, large_800x150, etc.) - 32 general edge-case scenarios (T01-T32) - 23 core allocation semantic scenarios (C01-C23) Key findings: 2 correctness bugs (alloc_map eviction, peak_active cap), 4 optimization directions, detailed per-scenario metrics.
Add 23 systematic test scenarios across 6 bottleneck dimensions: - Activity (4): slight/moderate/severe/zero overlap - Lifetime (4): short-lived/long chain/mixed/alternating - Reuse (4): single-spill-many-uses/many-spills-one-use/loop-body/adjacent - Eviction (4): same-end/skewed/chain/spiral - Stack pressure (3): wave/cascade/zero-reuse - Code expansion (4): max-spill/expansion-ratio/dense-chain/random Test framework in scratchv/backend/ for reproducible runs.
…pick_scratch cache)
Bug A (critical·correctness): spill() eviction branch omitted
alloc_map update, causing evicted vregs to be read from wrong phys reg
without a reload (lw). Fix: set alloc_map[vreg] = 'SPILL_{vreg}' after
active.pop() in spill().
Bug B (medium·diagnostic): peak_active capped by pool_size because
self-spilled intervals are not in active[]. Fix: add peak_real_pressure
field that counts self-spilled intervals too.
Bug C (low·code quality): _pick_scratch picked a different scratch reg
each time for the same spilled vreg. Fix: add _scratch_cache with
vreg_hint parameter for last-used-register memory.
Also: fix eviction/self-spill counting in test framework (Bug A fix
changed alloc_map semantics, count evictions from spill_code entries).
+ add code comments
+ sync topic17 design doc and dev doc to v1.3
- restructured compute_live_intervals to single-pass O(N+V) scan - fixed self-spill handling: proper SPILL_ prefix, no spurious sw - fixed spill code insertion order (sw at correct instruction position) - fixed peak_active tracking position (after allocation, not before) - added allocator report: peak_active, phys_regs_used, spill details - comprehensive 9-scenario benchmark with v1.0 vs v1.2 comparison - added regalloc_scenario_analysis_report_v1.2.md
Full scenario-level analysis covering 64 test cases across two rounds: - 9 high-dimension scenarios (dense_60, spiral_60, large_800x150, etc.) - 32 general edge-case scenarios (T01-T32) - 23 core allocation semantic scenarios (C01-C23) Key findings: 2 correctness bugs (alloc_map eviction, peak_active cap), 4 optimization directions, detailed per-scenario metrics.
Add 23 systematic test scenarios across 6 bottleneck dimensions: - Activity (4): slight/moderate/severe/zero overlap - Lifetime (4): short-lived/long chain/mixed/alternating - Reuse (4): single-spill-many-uses/many-spills-one-use/loop-body/adjacent - Eviction (4): same-end/skewed/chain/spiral - Stack pressure (3): wave/cascade/zero-reuse - Code expansion (4): max-spill/expansion-ratio/dense-chain/random Test framework in scratchv/backend/ for reproducible runs.
…pick_scratch cache)
Bug A (critical·correctness): spill() eviction branch omitted
alloc_map update, causing evicted vregs to be read from wrong phys reg
without a reload (lw). Fix: set alloc_map[vreg] = 'SPILL_{vreg}' after
active.pop() in spill().
Bug B (medium·diagnostic): peak_active capped by pool_size because
self-spilled intervals are not in active[]. Fix: add peak_real_pressure
field that counts self-spilled intervals too.
Bug C (low·code quality): _pick_scratch picked a different scratch reg
each time for the same spilled vreg. Fix: add _scratch_cache with
vreg_hint parameter for last-used-register memory.
Also: fix eviction/self-spill counting in test framework (Bug A fix
changed alloc_map semantics, count evictions from spill_code entries).
+ add code comments
+ sync topic17 design doc and dev doc to v1.3
topic17: v1.3 bugfix (alloc_map eviction, peak pressure, scratch cache)
…scenarios, dev & design docs
🤖 AI Code Review
📁
|
There was a problem hiding this comment.
看上去删了很多不该删的文件呢, 建议先和origin/main对齐
Summary
Adds Topic 17 v1.3 deliverables (4 new files, no existing files modified):