Skip to content

Conversation

robluo
Copy link
Contributor

@robluo robluo commented Sep 29, 2025

Now able to draw analytical placement

Description

  1. Drawing analytical placement logical location before and after the solving and legalization.
  2. No net connection or clickable elements.
  3. Can transition to other graphic displays after finishing analytical placement.

Motivation and Context

To give more insight to AP flow

How Has This Been Tested?

By hand

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@github-actions github-actions bot added VPR VPR FPGA Placement & Routing Tool lang-cpp C/C++ code labels Sep 29, 2025
This will not break place and route drawing and it creates a initial world
of different dimension than place and route drawing
No more segfault when clicking.
Added after solve and after legalization draw.
skip set_initial_world when no display
@robluo robluo closed this Sep 30, 2025
@robluo robluo reopened this Sep 30, 2025
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.

I am excited to get this in! I have added some comments regarding organization. I want to keep AP as clean as possible, without having confusing drawing code in the loop if we can.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would like to keep the drawing code pretty isolated from the AP code as much as possible. In the future, we may decide to make another global placer as well, and I would like to avoid duplicate code.

I suggest that you create a new class in the analytical_place directory for drawing. Something like APDrawManager or something. This class would then have methods for drawing the pre and post legalized placements. This would remove the global accesses from this method. The global placer can then take this as an argument, which it can use to draw whenever it needs.


if (hpwl_relative_gap < target_hpwl_relative_gap_)
break;

Copy link
Contributor

Choose a reason for hiding this comment

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

Why add these extra lines?

PartialPlacement best_p_placement(ap_netlist_);
double best_ub_hpwl = std::numeric_limits<double>::max();

#ifndef NO_GRAPHICS
Copy link
Contributor

Choose a reason for hiding this comment

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

See my comments above. I would like to keep these ifdefs and the draw state out of this class.

draw_state->pic_on_screen = pic_on_screen_val;
}

// What is this? Always true!
Copy link
Contributor

Choose a reason for hiding this comment

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

I would mark this as a FIXME, or raise an issue so we can resolve. A comment like this will get missed.

#endif /* NO_GRAPHICS */
}

#ifndef NO_GRAPHICS
Copy link
Contributor

Choose a reason for hiding this comment

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

I would be careful with this ifdef. You are not defining these functions when graphics is disabled. However, they are still available in the header file...

I would put the ifdef inside of the method and have the method do nothing when graphics is not enabled.

*/
void init_draw_coords(float clb_width, const BlkLocRegistry& blk_loc_registry);

void set_initial_world_ap();
Copy link
Contributor

Choose a reason for hiding this comment

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

These new methods need comments. Also see my prior comments on their definitions.

* Blocks are drawn in layer order (so that semi-transparent blocks/grids render well)*/
void drawplace(ezgl::renderer* g);

void draw_analytical_place(ezgl::renderer* g);
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs comment.

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

Successfully merging this pull request may close these issues.

2 participants