18
18
#include " logic_types.h"
19
19
#include " physical_types.h"
20
20
#include " physical_types_util.h"
21
+ #include " primitive_dim_manager.h"
21
22
#include " primitive_vector.h"
22
23
#include " vpr_context.h"
23
24
#include " vpr_error.h"
@@ -245,30 +246,30 @@ void print_physical_tiles(std::ofstream& os,
245
246
* The output file stream to print the primtive vector to.
246
247
* @param primitive_vec
247
248
* The primitive vector to print.
248
- * @param models
249
- * All models in the architecture (used to get the name of the model .
249
+ * @param dim_manager
250
+ * The manager class which handles all of the dims of this vector .
250
251
* @param prefix
251
252
* The prefix to print ahead of each entry in the primitive vector print.
252
253
*/
253
254
void print_primitive_vector (std::ofstream& os,
254
255
const PrimitiveVector& primitive_vec,
255
- const LogicalModels& models ,
256
+ const PrimitiveDimManager& dim_manager ,
256
257
const std::string& prefix) {
257
- std::vector<int > contained_models = primitive_vec.get_non_zero_dims ();
258
+ std::vector<PrimitiveVectorDim> contained_dims = primitive_vec.get_non_zero_dims ();
258
259
259
- // Get the max name length of the contained models for pretty printing.
260
+ // Get the max name length of the contained dim name for pretty printing.
260
261
size_t max_model_name_len = 0 ;
261
- for (int model_id : contained_models ) {
262
- std::string model_name = models. model_name ((LogicalModelId)model_id );
262
+ for (PrimitiveVectorDim dim : contained_dims ) {
263
+ std::string dim_name = dim_manager. get_dim_name (dim );
263
264
max_model_name_len = std::max (max_model_name_len,
264
- model_name .size ());
265
+ dim_name .size ());
265
266
}
266
267
267
- // Print the capacity of each model .
268
- for (int model_id : contained_models ) {
269
- std::string model_name = models. model_name ((LogicalModelId)model_id );
270
- os << prefix << std::setw (max_model_name_len) << model_name ;
271
- os << " : " << primitive_vec.get_dim_val (model_id );
268
+ // Print the capacity of each dim .
269
+ for (PrimitiveVectorDim dim : contained_dims ) {
270
+ std::string dim_name = dim_manager. get_dim_name (dim );
271
+ os << prefix << std::setw (max_model_name_len) << dim_name ;
272
+ os << " : " << primitive_vec.get_dim_val (dim );
272
273
os << " \n " ;
273
274
}
274
275
}
@@ -279,7 +280,7 @@ void print_primitive_vector(std::ofstream& os,
279
280
void print_logical_block_type_capacities (std::ofstream& os,
280
281
const std::vector<t_logical_block_type>& logical_block_types,
281
282
const std::vector<PrimitiveVector>& logical_block_type_capacities,
282
- const LogicalModels& models ) {
283
+ const PrimitiveDimManager& dim_manager ) {
283
284
os << " =================================================================\n " ;
284
285
os << " Logical Block Type Capacities:\n " ;
285
286
os << " =================================================================\n " ;
@@ -293,7 +294,7 @@ void print_logical_block_type_capacities(std::ofstream& os,
293
294
294
295
// Print the capacity of the logical block type.
295
296
const PrimitiveVector& cap = logical_block_type_capacities[block_type.index ];
296
- print_primitive_vector (os, cap, models , " \t " );
297
+ print_primitive_vector (os, cap, dim_manager , " \t " );
297
298
os << " \n " ;
298
299
}
299
300
}
@@ -304,7 +305,7 @@ void print_logical_block_type_capacities(std::ofstream& os,
304
305
void print_physical_tile_type_capacities (std::ofstream& os,
305
306
const std::vector<t_physical_tile_type>& physical_tile_types,
306
307
const std::vector<PrimitiveVector>& physical_tile_type_capacities,
307
- const LogicalModels& models ) {
308
+ const PrimitiveDimManager& dim_manager ) {
308
309
os << " =================================================================\n " ;
309
310
os << " Physical Tile Type Capacities:\n " ;
310
311
os << " =================================================================\n " ;
@@ -318,7 +319,7 @@ void print_physical_tile_type_capacities(std::ofstream& os,
318
319
319
320
// Print the capacity of the tile type.
320
321
const PrimitiveVector& cap = physical_tile_type_capacities[tile_type.index ];
321
- print_primitive_vector (os, cap, models , " \t " );
322
+ print_primitive_vector (os, cap, dim_manager , " \t " );
322
323
os << " \n " ;
323
324
}
324
325
}
@@ -345,6 +346,7 @@ void print_netlist_mass_utilization(std::ofstream& os,
345
346
const APNetlist& ap_netlist,
346
347
const vtr::vector<APBlockId, PrimitiveVector>& block_mass,
347
348
const std::vector<PrimitiveVector>& physical_tile_type_capacities,
349
+ const PrimitiveDimManager& dim_manager,
348
350
const DeviceGrid& device_grid,
349
351
const LogicalModels& models) {
350
352
os << " =================================================================\n " ;
@@ -371,44 +373,49 @@ void print_netlist_mass_utilization(std::ofstream& os,
371
373
// Get the mass of all blocks in the netlist.
372
374
PrimitiveVector total_netlist_mass = calc_total_netlist_mass (ap_netlist, block_mass);
373
375
374
- PrimitiveVector netlist_per_model_counts ;
376
+ PrimitiveVector netlist_per_dim_counts ;
375
377
for (APBlockId ap_blk_id : ap_netlist.blocks ()) {
376
- for (int dim : block_mass[ap_blk_id].get_non_zero_dims ()) {
377
- netlist_per_model_counts .add_val_to_dim (1 , dim);
378
+ for (PrimitiveVectorDim dim : block_mass[ap_blk_id].get_non_zero_dims ()) {
379
+ netlist_per_dim_counts .add_val_to_dim (1 , dim);
378
380
}
379
381
}
380
382
381
383
// Get the max string length of any model to make the printing prettier.
382
- size_t max_model_name_len = 0 ;
383
- for (LogicalModelId model_id : models.all_models ()) {
384
- max_model_name_len = std::max (max_model_name_len, std::strlen (models.model_name (model_id).c_str ()));
384
+ size_t max_dim_name_len = 0 ;
385
+ for (PrimitiveVectorDim dim : dim_manager.dims ()) {
386
+ std::string dim_name = dim_manager.get_dim_name (dim);
387
+ max_dim_name_len = std::max (max_dim_name_len, dim_name.size ());
385
388
}
386
389
387
390
// Print a breakdown of the mass utilization of the netlist.
388
- os << std::setw (max_model_name_len ) << " Model " ;
391
+ os << std::setw (max_dim_name_len ) << " Dim " ;
389
392
os << " : Total Netlist Mass | Total Grid Mass | Mass Utilization\n " ;
390
393
for (LogicalModelId model_id : models.all_models ()) {
391
- float model_netlist_mass = total_netlist_mass.get_dim_val ((size_t )model_id);
392
- float model_grid_capacity = total_grid_capacity.get_dim_val ((size_t )model_id);
393
- os << std::setw (max_model_name_len) << models.model_name (model_id);
394
- os << " : " << std::setw (18 ) << model_netlist_mass;
395
- os << " | " << std::setw (15 ) << model_grid_capacity;
396
- os << " | " << std::setw (16 ) << model_netlist_mass / model_grid_capacity;
394
+ PrimitiveVectorDim dim = dim_manager.get_model_dim (model_id);
395
+ std::string dim_name = dim_manager.get_dim_name (dim);
396
+ float dim_netlist_mass = total_netlist_mass.get_dim_val (dim);
397
+ float dim_grid_capacity = total_grid_capacity.get_dim_val (dim);
398
+ os << std::setw (max_dim_name_len) << dim_name;
399
+ os << " : " << std::setw (18 ) << dim_netlist_mass;
400
+ os << " | " << std::setw (15 ) << dim_grid_capacity;
401
+ os << " | " << std::setw (16 ) << dim_netlist_mass / dim_grid_capacity;
397
402
os << " \n " ;
398
403
}
399
404
os << " \n " ;
400
405
401
- os << std::setw (max_model_name_len ) << " Model " ;
406
+ os << std::setw (max_dim_name_len ) << " Dim " ;
402
407
os << " : Total Netlist Mass | Number of Blocks | Average Mass per Block\n " ;
403
408
for (LogicalModelId model_id : models.all_models ()) {
404
- float model_netlist_mass = total_netlist_mass.get_dim_val ((size_t )model_id);
405
- float num_blocks = netlist_per_model_counts.get_dim_val ((size_t )model_id);
409
+ PrimitiveVectorDim dim = dim_manager.get_model_dim (model_id);
410
+ std::string dim_name = dim_manager.get_dim_name (dim);
411
+ float dim_netlist_mass = total_netlist_mass.get_dim_val (dim);
412
+ float num_blocks = netlist_per_dim_counts.get_dim_val (dim);
406
413
float average_mass_per_block = 0 .0f ;
407
414
if (num_blocks > 0 .0f ) {
408
- average_mass_per_block = model_netlist_mass / num_blocks;
415
+ average_mass_per_block = dim_netlist_mass / num_blocks;
409
416
}
410
- os << std::setw (max_model_name_len ) << models. model_name (model_id) ;
411
- os << " : " << std::setw (18 ) << model_netlist_mass ;
417
+ os << std::setw (max_dim_name_len ) << dim_name ;
418
+ os << " : " << std::setw (18 ) << dim_netlist_mass ;
412
419
os << " | " << std::setw (16 ) << num_blocks;
413
420
os << " | " << std::setw (22 ) << average_mass_per_block;
414
421
os << " \n " ;
@@ -442,9 +449,9 @@ void print_expected_device_utilization(std::ofstream& os,
442
449
// instances to support the most utilized model.
443
450
const PrimitiveVector block_type_cap = logical_block_type_capacities[block_type.index ];
444
451
unsigned num_blocks_of_this_type = 0 ;
445
- for (int model_id : block_type_cap.get_non_zero_dims ()) {
446
- float netlist_model_mass = total_netlist_mass.get_dim_val (model_id );
447
- float model_mass_per_block = block_type_cap.get_dim_val (model_id );
452
+ for (PrimitiveVectorDim dim : block_type_cap.get_non_zero_dims ()) {
453
+ float netlist_model_mass = total_netlist_mass.get_dim_val (dim );
454
+ float model_mass_per_block = block_type_cap.get_dim_val (dim );
448
455
unsigned num_blocks_needed_for_model = std::ceil (netlist_model_mass / model_mass_per_block);
449
456
num_blocks_of_this_type = std::max (num_blocks_of_this_type, num_blocks_needed_for_model);
450
457
}
@@ -498,6 +505,7 @@ void print_expected_device_utilization(std::ofstream& os,
498
505
void generate_ap_mass_report (const std::vector<PrimitiveVector>& logical_block_type_capacities,
499
506
const std::vector<PrimitiveVector>& physical_tile_type_capacities,
500
507
const vtr::vector<APBlockId, PrimitiveVector>& block_mass,
508
+ const PrimitiveDimManager& dim_manager,
501
509
const APNetlist& ap_netlist) {
502
510
503
511
vtr::ScopedStartFinishTimer timer (" Generating AP Mass Report" );
@@ -524,17 +532,17 @@ void generate_ap_mass_report(const std::vector<PrimitiveVector>& logical_block_t
524
532
// Print information on the physical tiles.
525
533
print_physical_tiles (os, physical_tile_types);
526
534
527
- // TODO: Print a lookup between the model names and IDs
535
+ // TODO: Print a lookup between the model names and IDs and Primitive Dim
528
536
529
537
// Print the computed capacities of each logical block type.
530
- print_logical_block_type_capacities (os, logical_block_types, logical_block_type_capacities, models );
538
+ print_logical_block_type_capacities (os, logical_block_types, logical_block_type_capacities, dim_manager );
531
539
532
540
// Print the computed capacities of each physical tile type.
533
- print_physical_tile_type_capacities (os, physical_tile_types, physical_tile_type_capacities, models );
541
+ print_physical_tile_type_capacities (os, physical_tile_types, physical_tile_type_capacities, dim_manager );
534
542
535
543
// Print information on how much mass is utilized by the netlist relative
536
544
// to the device.
537
- print_netlist_mass_utilization (os, ap_netlist, block_mass, physical_tile_type_capacities, device_grid, models);
545
+ print_netlist_mass_utilization (os, ap_netlist, block_mass, physical_tile_type_capacities, dim_manager, device_grid, models);
538
546
539
547
// Print the expected device utilization, given the mass of the netlist
540
548
// and the capacity of the device grid.
0 commit comments