From 25e803c1f0e2cd69cadb4ef546f741c314f18529 Mon Sep 17 00:00:00 2001 From: soheilshahrouz Date: Mon, 29 Jul 2024 15:43:53 -0400 Subject: [PATCH] add comments --- vpr/src/base/vpr_types.h | 2 +- vpr/src/draw/draw_global.h | 14 ++++++++++++++ vpr/src/draw/draw_types.cpp | 3 +-- vpr/src/place/RL_agent_util.h | 13 +++++++++++-- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/vpr/src/base/vpr_types.h b/vpr/src/base/vpr_types.h index bd953c0fa27..24d223686e2 100644 --- a/vpr/src/base/vpr_types.h +++ b/vpr/src/base/vpr_types.h @@ -926,7 +926,7 @@ class PlaceLocVars { inline int tile_pin_index(const ClusterPinId pin) const { return physical_pins_[pin]; } ///@brief Returns the physical pin of the tile, related to the given ClusterNedId, and the net pin index. - inline int net_pin_to_tile_pin_index(const ClusterNetId net_id, int net_pin_index) const; + int net_pin_to_tile_pin_index(const ClusterNetId net_id, int net_pin_index) const; }; ///@brief Names of various files diff --git a/vpr/src/draw/draw_global.h b/vpr/src/draw/draw_global.h index 186b439d64d..a9391cd2941 100644 --- a/vpr/src/draw/draw_global.h +++ b/vpr/src/draw/draw_global.h @@ -27,8 +27,22 @@ t_draw_coords* get_draw_coords_vars(); t_draw_state* get_draw_state_vars(); +/** + * @brief Set the reference to placement location variable. + * + * During the placement stage, this reference should point to a local object + * in the placement stage because the placement stage does not change the + * global stage in place_ctx until the end of placement. After the placement is + * done, the reference should point to the global state stored in place_ctx. + * + * @param place_loc_vars The PlaceLocVars that the reference will point to. + */ void set_graphics_place_loc_vars_ref(const PlaceLocVars& place_loc_vars); +/** + * @brief Returns the reference to placement block location variables. + * @return A const reference to placement block location variables. + */ const PlaceLocVars& get_graphics_place_loc_vars_ref(); #endif // NO_GRAPHICS diff --git a/vpr/src/draw/draw_types.cpp b/vpr/src/draw/draw_types.cpp index bdb8c174ad5..ddbc3d0b566 100644 --- a/vpr/src/draw/draw_types.cpp +++ b/vpr/src/draw/draw_types.cpp @@ -13,9 +13,8 @@ *******************************************/ ezgl::color t_draw_state::block_color(ClusterBlockId blk) const { if (use_default_block_color_[blk]) { - auto& cluster_ctx = g_vpr_ctx.clustering(); - auto& block_locs = get_graphics_place_loc_vars_ref().block_locs(); + const auto& block_locs = get_graphics_place_loc_vars_ref().block_locs(); t_physical_tile_type_ptr tile_type = nullptr; if (block_locs.empty()) { //No placement, pick best match diff --git a/vpr/src/place/RL_agent_util.h b/vpr/src/place/RL_agent_util.h index 26ab290e54f..da687d9d852 100644 --- a/vpr/src/place/RL_agent_util.h +++ b/vpr/src/place/RL_agent_util.h @@ -15,7 +15,16 @@ enum class e_agent_state { * This function creates 2 move generators to be used by the annealer. The type of the move generators created here depends on the * type selected in placer_opts. * It returns a unique pointer for each move generator in move_generator and move_generator2 - * move_lim: represents the num of moves per temp. + * + * @param placer_ctx Move generators store a reference to the placer context to avoid global state access. + * @param placer_opts Contains information about the placement algorithm and its parameters. + * @param move_lim represents the num of moves per temp. + * @param noc_attraction_weight The attraction weight by which the NoC-biased centroid move adjust the computed location + * towards reachable NoC routers from the moving block. + * + * @return Two unique pointers referring to move generators. These move generators are supposed to be used + * in the first and second states of the agent. + * */ std::pair, std::unique_ptr> create_move_generators(PlacerContext& placer_ctx, const t_placer_opts& placer_opts, @@ -33,7 +42,7 @@ void assign_current_move_generator(std::unique_ptr& move_generato std::unique_ptr& current_move_generator); /** - * @ brief move the updated current_move_generator to its original move_Generator structure based on he placer_options and the agent state + * @brief move the updated current_move_generator to its original move_Generator structure based on he placer_options and the agent state */ void update_move_generator(std::unique_ptr& move_generator, std::unique_ptr& move_generator2,