Skip to content
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

[WIP] Reorganize place timing files #2829

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

soheilshahrouz
Copy link
Contributor

@soheilshahrouz soheilshahrouz commented Nov 29, 2024

vpr/src/place directory has too many files, making it difficult to locate related files. This PR organizes timing related files and classes under a new directory vpr/src/place/timing.

  • Moved placement delay model classes to place/timing/delay_model.
  • Removed timing_place.cpp/.h and created seperate files for PlacerCriticalities, PlacerSetupSlacks, and PlacerTimingCosts.
  • Some functions in physical_types_util.cpp are now implemented as member functions of structs declared in physical_types.h.

@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code labels Nov 29, 2024
@github-actions github-actions bot added the libarchfpga Library for handling FPGA Architecture descriptions label Nov 30, 2024
Copy link
Contributor

@AlexandreSinger AlexandreSinger left a comment

Choose a reason for hiding this comment

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

LGTM. Just some minor comments.

vpr/src/place/move_utils.cpp Show resolved Hide resolved
vpr/src/place/move_utils.cpp Show resolved Hide resolved
std::shared_ptr<const SetupTimingInfo> timing_info)
: clb_nlist_(clb_nlist)
, pin_lookup_(netlist_pin_lookup)
, timing_info_(std::move(timing_info))
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a little confused by the use of a shared pointer here. And I especially find this move a bit strange. Why not just pass a const reference to the SetupTimingInfo object? Do you think the original pointer may get destroyed during the lifetime of this class? The shared pointer could make sense if the owner of the timing_info object may be destroyed before the PlacerCriticalities object is finished.

vpr/src/place/timing/PlacerSetupSlacks.cpp Show resolved Hide resolved
vpr/src/place/timing/PlacerTimingCosts.h Show resolved Hide resolved
vpr/src/place/timing/PlacerTimingCosts.h Outdated Show resolved Hide resolved
Copy link
Contributor

@vaughnbetz vaughnbetz left a comment

Choose a reason for hiding this comment

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

Looks generally good. A few suggestions on commenting.
Also, src/place/timing/delay/.cpp seems like an excessively long path name.
I suggest src/place/delay/
.cpp instead; there's no real reason delay has to go under timing, and I think code is harder to discovery when the directory hierarchy gets too deep.

ClusterBlockId b_from = cluster_ctx.clb_nlist.net_driver_block(crit_pin.first);

//Check if picked block type matches with the blk_type specified, and it is not fixed
//blk_type from propose move doesn't account for the EMPTY type
auto b_from_type = cluster_ctx.clb_nlist.block_type(b_from);
if (b_from_type->index == logical_blk_type_index) {
if (b_from_type->index == logical_blk_type_index || logical_blk_type_index < 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest adding a comment that explains what this if is doing and what logical_blk_type_index < 0 means.

* @param logical_blk_type_index: the agent type of the moving block.
* @param logical_blk_type_index The logical type of the moving block. If a negative value is passed,
* the block is selected randomly from all movable blocks and not from a specific type.
* @param rng A random number generator used to select a random highly critical block.
*
Copy link
Contributor

Choose a reason for hiding this comment

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

Add Doxygen comments for the missing parameters, or at least the ones you understand. placer_criticalities is newly added so it at least should be easy to comment.

* returned by SetupTimingInfo. However, the set returned only reflects the connections
* changed by the last call to the timing info update.
*
* Therefore, if SetupTimingInfo is updated twice in succession without criticalities
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't find this paragraph easy to understand ... if you understand it, please take a crack at clarifying it.

public: //Lifetime

///@brief Allocates space for the timing_place_crit_ data structure.
PlacerCriticalities(const ClusteredNetlist& clb_nlist,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should explain the parameters here, particularly why the timing_info is a shared pointer (what is the usage/lifetime model)?

}

/**
* @brief Updated the setup slacks in the timing_place_setup_slacks_ data structure.
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this comment be in the .h file? Suggest moving it there, or deleting it if it is a duplicate.

*
* Should consistently call this method after the most recent timing analysis to
* keep the setup slacks stored in this class in sync with the timing analyzer.
* If out of sync, then the setup slacks cannot be incrementally updated on
Copy link
Contributor

Choose a reason for hiding this comment

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

updated on -> updated

Copy link
Contributor

Choose a reason for hiding this comment

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

Merge in the extra information from the .cpp file comment:

  • @brief Updated the setup slacks in the timing_place_setup_slacks_ data structure.
  • If the setup slacks are not updated immediately after each time we call
  • timing_info->update(), then timing_info->pins_with_modified_setup_slack()
  • cannot accurately account for all the pins that need to be updated.
  • In this case, recompute_required would be true, and we update all setup slacks
  • from scratch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-cpp C/C++ code libarchfpga Library for handling FPGA Architecture descriptions VPR VPR FPGA Placement & Routing Tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants