-
Notifications
You must be signed in to change notification settings - Fork 14
Fix canReachLocInTime to account for register waits and refactor calculateAward #215
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
Conversation
…ulateAward
This PR addresses two improvements to the mapping algorithm:
1. Fix canReachLocInTime BFS to model register-based waiting
- Previously: Only tracked tile-level visits without time awareness
- Now: Uses (tile, time) state tracking to allow register waiting
- Aligns with tryRouteDataMove's routing behavior
- Both link traversal and register waiting are properly modeled
2. Refactor calculateAward with tunable parameters
- Separated tile-based awards from time-based awards
- Added constants for tuning: AWARD_PROXIMITY_SCALE,
AWARD_BACKWARD_PROXIMITY_SCALE, AWARD_BASE_MULTIPLIER,
AWARD_CRITICAL_BONUS_DIV (all set to 1 for now)
- Improved proximity calculation for producers and backward users
- Better handling of critical ops on recurrence paths
Test updates:
- Updated backtrack-config from 'simple' to 'customized' (5,3)
- Compiled II improvements:
- nested_loop: 17 → 13 (23.5% improvement)
- branch_for: 5 → 4 (20% improvement)
- fusion: 14 → 13 and 15 → 12
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves the mapping algorithm by fixing the canReachLocInTime BFS to properly model register-based waiting and refactoring calculateAward to separate tile-based from time-based scoring with tunable parameters. The changes result in significant compiled II improvements across multiple test cases.
Key changes:
- Fixed
canReachLocInTimeto use (tile, time) state tracking instead of tile-only tracking, allowing register waiting to be properly modeled - Refactored
calculateAwardto separate proximity-based tile scoring from time-step scoring with tunable constants (all set to 1 for now) - Test updates reflecting II improvements: nested_loop (17→13), branch_for (5→4), fusion (14→13, 15→12)
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/NeuraDialect/Mapping/mapping_util.cpp |
Core algorithm changes: BFS state tracking fix and award calculation refactoring with tunable constants |
test/c2llvm2mlir/nested_loop/test.mlir |
Updated expected compiled_ii from 17 to 13 |
test/neura/fusion/test.mlir |
Updated expected compiled_ii values (14→13, 15→12) |
test/neura/for_loop/relu_test.mlir |
Updated expected mapping output formatting |
test/neura/ctrl/branch_for.mlir |
Updated expected compiled_ii from 5 to 4 and formatting |
test/mapping_quality/branch_for.mlir |
Updated expected compiled_ii from 5 to 4 with expanded output |
test/e2e/relu/relu_kernel.mlir |
Updated expected mapping locations and formatting |
test/e2e/histogram/histogram_kernel.mlir |
Updated expected mapping locations and formatting |
test/e2e/fir/fir_kernel_vec.mlir |
Updated expected mapping locations |
test/e2e/fir/fir_kernel.mlir |
Updated expected mapping locations |
test/e2e/bicg/bicg_kernel.mlir |
Updated expected YAML output with expanded mappings |
test/code_gen/test_code_generate.mlir |
Updated expected compiled_ii from 6 to 5 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is a follow-up of PR #195 . |
Thank u Copilot T^T |
…o fix/canReach-refactor-award
…nature from @_Z6kernelPfPi to @_Z6kernelPiS_
This PR addresses two improvements to the mapping algorithm:
Fix canReachLocInTime BFS to model register-based waiting
Refactor calculateAward with tunable parameters
Test updates: