Skip to content

Fix Assertion Crash and Optimize Compile Time#298

Merged
guosran merged 4 commits intomainfrom
fix/assertion-and-performance
Mar 23, 2026
Merged

Fix Assertion Crash and Optimize Compile Time#298
guosran merged 4 commits intomainfrom
fix/assertion-and-performance

Conversation

@guosran
Copy link
Collaborator

@guosran guosran commented Mar 21, 2026

Summary

This PR addresses PR #296, and fixes two problems:

  1. Assertion crash in cloneWithNewDimensions() when replaying tile/link overrides on smaller CGRA grids
  2. Excessive compile time from running the full mapper on every balance probe

Problem 1: Assertion Crash

Root Cause

ResourceAwareTaskOptimizationPass tests task placement on smaller CGRA grids by calling cloneWithNewDimensions(). This method replays all tile_overrides and link_overrides from the original 4×4 grid. However, if an override references coordinates (e.g., (3,3)) that don't exist in the smaller cloned grid, the asserting getTile() call crashes.

Solution

Replaced 4 asserting getTile() calls with safe coord_to_tile_.find() lookups. These changes allow graceful degradation: overrides that don't apply to the new grid's coordinate space are simply skipped.

Problem 2: Excessive Compile Time

Root Cause

The balance phase in ResourceAwareTaskOptimizationPass ran the full mapper on every speculative CGRA count probe.

Solution

Restructured the balance phase to use analytical estimates during iterations.

@guosran guosran force-pushed the fix/assertion-and-performance branch 2 times, most recently from d9457bc to f757176 Compare March 21, 2026 05:42
@guosran guosran force-pushed the fix/assertion-and-performance branch from f757176 to 7017d86 Compare March 21, 2026 05:46
Copy link
Contributor

@tancheng tancheng left a comment

Choose a reason for hiding this comment

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

This PR is on top of your current register-constraint PR..

@guosran
Copy link
Collaborator Author

guosran commented Mar 21, 2026

This PR is on top of your current register-constraint PR.

Sry my bad, the branch is clean now.

@tancheng
Copy link
Contributor

This PR is on top of your current register-constraint PR.

Sry my bad, the branch is clean now.

looks not yet committed.

@guosran
Copy link
Collaborator Author

guosran commented Mar 22, 2026

This PR is on top of your current register-constraint PR.

Sry my bad, the branch is clean now.

looks not yet committed.

I mistakenly pushed the current pr to the wrong branch yesterday, and I have reverted the changes. This branch is based on ShangkunLi:predicate-handling. Both branches are clean now.

@guosran
Copy link
Collaborator Author

guosran commented Mar 22, 2026

resnet currently takes ~ 3min, other tests finish within 1 sec.

@guosran guosran merged commit b90a129 into main Mar 23, 2026
1 check passed
@guosran guosran deleted the fix/assertion-and-performance branch March 23, 2026 06:09
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