static: Guard density CSV dumps behind a flag

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2024-05-03 09:50:40 +02:00
parent 89e3b7d23d
commit 3f2451f8d7
2 changed files with 11 additions and 1 deletions

View File

@ -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 " "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)"); "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) #if !defined(NPNR_DISABLE_THREADS)
general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement"); general.add_options()("parallel-refine", "use new experimental parallelised engine for placement refinement");
#endif #endif
@ -543,6 +546,10 @@ void CommandHandler::setupContext(Context *ctx)
if (vm.count("router2-alt-weights")) if (vm.count("router2-alt-weights"))
ctx->settings[ctx->id("router2/alt-weights")] = true; 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 // Setting default values
if (ctx->settings.find(ctx->id("target_freq")) == ctx->settings.end()) if (ctx->settings.find(ctx->id("target_freq")) == ctx->settings.end())
ctx->settings[ctx->id("target_freq")] = std::to_string(12e6); ctx->settings[ctx->id("target_freq")] = std::to_string(12e6);

View File

@ -254,6 +254,7 @@ class StaticPlacer
int width, height; int width, height;
int iter = 0; int iter = 0;
bool fft_debug = false; bool fft_debug = false;
bool dump_density = false;
// legalisation queue // legalisation queue
std::priority_queue<std::pair<int, IdString>> to_legalise; std::priority_queue<std::pair<int, IdString>> to_legalise;
@ -658,6 +659,7 @@ class StaticPlacer
if (!overlap_str.empty()) if (!overlap_str.empty())
overlap_str += ", "; overlap_str += ", ";
overlap_str += stringf("%s=%.1f%%", cfg.cell_groups.at(idx).name.c_str(ctx), g.overlap * 100); overlap_str += stringf("%s=%.1f%%", cfg.cell_groups.at(idx).name.c_str(ctx), g.overlap * 100);
if (dump_density)
g.conc_density.write_csv(stringf("out_conc_density_%d_%d.csv", iter, idx)); g.conc_density.write_csv(stringf("out_conc_density_%d_%d.csv", iter, idx));
} }
log_info("overlap: %s\n", overlap_str.c_str()); log_info("overlap: %s\n", overlap_str.c_str());
@ -1387,6 +1389,7 @@ class StaticPlacer
groups.resize(cfg.cell_groups.size()); groups.resize(cfg.cell_groups.size());
tmg.setup_only = true; tmg.setup_only = true;
tmg.setup(); tmg.setup();
dump_density = ctx->setting<bool>("static/dump_density", false);
}; };
void place() void place()
{ {