-
Notifications
You must be signed in to change notification settings - Fork 415
NetCostHandler class #2676
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
NetCostHandler class #2676
Changes from 30 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
4927620
create NetCostHandler class
soheilshahrouz 5bd6612
add public methods for NetCostHandler
soheilshahrouz 94c2dad
remove place_cost_exp argument from alloc_and_load_placement_structs()
soheilshahrouz 5651cbe
move some static functions from net_cost_handler.cpp to NetCostHandle…
soheilshahrouz 57cf345
remove direct calls to comp_layer_bb_cost
soheilshahrouz 78e7dba
remove static ts_info from net_cost_handler
soheilshahrouz f30780e
remove NetCostHandler::free_try_swap_net_cost_structs()
soheilshahrouz 22c4ea8
remove static pl_net_cost from net_cost_handler.cpp
soheilshahrouz 45a4af4
remove static chanx_place_cost_fac and chany_place_cost_fac from net_…
soheilshahrouz 72ebdab
remove alloc_and_load_try_swap_structs()
soheilshahrouz 6fa0520
added some comments
soheilshahrouz cd005be
remove local vectors in get_non_updatable_layer_bb_() and get_layer_b…
soheilshahrouz 3f70ff2
add a private const t_placer_opts& placer_opts_ to NetCostHandler
soheilshahrouz dc9c018
remove args of type t_place_algorithm and t_placer_opts
soheilshahrouz 1deb8b0
added update_bb_functor_
soheilshahrouz a37e82a
remove dead code
soheilshahrouz 1758de3
Merge branch 'master' into temp_net_cost_ref
vaughnbetz 59c2c71
change the order of args in t_2D_bb constructor to be consistent with…
soheilshahrouz 0cb04be
Merge remote-tracking branch 'origin/master' into temp_net_cost_ref
soheilshahrouz 97d0813
add reward_function_ to MoveGenerator
soheilshahrouz 6530b8b
moved calculate_reward_and_process_outcome() to MoveGenerator
soheilshahrouz 70f0821
don't use unique_ptr for manual_move_generator
soheilshahrouz 01358fa
fixed failing assertion for UNDEFINED_REWARD
soheilshahrouz 3033773
call std::max and std::min instead of using std::max and std::min
soheilshahrouz c710d8e
remove free_try_swap_structs() and free_try_swap_arrays()
soheilshahrouz 12093d6
move print_placement_move_types_stats() to move_generator.cpp
soheilshahrouz 0b7bfa7
add some comments
soheilshahrouz 7f476f9
move driven_by_moved_block() from net_cost_handler to t_pl_blocks_to_…
soheilshahrouz e233dab
renamed some methods to avoid duplicate names
soheilshahrouz a2e8b4a
remove unused header includes
soheilshahrouz 845c4cb
applied PR comments
soheilshahrouz d2e9d85
revert the order of args in t_2D_bb's constructor
soheilshahrouz 5f90e53
Merge branch 'master' into temp_net_cost_ref
soheilshahrouz 881cf15
Merge branch 'master' into temp_net_cost_ref
soheilshahrouz 9618d53
fix typos and add comments
soheilshahrouz 4598234
move apply_move_blocks(), commit_move_blocks(), and revert_move_block…
soheilshahrouz 521c9e3
apply PR comments
soheilshahrouz ef8007f
add get_net_bb_cost_functor_ and get_non_updatable_bb_functor_
soheilshahrouz 8bf5d2d
add comments and address compilation warnings
soheilshahrouz 68e489f
add comments for use_ts arguments
soheilshahrouz 074b4c0
Merge branch 'master' into temp_net_cost_ref
soheilshahrouz 9e97e35
Merge branch 'master' into temp_net_cost_ref
soheilshahrouz 5576193
Merge branch 'master' into temp_net_cost_ref
soheilshahrouz 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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
|
||
#include "move_generator.h" | ||
|
||
#include "vpr_error.h" | ||
|
||
soheilshahrouz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
void MoveGenerator::calculate_reward_and_process_outcome(const MoveOutcomeStats& move_outcome_stats, | ||
double delta_c, | ||
float timing_bb_factor) { | ||
if (reward_func_ == e_reward_function::BASIC) { | ||
soheilshahrouz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
process_outcome(-1 * delta_c, reward_func_); | ||
} else if (reward_func_ == e_reward_function::NON_PENALIZING_BASIC || reward_func_ == e_reward_function::RUNTIME_AWARE) { | ||
if (delta_c < 0) { | ||
process_outcome(-1 * delta_c, reward_func_); | ||
} else { | ||
process_outcome(0, reward_func_); | ||
} | ||
} else if (reward_func_ == e_reward_function::WL_BIASED_RUNTIME_AWARE) { | ||
if (delta_c < 0) { | ||
float reward = -1 | ||
* (move_outcome_stats.delta_cost_norm | ||
+ (0.5 - timing_bb_factor) | ||
* move_outcome_stats.delta_timing_cost_norm | ||
+ timing_bb_factor | ||
* move_outcome_stats.delta_bb_cost_norm); | ||
process_outcome(reward, reward_func_); | ||
} else { | ||
process_outcome(0, reward_func_); | ||
} | ||
} else { | ||
VTR_ASSERT_SAFE(reward_func_ == e_reward_function::UNDEFINED_REWARD); | ||
VPR_ERROR(VPR_ERROR_PLACE, "Undefined reward function!\n"); | ||
} | ||
} | ||
|
||
void MoveTypeStat::print_placement_move_types_stats() { | ||
VTR_LOG("\n\nPlacement perturbation distribution by block and move type: \n"); | ||
|
||
VTR_LOG( | ||
"------------------ ----------------- ---------------- ---------------- --------------- ------------ \n"); | ||
VTR_LOG( | ||
" Block Type Move Type (%%) of Total Accepted(%%) Rejected(%%) Aborted(%%)\n"); | ||
VTR_LOG( | ||
soheilshahrouz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"------------------ ----------------- ---------------- ---------------- --------------- ------------ \n"); | ||
|
||
int total_moves = 0; | ||
for (size_t i = 0; i < blk_type_moves.size(); ++i) { | ||
total_moves += blk_type_moves.get(i); | ||
} | ||
|
||
auto& device_ctx = g_vpr_ctx.device(); | ||
int count = 0; | ||
int num_of_avail_moves = blk_type_moves.size() / device_ctx.logical_block_types.size(); | ||
|
||
//Print placement information for each block type | ||
for (const auto& itype : device_ctx.logical_block_types) { | ||
//Skip non-existing block types in the netlist | ||
if (itype.index == 0 || movable_blocks_per_type(itype).empty()) { | ||
continue; | ||
} | ||
|
||
count = 0; | ||
for (int imove = 0; imove < num_of_avail_moves; imove++) { | ||
const auto& move_name = move_type_to_string(e_move_type(imove)); | ||
int moves = blk_type_moves[itype.index][imove]; | ||
if (moves != 0) { | ||
int accepted = accepted_moves[itype.index][imove]; | ||
int rejected = rejected_moves[itype.index][imove]; | ||
int aborted = moves - (accepted + rejected); | ||
if (count == 0) { | ||
VTR_LOG("%-18.20s", itype.name); | ||
} else { | ||
VTR_LOG(" "); | ||
} | ||
VTR_LOG( | ||
" %-22.20s %-16.2f %-15.2f %-14.2f %-13.2f\n", | ||
move_name.c_str(), 100.0f * (float)moves / (float)total_moves, | ||
100.0f * (float)accepted / (float)moves, 100.0f * (float)rejected / (float)moves, | ||
100.0f * (float)aborted / (float)moves); | ||
} | ||
count++; | ||
} | ||
VTR_LOG("\n"); | ||
} | ||
VTR_LOG("\n"); | ||
} |
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.