From 3f2451f8d78c88e299cb421539add41eadae17bf Mon Sep 17 00:00:00 2001 From: gatecat Date: Fri, 3 May 2024 09:50:40 +0200 Subject: [PATCH] static: Guard density CSV dumps behind a flag Signed-off-by: gatecat --- common/kernel/command.cc | 7 +++++++ common/place/placer_static.cc | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/kernel/command.cc b/common/kernel/command.cc index 44482946..d6d451f5 100644 --- a/common/kernel/command.cc +++ b/common/kernel/command.cc @@ -389,6 +389,9 @@ 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()("static-dump-density", "write density csv files during placer-static flow"); + + #if !defined(NPNR_DISABLE_THREADS) general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement"); #endif @@ -543,6 +546,10 @@ void CommandHandler::setupContext(Context *ctx) if (vm.count("router2-alt-weights")) ctx->settings[ctx->id("router2/alt-weights")] = true; + if (vm.count("static-dump-density")) + ctx->settings[ctx->id("static/dump_density")] = true; + + // Setting default values if (ctx->settings.find(ctx->id("target_freq")) == ctx->settings.end()) ctx->settings[ctx->id("target_freq")] = std::to_string(12e6); diff --git a/common/place/placer_static.cc b/common/place/placer_static.cc index c9b5364c..0466902c 100644 --- a/common/place/placer_static.cc +++ b/common/place/placer_static.cc @@ -254,6 +254,7 @@ class StaticPlacer int width, height; int iter = 0; bool fft_debug = false; + bool dump_density = false; // legalisation queue std::priority_queue> to_legalise; @@ -658,7 +659,8 @@ class StaticPlacer if (!overlap_str.empty()) overlap_str += ", "; overlap_str += stringf("%s=%.1f%%", cfg.cell_groups.at(idx).name.c_str(ctx), g.overlap * 100); - g.conc_density.write_csv(stringf("out_conc_density_%d_%d.csv", iter, idx)); + if (dump_density) + g.conc_density.write_csv(stringf("out_conc_density_%d_%d.csv", iter, idx)); } log_info("overlap: %s\n", overlap_str.c_str()); } @@ -1387,6 +1389,7 @@ class StaticPlacer groups.resize(cfg.cell_groups.size()); tmg.setup_only = true; tmg.setup(); + dump_density = ctx->setting("static/dump_density", false); }; void place() {