From 580a45485afe48a77272f44f8aa99875cdd4d441 Mon Sep 17 00:00:00 2001 From: Maciej Kurc Date: Thu, 22 Jul 2021 14:07:35 +0200 Subject: Added an option to disable the LUT mapping cache Signed-off-by: Maciej Kurc --- fpga_interchange/arch.cc | 10 ++++++---- fpga_interchange/arch.h | 3 ++- fpga_interchange/main.cc | 2 ++ fpga_interchange/site_lut_mapping_cache.h | 2 +- fpga_interchange/site_router.cc | 7 +++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/fpga_interchange/arch.cc b/fpga_interchange/arch.cc index 64eef2ad..3b0572fa 100644 --- a/fpga_interchange/arch.cc +++ b/fpga_interchange/arch.cc @@ -814,10 +814,12 @@ bool Arch::place() archInfoToAttributes(); // Print site LUT mapping caching stats - log_info("Site LUT mapping cache stats:\n"); - log_info(" miss ratio: %.1f%%\n", getCtx()->site_lut_mapping_cache.getMissRatio() * 100.0f); - log_info(" peak size : %zuMB (%zu items)\n", getCtx()->site_lut_mapping_cache.getSizeMB(), - getCtx()->site_lut_mapping_cache.getCount()); + if (!getCtx()->arch_args.disable_lut_mapping_cache) { + log_info("Site LUT mapping cache stats:\n"); + log_info(" miss ratio: %.1f%%\n", getCtx()->site_lut_mapping_cache.getMissRatio() * 100.0f); + log_info(" peak size : %zuMB (%zu items)\n", getCtx()->site_lut_mapping_cache.getSizeMB(), + getCtx()->site_lut_mapping_cache.getCount()); + } getCtx()->check(); diff --git a/fpga_interchange/arch.h b/fpga_interchange/arch.h index de7232d4..36f6a7dc 100644 --- a/fpga_interchange/arch.h +++ b/fpga_interchange/arch.h @@ -39,9 +39,9 @@ #include "dedicated_interconnect.h" #include "lookahead.h" #include "pseudo_pip_model.h" +#include "site_lut_mapping_cache.h" #include "site_router.h" #include "site_routing_cache.h" -#include "site_lut_mapping_cache.h" NEXTPNR_NAMESPACE_BEGIN @@ -51,6 +51,7 @@ struct ArchArgs std::string package; bool rebuild_lookahead; bool dont_write_lookahead; + bool disable_lut_mapping_cache; }; struct ArchRanges diff --git a/fpga_interchange/main.cc b/fpga_interchange/main.cc index 64a15e62..5423c17d 100644 --- a/fpga_interchange/main.cc +++ b/fpga_interchange/main.cc @@ -57,6 +57,7 @@ po::options_description FpgaInterchangeCommandHandler::getArchOptions() specific.add_options()("package", po::value(), "Package to use"); specific.add_options()("rebuild-lookahead", "Ignore lookahead cache and rebuild"); specific.add_options()("dont-write-lookahead", "Don't write the lookahead file"); + specific.add_options()("disable-lut-mapping-cache", "Disable caching of LUT mapping solutions in site router"); return specific; } @@ -76,6 +77,7 @@ std::unique_ptr FpgaInterchangeCommandHandler::createContext(dict> *blocked_wires) { const Context *ctx = site_info.ctx; + bool enable_cache = !ctx->arch_args.disable_lut_mapping_cache; // Create a site LUT mapping key SiteLutMappingKey key = SiteLutMappingKey::create(site_info); // Get the solution from cache. If not found then compute it SiteLutMappingResult lutMapping; - if (!ctx->site_lut_mapping_cache.get(key, &lutMapping)) { + if (!enable_cache || !ctx->site_lut_mapping_cache.get(key, &lutMapping)) { const std::vector &lut_elements = ctx->lut_elements.at(site_info.tile_type); std::vector lut_mappers; @@ -1090,7 +1091,9 @@ static bool map_luts_in_site(const SiteInformation &site_info, poolsite_lut_mapping_cache.add(key, lutMapping); + if (enable_cache) { + ctx->site_lut_mapping_cache.add(key, lutMapping); + } } // Apply the solution if valid -- cgit v1.2.3