Skip to content

Commit 197eb93

Browse files
authored
Merge branch 'master' into fix_parse_runtime
2 parents 0451b50 + a806b16 commit 197eb93

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

vpr/src/place/critical_uniform_move_generator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ e_create_move CriticalUniformMoveGenerator::propose_move(t_pl_blocks_to_be_moved
1818
return e_create_move::ABORT; //No movable block found
1919
}
2020

21+
if (place_ctx.block_locs[b_from].is_fixed) {
22+
return e_create_move::ABORT; //Block is fixed, cannot move
23+
}
24+
2125
t_pl_loc from = place_ctx.block_locs[b_from].loc;
2226
auto cluster_from_type = cluster_ctx.clb_nlist.block_type(b_from);
2327
auto grid_from_type = g_vpr_ctx.device().grid[from.x][from.y].type;

vpr/src/place/feasible_region_move_generator.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ e_create_move FeasibleRegionMoveGenerator::propose_move(t_pl_blocks_to_be_moved&
2020
return e_create_move::ABORT; //No movable block found
2121
}
2222

23+
if (place_ctx.block_locs[b_from].is_fixed) {
24+
return e_create_move::ABORT; //Block is fixed, cannot move
25+
}
26+
2327
//from block data
2428
t_pl_loc from = place_ctx.block_locs[b_from].loc;
2529
auto cluster_from_type = cluster_ctx.clb_nlist.block_type(b_from);

vpr/src/place/move_utils.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ e_block_move_result record_single_block_swap(t_pl_blocks_to_be_moved& blocks_aff
116116

117117
auto& place_ctx = g_vpr_ctx.mutable_placement();
118118

119+
if (place_ctx.block_locs[b_from].is_fixed) {
120+
return e_block_move_result::ABORT;
121+
}
122+
119123
VTR_ASSERT_SAFE(to.sub_tile < int(place_ctx.grid_blocks[to.x][to.y].blocks.size()));
120124

121125
ClusterBlockId b_to = place_ctx.grid_blocks[to.x][to.y].blocks[to.sub_tile];

vpr/test/test_vpr_constraints.cpp

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "../src/base/partition_region.h"
22
#include "catch.hpp"
33

4+
#include "vpr_api.h"
5+
#include "globals.h"
46
#include "vpr_constraints.h"
57
#include "partition.h"
68
#include "region.h"
@@ -421,3 +423,64 @@ TEST_CASE("RegionLocked", "[vpr]") {
421423

422424
REQUIRE(is_r2_locked == false);
423425
}
426+
427+
static constexpr const char kArchFile[] = "test_read_arch_metadata.xml";
428+
429+
// Test that place constraints are not changed during placement
430+
TEST_CASE("PlaceConstraintsIntegrity", "[vpr]") {
431+
auto options = t_options();
432+
auto arch = t_arch();
433+
auto vpr_setup = t_vpr_setup();
434+
435+
vpr_initialize_logging();
436+
437+
// Command line arguments
438+
//
439+
// parameters description:
440+
// - place_static_move_prob: Timing Feasible Region move type is always selected.
441+
// - RL_agent_placement: disabled. This way the desired move type is selected.
442+
const char* argv[] = {
443+
"test_vpr",
444+
kArchFile,
445+
"wire.eblif",
446+
"--fix_clusters", "wire.constraints",
447+
"--place_static_move_prob", "0", "0", "0", "0", "0", "100", "0",
448+
"--RL_agent_placement", "off"};
449+
vpr_init(sizeof(argv) / sizeof(argv[0]), argv,
450+
&options, &vpr_setup, &arch);
451+
452+
vpr_pack_flow(vpr_setup, arch);
453+
vpr_create_device(vpr_setup, arch);
454+
vpr_place_flow(vpr_setup, arch);
455+
456+
auto& cluster_ctx = g_vpr_ctx.clustering();
457+
auto& place_ctx = g_vpr_ctx.placement();
458+
459+
// Check if constraints are preserved
460+
461+
// Input block
462+
ClusterBlockId input_blk_id = cluster_ctx.clb_nlist.find_block("di");
463+
int input_x = 2;
464+
int input_y = 1;
465+
int input_sub_tile = 5;
466+
467+
auto input_loc = place_ctx.block_locs[input_blk_id].loc;
468+
469+
REQUIRE(input_x == input_loc.x);
470+
REQUIRE(input_y == input_loc.y);
471+
REQUIRE(input_sub_tile == input_loc.sub_tile);
472+
473+
// Output block
474+
ClusterBlockId output_blk_id = cluster_ctx.clb_nlist.find_block("out:do");
475+
int output_x = 2;
476+
int output_y = 1;
477+
int output_sub_tile = 1;
478+
479+
auto output_loc = place_ctx.block_locs[output_blk_id].loc;
480+
481+
REQUIRE(output_x == output_loc.x);
482+
REQUIRE(output_y == output_loc.y);
483+
REQUIRE(output_sub_tile == output_loc.sub_tile);
484+
485+
vpr_free_all(arch, vpr_setup);
486+
}

vpr/test/wire.constraints

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#block name x y subblk block number
2+
#---------- -- -- ------ ------------
3+
out:do 2 1 1 #0
4+
di 2 1 5 #1

0 commit comments

Comments
 (0)