From fa8a2777659aa8c229b451ff494b5b639d73ec14 Mon Sep 17 00:00:00 2001 From: aletempiac Date: Thu, 29 Feb 2024 17:16:49 +0100 Subject: [PATCH] Changing search space exploration of ACD to search for better implementation and prune unnecessary computations based on theoretical properties --- src/map/if/acd/ac_decomposition.hpp | 18 +++++++++++++----- src/map/if/acd/ac_wrapper.cpp | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/map/if/acd/ac_decomposition.hpp b/src/map/if/acd/ac_decomposition.hpp index 7cd6d9613..d573da2cd 100644 --- a/src/map/if/acd/ac_decomposition.hpp +++ b/src/map/if/acd/ac_decomposition.hpp @@ -58,7 +58,7 @@ struct ac_decomposition_params bool support_reducing_only{ true }; /*! \brief Use the first feasible decomposition found. */ - bool use_first{ true }; + bool use_first{ false }; /*! \brief If decomposition with delay profile fails, try without. */ bool try_no_late_arrival{ false }; @@ -116,6 +116,10 @@ public: { ps.max_free_set_vars = num_vars - ps.lut_size; } + if ( late_arriving > ps.max_free_set_vars ) + { + ps.max_free_set_vars = late_arriving; + } /* return a high cost if too many late arriving variables */ if ( late_arriving > ps.lut_size - 1 || late_arriving > ps.max_free_set_vars ) @@ -227,11 +231,13 @@ private: best_cost = multiplicity + additional_cost; best_free_set = i; - if ( ps.use_first ) + if ( !ps.use_first ) { - break; + continue; } } + + break; } if ( best_multiplicity == UINT32_MAX && ( !ps.try_no_late_arrival || late_arriving == 0 ) ) @@ -263,11 +269,13 @@ private: best_cost = multiplicity + additional_cost; best_free_set = i; - if ( ps.use_first ) + if ( !ps.use_first ) { - break; + continue; } } + + break; } } diff --git a/src/map/if/acd/ac_wrapper.cpp b/src/map/if/acd/ac_wrapper.cpp index 7786f0e72..7551335f8 100644 --- a/src/map/if/acd/ac_wrapper.cpp +++ b/src/map/if/acd/ac_wrapper.cpp @@ -46,7 +46,7 @@ int acd_evaluate( word * pTruth, unsigned nVars, int lutSize, unsigned *pdelay, } *pdelay = acd.get_profile(); - *cost = 2; + *cost = st.num_luts; return val; }