-
Notifications
You must be signed in to change notification settings - Fork 15
Register Bypass Constraint #293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
82c4a77
Enforce single-read-port constraint in mapping algorithm
guosran 4afbfdd
Enforce register-file intra-index constraint for mov vs compute
guosran dda69d8
feat: Implement register file occupancy tracking in MappingState, add…
guosran d26c4cc
Replaced autos with explicit data types
guosran cc551ee
feat: Enhance register occupancy tracking and add CGRA placement util…
guosran d6ee173
Replace RegClusterOccupyStatus with Operation* for register occupancy…
guosran 4f64662
Fix shell command error messages in MLIR fusion test cases
guosran 02d974f
Split reg_file map into read/write; allow same-register sharing; upda…
guosran af2cc0a
Implement read/write separation for register occupancy tracking
guosran b18095e
Merge remote-tracking branch 'origin/main' into feature/register-bypa…
guosran cba04b5
Resolved conflicts and implemented feedbacks
guosran 6fb1032
Update mapping utilities and state, refresh test files.
guosran dac5ca8
Updated tests
guosran 55cd94b
Refactor code for improved readability and consistency in MappingStat…
guosran 7c0d4ef
Refactor mapping_util.cpp for improved type clarity and consistency
guosran d288203
Refactor MLIR test cases and add script for updating CHECK lines
guosran 228105e
Refactor MappingState and mapping_util for improved clarity and consi…
guosran 82cf52f
Enhance function signatures in MappingState and mapping_util for impr…
guosran 103f489
Delete update_test_checks.py
guosran 411f39f
Remove accidentally committed = file
guosran d9f4461
Update Zeonica_Testbench submodule to main branch
guosran 2ccd34e
Sync Zeonica_Testbench submodule to match main branch (1e98cf0)
guosran 1f90f12
Merge remote-tracking branch 'origin/main' into feature/register-bypa…
guosran 872e387
Resolved merge conflicts
guosran 6676bab
Fix formatting in comments for clarity in MappingState.cpp and fir_ke…
guosran 048e313
Update tests
guosran 76182e4
Edit variable names
guosran 8510547
Rename `op` parameter to `move_op`
guosran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // This struct represents a pending data_mov/ctrl_mov that is being routed, | ||
| // along with its routing path. | ||
| struct PendingRoute { | ||
| Operation *mov_op; | ||
| std::vector<MappingLoc> path; | ||
| }; | ||
|
|
||
| bool hasSafeOperandIterationAtConsume( | ||
| Operation *op, const std::vector<PendingRoute> &operand_routes, int ii) { | ||
| assert(ii > 0 && II should be positive); | ||
|
|
||
| if (operand_routes.empty()) { | ||
| return true; | ||
| } | ||
|
|
||
| for (const PendingRoute &route : operand_routes) { | ||
| // Records the time range that each register is occupied on this route. | ||
| // <Register*, <min_time, max_time>>, this means the register is occupied | ||
| // from min_time to max_time. | ||
| DenseMap<Register *, std::pair<int, int>> reg_time_range; | ||
| for (const MappingLoc &loc : route.path) { | ||
| Register *reg = dyn_cast<Register>(loc.resource); | ||
| continue; | ||
| } | ||
|
|
||
| // For each register, tracks its live interval on this path by keeping | ||
| // the earliest and latest time it appears. | ||
| // Inserts a new entry if the register is seen for the first time. | ||
| auto [it, inserted] = reg_time_range.try_emplace( | ||
| reg, std::make_pair(loc.time_step, loc.time_step)); | ||
|
|
||
| // If this register has been seen before, updates the time range to | ||
| // include the new time step. | ||
| // Updates the min_time for this seen register if the new time step is | ||
| // earlier. | ||
| it->second.first = std::min(it->second.first, loc.time_step); | ||
| // Updates the max_time for this seen register if the new time step is | ||
| // later. | ||
| it->second.second = std::max(it->second.second, loc.time_step); | ||
| } | ||
| } | ||
|
|
||
| // Register occupancy is tracked in per-cycle slots (half-open in routing | ||
| // builders), so max_t - min_t + 1 corresponds to the hold duration. | ||
| for (const auto &entry : reg_time_range) { | ||
| Register *reg = entry.first; | ||
| int min_t = entry.second.first; | ||
| int max_t = entry.second.second; | ||
| int occupancy = max_t - min_t + 1; | ||
| if (occupancy > ii) { | ||
| llvm::errs() << [DEBUG] Reject schedule due to register hold next | ||
| iteration window. op= | ||
| << *op << , II= << ii << , reg=# << reg->getId() | ||
| << , hold_start= << min_t << , hold_end= << max_t | ||
| << , hold_len= << occupancy | ||
| << , mov_op= << *route.mov_op << n; | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
|
|
||
| mapping_state.getII())) { | ||
| llvm::errs() << [DEBUG] Operand iteration shift at consume time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.