Skip to content

Commit 24c943f

Browse files
check the refomatted code in 57 files
1 parent 4089fd3 commit 24c943f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+320
-354
lines changed

odin_ii/src/ast/ast_loop_unroll.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ post_condition_function resolve_binary_operation(ast_node_t* node) {
342342
}
343343
}
344344

345-
346345
/*
347346
* (function: resolve_post_condition)
348347
* return a lambda which gives the next value

vpr/src/analytical_place/analytical_placement_flow.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static void print_ap_netlist_stats(const APNetlist& netlist) {
6868
* @param p_placement The partial placement to be updated which is assumend
6969
* to be generated on ap_netlist or have the same blocks.
7070
*/
71-
static void convert_flat_to_partial_placement(const FlatPlacementInfo& flat_placement_info, const APNetlist& ap_netlist, const Prepacker& prepacker, PartialPlacement& p_placement){
71+
static void convert_flat_to_partial_placement(const FlatPlacementInfo& flat_placement_info, const APNetlist& ap_netlist, const Prepacker& prepacker, PartialPlacement& p_placement) {
7272
for (APBlockId ap_blk_id : ap_netlist.blocks()) {
7373
// Get the molecule that AP block represents
7474
PackMoleculeId mol_id = ap_netlist.block_molecule(ap_blk_id);
@@ -78,7 +78,7 @@ static void convert_flat_to_partial_placement(const FlatPlacementInfo& flat_plac
7878
float atom_loc_x, atom_loc_y, atom_loc_layer;
7979
int atom_loc_sub_tile;
8080
bool found_valid_atom = false;
81-
for (AtomBlockId atom_blk_id: mol.atom_block_ids) {
81+
for (AtomBlockId atom_blk_id : mol.atom_block_ids) {
8282
if (!atom_blk_id.is_valid())
8383
continue;
8484
float current_loc_x = flat_placement_info.blk_x_pos[atom_blk_id];
@@ -87,11 +87,12 @@ static void convert_flat_to_partial_placement(const FlatPlacementInfo& flat_plac
8787
int current_loc_sub_tile = flat_placement_info.blk_sub_tile[atom_blk_id];
8888
if (found_valid_atom) {
8989
if (current_loc_x != atom_loc_x || current_loc_y != atom_loc_y || current_loc_layer != atom_loc_layer || current_loc_sub_tile != atom_loc_sub_tile)
90-
VPR_FATAL_ERROR(VPR_ERROR_AP, "Molecule of ID %zu contains atom %s (ID: %zu) with a location (%g, %g, layer: %g, subtile: %d) "
91-
"that conflicts the location of other atoms in this molecule of (%g, %g, layer: %g, subtile: %d).",
92-
mol_id, g_vpr_ctx.atom().netlist().block_name(atom_blk_id).c_str(), atom_blk_id,
93-
current_loc_x, current_loc_y, current_loc_layer, current_loc_sub_tile,
94-
atom_loc_x, atom_loc_y, atom_loc_layer, atom_loc_sub_tile);
90+
VPR_FATAL_ERROR(VPR_ERROR_AP,
91+
"Molecule of ID %zu contains atom %s (ID: %zu) with a location (%g, %g, layer: %g, subtile: %d) "
92+
"that conflicts the location of other atoms in this molecule of (%g, %g, layer: %g, subtile: %d).",
93+
mol_id, g_vpr_ctx.atom().netlist().block_name(atom_blk_id).c_str(), atom_blk_id,
94+
current_loc_x, current_loc_y, current_loc_layer, current_loc_sub_tile,
95+
atom_loc_x, atom_loc_y, atom_loc_layer, atom_loc_sub_tile);
9596
} else {
9697
atom_loc_x = current_loc_x;
9798
atom_loc_y = current_loc_y;
@@ -201,4 +202,3 @@ void run_analytical_placement_flow(t_vpr_setup& vpr_setup) {
201202
g_vpr_ctx.mutable_placement().clean_placement_context_post_place();
202203
g_vpr_ctx.mutable_floorplanning().clean_floorplanning_context_post_place();
203204
}
204-

vpr/src/analytical_place/analytical_placement_flow.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ struct t_vpr_setup;
1616
* @param vpr_setup The setup options provided by the user.
1717
*/
1818
void run_analytical_placement_flow(t_vpr_setup& vpr_setup);
19-

vpr/src/analytical_place/analytical_solver.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ std::unique_ptr<AnalyticalSolver> make_analytical_solver(e_analytical_solver sol
5757
}
5858

5959
AnalyticalSolver::AnalyticalSolver(const APNetlist& netlist)
60-
: netlist_(netlist),
61-
blk_id_to_row_id_(netlist.blocks().size(), APRowId::INVALID()),
62-
row_id_to_blk_id_(netlist.blocks().size(), APBlockId::INVALID()) {
60+
: netlist_(netlist)
61+
, blk_id_to_row_id_(netlist.blocks().size(), APRowId::INVALID())
62+
, row_id_to_blk_id_(netlist.blocks().size(), APBlockId::INVALID()) {
6363
// Get the number of moveable blocks in the netlist and create a unique
6464
// row ID from [0, num_moveable_blocks) for each moveable block in the
6565
// netlist.
@@ -261,16 +261,15 @@ void QPHybridSolver::init_linear_system() {
261261
* @param row_id_to_blk_id Lookup for the row id from the APBlock Id.
262262
* @param iteration The current iteration of the Global Placer.
263263
*/
264-
static inline void update_linear_system_with_anchors(
265-
Eigen::SparseMatrix<double> &A_sparse_diff,
266-
Eigen::VectorXd &b_x_diff,
267-
Eigen::VectorXd &b_y_diff,
268-
PartialPlacement& p_placement,
269-
size_t num_moveable_blocks,
270-
vtr::vector<APRowId, APBlockId> row_id_to_blk_id,
271-
unsigned iteration) {
264+
static inline void update_linear_system_with_anchors(Eigen::SparseMatrix<double>& A_sparse_diff,
265+
Eigen::VectorXd& b_x_diff,
266+
Eigen::VectorXd& b_y_diff,
267+
PartialPlacement& p_placement,
268+
size_t num_moveable_blocks,
269+
vtr::vector<APRowId, APBlockId> row_id_to_blk_id,
270+
unsigned iteration) {
272271
// Anchor weights grow exponentially with iteration.
273-
double coeff_pseudo_anchor = 0.01 * std::exp((double)iteration/5);
272+
double coeff_pseudo_anchor = 0.01 * std::exp((double)iteration / 5);
274273
for (size_t row_id_idx = 0; row_id_idx < num_moveable_blocks; row_id_idx++) {
275274
APRowId row_id = APRowId(row_id_idx);
276275
APBlockId blk_id = row_id_to_blk_id[row_id];
@@ -281,7 +280,7 @@ static inline void update_linear_system_with_anchors(
281280
}
282281
}
283282

284-
void QPHybridSolver::solve(unsigned iteration, PartialPlacement &p_placement) {
283+
void QPHybridSolver::solve(unsigned iteration, PartialPlacement& p_placement) {
285284
// Create a temporary linear system which will contain the original linear
286285
// system which may be updated to include the anchor points.
287286
Eigen::SparseMatrix<double> A_sparse_diff = Eigen::SparseMatrix<double>(A_sparse);
@@ -304,7 +303,7 @@ void QPHybridSolver::solve(unsigned iteration, PartialPlacement &p_placement) {
304303
// - This tolerance may need to be a function of the number of nets.
305304
// - Instead of normalizing the fixed blocks, the tolerance can be scaled
306305
// by the size of the device.
307-
Eigen::ConjugateGradient<Eigen::SparseMatrix<double>, Eigen::Lower|Eigen::Upper> cg;
306+
Eigen::ConjugateGradient<Eigen::SparseMatrix<double>, Eigen::Lower | Eigen::Upper> cg;
308307
cg.compute(A_sparse_diff);
309308
VTR_ASSERT(cg.info() == Eigen::Success && "Conjugate Gradient failed at compute!");
310309
// Use the solver to solve for x and y using the constant vectors
@@ -330,4 +329,3 @@ void QPHybridSolver::solve(unsigned iteration, PartialPlacement &p_placement) {
330329
}
331330

332331
#endif // EIGEN_INSTALLED
333-

vpr/src/analytical_place/analytical_solver.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
// Pop the GCC diagnostics state back to what it was before.
2626
#pragma GCC diagnostic pop
27-
#endif // EIGEN_INSTALLED
27+
#endif // EIGEN_INSTALLED
2828

2929
// Forward declarations
3030
class PartialPlacement;
@@ -36,7 +36,7 @@ class APNetlist;
3636
* NOTE: More are coming.
3737
*/
3838
enum class e_analytical_solver {
39-
QP_HYBRID // A solver which optimizes the quadratic HPWL of the design.
39+
QP_HYBRID // A solver which optimizes the quadratic HPWL of the design.
4040
};
4141

4242
/**
@@ -58,7 +58,7 @@ typedef vtr::StrongId<ap_row_id_tag, size_t> APRowId;
5858
* compare different solvers.
5959
*/
6060
class AnalyticalSolver {
61-
public:
61+
public:
6262
virtual ~AnalyticalSolver() {}
6363

6464
/**
@@ -67,7 +67,7 @@ class AnalyticalSolver {
6767
* Initializes the internal data members of the base class which are useful
6868
* for all solvers.
6969
*/
70-
AnalyticalSolver(const APNetlist &netlist);
70+
AnalyticalSolver(const APNetlist& netlist);
7171

7272
/**
7373
* @brief Run an iteration of the solver using the given partial placement
@@ -87,10 +87,9 @@ class AnalyticalSolver {
8787
* @param p_placement A "hint" to a legal solution that the solver should
8888
* try and be like.
8989
*/
90-
virtual void solve(unsigned iteration, PartialPlacement &p_placement) = 0;
91-
92-
protected:
90+
virtual void solve(unsigned iteration, PartialPlacement& p_placement) = 0;
9391

92+
protected:
9493
/// @brief The APNetlist the solver is optimizing over. It is implied that
9594
/// the netlist is not being modified during global placement.
9695
const APNetlist& netlist_;
@@ -115,7 +114,7 @@ class AnalyticalSolver {
115114
* @brief A factory method which creates an Analytical Solver of the given type.
116115
*/
117116
std::unique_ptr<AnalyticalSolver> make_analytical_solver(e_analytical_solver solver_type,
118-
const APNetlist &netlist);
117+
const APNetlist& netlist);
119118

120119
// The Eigen library is used to solve matrix equations in the following solvers.
121120
// The solver cannot be built if Eigen is not installed.
@@ -145,7 +144,7 @@ std::unique_ptr<AnalyticalSolver> make_analytical_solver(e_analytical_solver sol
145144
* https://doi.org/10.1109/TCAD.2005.846365
146145
*/
147146
class QPHybridSolver : public AnalyticalSolver {
148-
private:
147+
private:
149148
/// @brief The threshold for the number of pins a net will have to use the
150149
/// Star or Clique net models. If the number of pins is larger
151150
/// than this number, a star node will be created.
@@ -182,14 +181,14 @@ class QPHybridSolver : public AnalyticalSolver {
182181
/// @brief The constant vector in the y dimension for the linear system.
183182
Eigen::VectorXd b_y;
184183

185-
public:
186-
184+
public:
187185
/**
188186
* @brief Constructor of the QPHybridSolver
189187
*
190188
* Initializes internal data and constructs the initial linear system.
191189
*/
192-
QPHybridSolver(const APNetlist& netlist) : AnalyticalSolver(netlist) {
190+
QPHybridSolver(const APNetlist& netlist)
191+
: AnalyticalSolver(netlist) {
193192
// Initializing the linear system only depends on the netlist and fixed
194193
// block locations. Both are provided by the netlist, allowing this to
195194
// be initialized in the constructor.
@@ -216,8 +215,7 @@ class QPHybridSolver : public AnalyticalSolver {
216215
* @param p_placement A "guess" solution. The result will be written into
217216
* this object.
218217
*/
219-
void solve(unsigned iteration, PartialPlacement &p_placement) final;
218+
void solve(unsigned iteration, PartialPlacement& p_placement) final;
220219
};
221220

222221
#endif // EIGEN_INSTALLED
223-

vpr/src/analytical_place/ap_flow_enums.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ enum class e_ap_global_placer {
2626
* enum can select between these different Full Legalizers.
2727
*/
2828
enum class e_ap_full_legalizer {
29-
Naive, ///< The Naive Full Legalizer, which clusters atoms placed in the same tile and tries to place them in that tile according to the flat placement.
30-
APPack, ///< The APPack Full Legalizer, which uses the flat placement to improve the Packer and Placer.
29+
Naive, ///< The Naive Full Legalizer, which clusters atoms placed in the same tile and tries to place them in that tile according to the flat placement.
30+
APPack, ///< The APPack Full Legalizer, which uses the flat placement to improve the Packer and Placer.
3131
Basic_Min_Disturbance ///< The Basic Min. Disturbance Full Legalizer, which tries to reconstruct a clustered placement that is as close to the incoming flat placement as it can.
3232
};
3333

@@ -38,7 +38,6 @@ enum class e_ap_full_legalizer {
3838
* enum can select between these different Detailed Placers.
3939
*/
4040
enum class e_ap_detailed_placer {
41-
Identity, ///< The Identity Detailed Placer, which does not perform any optimizations on the legalized placement. Needed as a placeholder.
42-
Annealer ///< The Annealer Detailed Placer, which runs the annealer found in the Place part of the VPR flow (using the same options as the Placement stage).
41+
Identity, ///< The Identity Detailed Placer, which does not perform any optimizations on the legalized placement. Needed as a placeholder.
42+
Annealer ///< The Annealer Detailed Placer, which runs the annealer found in the Place part of the VPR flow (using the same options as the Placement stage).
4343
};
44-

vpr/src/analytical_place/ap_netlist.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ struct APFixedBlockLoc {
4949
* block ids.
5050
*/
5151
enum class APBlockMobility : bool {
52-
MOVEABLE, // The block is not constrained in any dimension.
53-
FIXED // The block is fixed.
52+
MOVEABLE, // The block is not constrained in any dimension.
53+
FIXED // The block is fixed.
5454
};
5555

5656
/**
@@ -62,20 +62,21 @@ enum class APBlockMobility : bool {
6262
* APBlocks. These need not have physical meaning.
6363
*/
6464
class APNetlist : public Netlist<APBlockId, APPortId, APPinId, APNetId> {
65-
public:
65+
public:
6666
/**
6767
* @brief Constructs a netlist
6868
*
6969
* @param name The name of the netlist (e.g. top-level module)
7070
* @param id A unique identifier for the netlist (e.g. a secure digest of
7171
* the input file)
7272
*/
73-
APNetlist(std::string name = "", std::string id = "") : Netlist(name, id) {}
73+
APNetlist(std::string name = "", std::string id = "")
74+
: Netlist(name, id) {}
7475

7576
APNetlist(const APNetlist& rhs) = default;
7677
APNetlist& operator=(const APNetlist& rhs) = default;
7778

78-
public: // Public Accessors
79+
public: // Public Accessors
7980
/*
8081
* Blocks
8182
*/
@@ -90,7 +91,7 @@ class APNetlist : public Netlist<APBlockId, APPortId, APPinId, APNetId> {
9091
/// This method should not be used if the block is moveable.
9192
const APFixedBlockLoc& block_loc(const APBlockId id) const;
9293

93-
public: // Public Mutators
94+
public: // Public Mutators
9495
/*
9596
* Note: all create_*() functions will silently return the appropriate ID
9697
* if it has already been created.
@@ -141,7 +142,7 @@ class APNetlist : public Netlist<APBlockId, APPortId, APPinId, APNetId> {
141142
*/
142143
APNetId create_net(const std::string& name);
143144

144-
private: // Private Members
145+
private: // Private Members
145146
/*
146147
* Netlist compression / optimization
147148
*/
@@ -178,7 +179,7 @@ class APNetlist : public Netlist<APBlockId, APPortId, APPinId, APNetId> {
178179
bool validate_pin_sizes_impl(size_t num_pins) const override;
179180
bool validate_net_sizes_impl(size_t num_nets) const override;
180181

181-
private: // Private Data
182+
private: // Private Data
182183
/// @brief Molecule of each block
183184
vtr::vector_map<APBlockId, PackMoleculeId> block_molecules_;
184185
/// @brief Type of each block
@@ -187,4 +188,3 @@ class APNetlist : public Netlist<APBlockId, APPortId, APPinId, APNetId> {
187188
/// NOTE: This vector will likely be quite sparse.
188189
vtr::vector_map<APBlockId, APFixedBlockLoc> block_locs_;
189190
};
190-

vpr/src/analytical_place/ap_netlist_fwd.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class APNetlist;
2626
* @brief A unique identifier for a block in the AP netlist
2727
*/
2828
class APBlockId : public ParentBlockId {
29-
public:
29+
public:
3030
static constexpr APBlockId INVALID() { return APBlockId(); }
3131
using ParentBlockId::ParentBlockId;
3232

@@ -37,7 +37,7 @@ class APBlockId : public ParentBlockId {
3737
* @brief A unique identifier for a net in the AP netlist
3838
*/
3939
class APNetId : public ParentNetId {
40-
public:
40+
public:
4141
static constexpr APNetId INVALID() { return APNetId(); }
4242
using ParentNetId::ParentNetId;
4343

@@ -48,7 +48,7 @@ class APNetId : public ParentNetId {
4848
* @brief A unique identifier for a port in the AP netlist
4949
*/
5050
class APPortId : public ParentPortId {
51-
public:
51+
public:
5252
static constexpr APPortId INVALID() { return APPortId(); }
5353
using ParentPortId::ParentPortId;
5454

@@ -59,7 +59,7 @@ class APPortId : public ParentPortId {
5959
* @brief A unique identifier for a pin in the AP netlist
6060
*/
6161
class APPinId : public ParentPinId {
62-
public:
62+
public:
6363
static constexpr APPinId INVALID() { return APPinId(); }
6464
using ParentPinId::ParentPinId;
6565

@@ -101,4 +101,3 @@ struct hash<APPinId> {
101101
}
102102
};
103103
} // namespace std
104-

vpr/src/analytical_place/flat_placement_density_manager.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct t_physical_tile_type;
5757
* may allow us to trade off quality and runtime.
5858
*/
5959
class FlatPlacementDensityManager {
60-
public:
60+
public:
6161
/**
6262
* @brief Construct the density manager.
6363
*
@@ -233,7 +233,7 @@ class FlatPlacementDensityManager {
233233
*/
234234
void print_bin_grid() const;
235235

236-
private:
236+
private:
237237
/// @brief The AP netlist of blocks which are filling the bins.
238238
const APNetlist& ap_netlist_;
239239

@@ -268,4 +268,3 @@ class FlatPlacementDensityManager {
268268
/// @brief The verbosity of log messages in this class.
269269
const int log_verbosity_;
270270
};
271-

vpr/src/analytical_place/flat_placement_mass_calculator.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct t_physical_tile_type;
3939
* mass that the tile should aim to hold.
4040
*/
4141
class FlatPlacementMassCalculator {
42-
public:
42+
public:
4343
/**
4444
* @brief Construct the mass calculator.
4545
*
@@ -97,7 +97,7 @@ class FlatPlacementMassCalculator {
9797
return block_mass_[blk_id];
9898
}
9999

100-
private:
100+
private:
101101
/// @brief The capacity of each physical tile type, indexed by the index
102102
/// of the physical_tile_type.
103103
std::vector<PrimitiveVector> physical_tile_type_capacity_;
@@ -112,4 +112,3 @@ class FlatPlacementMassCalculator {
112112
/// @brief The verbosity of log messages in the mass calculator.
113113
const int log_verbosity_;
114114
};
115-

0 commit comments

Comments
 (0)