heap: Allow disabling control set awareness for comparison/debug

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2026-03-27 11:29:48 +01:00
parent 06082daaef
commit 57b62cb46a
3 changed files with 14 additions and 6 deletions

View File

@ -391,6 +391,8 @@ po::options_description CommandHandler::getGeneralOptions()
"allow placer to attempt up to max(10000, total cells^2 / N) iterations to place a cell (int "
"N, default: 8, 0 for no timeout)");
general.add_options()("placer-heap-no-ctrl-set", "disable control set awareness in placer heap");
general.add_options()("static-dump-density", "write density csv files during placer-static flow");
#if !defined(NPNR_DISABLE_THREADS)
@ -536,6 +538,9 @@ void CommandHandler::setupContext(Context *ctx)
ctx->settings[ctx->id("placerHeap/cellPlacementTimeout")] =
std::to_string(std::max(0, vm["placer-heap-cell-placement-timeout"].as<int>()));
if (vm.count("placer-heap-no-ctrl-set"))
ctx->settings[ctx->id("placerHeap/noCtrlSet")] = true;
if (vm.count("parallel-refine"))
ctx->settings[ctx->id("placerHeap/parallelRefine")] = true;

View File

@ -559,7 +559,7 @@ class HeAPPlacer
void alloc_control_sets()
{
if (cfg.ff_bel_bucket == BelBucketId())
if (cfg.ff_bel_bucket == BelBucketId() || cfg.disableCtrlSet)
return;
FastBels::FastBelsData *ff_bels;
fast_bels.getBelsForBelBucket(cfg.ff_bel_bucket, &ff_bels);
@ -593,7 +593,7 @@ class HeAPPlacer
}
bool test_ctrl_set(BelId bel, IdString cell) {
if (cfg.ff_bel_bucket == BelBucketId())
if (cfg.ff_bel_bucket == BelBucketId() || cfg.disableCtrlSet)
return true;
if (ctx->getBelBucketForBel(bel) != cfg.ff_bel_bucket)
return true;
@ -602,7 +602,7 @@ class HeAPPlacer
}
void bind_ctrl_set(BelId bel, IdString cell) {
if (cfg.ff_bel_bucket == BelBucketId())
if (cfg.ff_bel_bucket == BelBucketId() || cfg.disableCtrlSet)
return;
if (ctx->getBelBucketForBel(bel) != cfg.ff_bel_bucket)
return;
@ -611,7 +611,7 @@ class HeAPPlacer
}
void unbind_ctrl_set(BelId bel) {
if (cfg.ff_bel_bucket == BelBucketId())
if (cfg.ff_bel_bucket == BelBucketId() || cfg.disableCtrlSet)
return;
if (ctx->getBelBucketForBel(bel) != cfg.ff_bel_bucket)
return;
@ -627,7 +627,7 @@ class HeAPPlacer
int32_t get_cluster_control_set(ClusterId cluster) {
int32_t ctrl_set = -1;
if (cfg.ff_bel_bucket == BelBucketId())
if (cfg.ff_bel_bucket == BelBucketId() || cfg.disableCtrlSet)
return -1;
for (auto cell : cluster2cells.at(cluster)) {
auto ofs = ctx->getClusterOffset(cell);
@ -1150,7 +1150,7 @@ class HeAPPlacer
log_error("Unable to find legal placement for all cells, design is probably at utilisation limit.\n");
}
if (p->cfg.ff_bel_bucket != BelBucketId()) {
if (p->cfg.ff_bel_bucket != BelBucketId() && !p->cfg.disableCtrlSet) {
// Try placing based on same control set in window first
int32_t ctrl_set = -1;
if (ci->cluster != ClusterId()) {
@ -2170,6 +2170,7 @@ PlacerHeapCfg::PlacerHeapCfg(Context *ctx)
timingWeight = ctx->setting<int>("placerHeap/timingWeight");
parallelRefine = ctx->setting<bool>("placerHeap/parallelRefine", false);
netShareWeight = ctx->setting<float>("placerHeap/netShareWeight", 0);
disableCtrlSet = ctx->setting<bool>("placerHeap/noCtrlSet", false);
timing_driven = ctx->setting<bool>("timing_driven");
solverTolerance = 1e-5;
@ -2189,6 +2190,7 @@ PlacerHeapCfg::PlacerHeapCfg(Context *ctx)
hpwl_scale_y = 1;
spread_scale_x = 1;
spread_scale_y = 1;
}
NEXTPNR_NAMESPACE_END

View File

@ -60,6 +60,7 @@ struct PlacerHeapCfg
// this is an optional callback to prioritise certain cells/clusters for legalisation
std::function<float(Context *, CellInfo *)> get_cell_legalisation_weight = [](Context *, CellInfo *) { return 1; };
bool disableCtrlSet;
BelBucketId ff_bel_bucket = BelBucketId();
std::vector<std::vector<int>> ff_control_set_groups;
int ctrl_set_max_radius = 10;