How to reproduce DATE20 Exact DAG-Aware Rewriting?
Closed this issue · 1 comments
Purewwww commented
Here is my code, but I cannot reproduce both the size and runtime listed in the Paper(Table I).
#include <string>
#include <vector>
#include <fmt/format.h>
#include <lorina/aiger.hpp>
#include <lorina/verilog.hpp>
#include <mockturtle/algorithms/cleanup.hpp>
#include <mockturtle/algorithms/cut_rewriting.hpp>
#include <mockturtle/algorithms/node_resynthesis/dsd.hpp>
#include <mockturtle/algorithms/node_resynthesis/exact.hpp>
#include <mockturtle/io/aiger_reader.hpp>
#include <mockturtle/io/verilog_reader.hpp>
#include <mockturtle/networks/aig.hpp>
#include <experiments.hpp>
int main()
{
using namespace experiments;
using namespace mockturtle;
experiment<std::string, uint32_t, uint32_t, float, bool> exp( "cut_rewriting", "benchmark", "size_before", "size_after", "runtime", "equivalent");
mockturtle::exact_resynthesis_params exact_ps;
exact_ps.conflict_limit = 100000;
exact_ps.cache =
std::make_shared<mockturtle::exact_resynthesis_params::cache_map_t>();
exact_ps.blacklist_cache = std::make_shared<
mockturtle::exact_resynthesis_params::blacklist_cache_map_t>();
// DSD
mockturtle::exact_aig_resynthesis<mockturtle::aig_network> fallback(
false,
exact_ps ); // fallback
mockturtle::dsd_resynthesis_params dsd_ps;
dsd_ps.prime_input_limit = 6;
dsd_ps.dsd_ps.with_xor = false;
mockturtle::dsd_resynthesis<mockturtle::aig_network, decltype( fallback )>
resyn( fallback, dsd_ps );
for ( auto const& benchmark : epfl_benchmarks() )
{
fmt::print( "[i] processing {}\n", benchmark );
aig_network aig;
if ( lorina::read_aiger( benchmark_path( benchmark ), aiger_reader( aig ) ) != lorina::return_code::success )
{
continue;
}
cut_rewriting_params ps;
ps.cut_enumeration_ps.cut_size = 10;
ps.progress = true;
uint32_t size_before = aig.num_gates();
cut_rewriting_stats st;
ps.allow_zero_gain = true;
aig = cut_rewriting( aig, resyn, ps, &st );
ps.allow_zero_gain = false;
aig = cut_rewriting( aig, resyn, ps, &st );
ps.allow_zero_gain = true;
aig = cut_rewriting( aig, resyn, ps, &st );
ps.allow_zero_gain = false;
aig = cut_rewriting( aig, resyn, ps, &st );
auto cec = abc_cec( aig, benchmark );
exp( benchmark, size_before, aig.num_gates(), to_seconds( st.time_total ), cec );
}
exp.save();
exp.table();
return 0;
}
lee30sonia commented
Unfortunately, the original authors do not work with us anymore, and the paper is more than three years old, so it's hard to retrieve the original code that produced the results in the paper.
Also, the results in this paper are not so promising from today's point of view, so I don't see the necessity of reproducing it. For example, running the cut_rewriting.cpp
experiment (in release mode), I got the following results. The quality is not all better than in the paper, but generally better; the runtime is much faster.
| benchmark | size_before | size_after | size after 2 | runtime | runtime 2 | equivalent | equivalent 2 |
| adder | 1020 | 1020 | 1020 | 0.01 | 0.01 | true | true |
| bar | 3336 | 3141 | 3141 | 0.04 | 0.02 | true | true |
| div | 57247 | 41674 | 41603 | 1.17 | 0.63 | true | true |
| hyp | 214335 | 213525 | 214007 | 5.02 | 3.44 | true | true |
| log2 | 32060 | 30242 | 29775 | 0.80 | 0.49 | true | true |
| max | 2865 | 2862 | 2865 | 0.08 | 0.02 | true | true |
| multiplier | 27062 | 25086 | 24842 | 0.60 | 0.37 | true | true |
| sin | 5416 | 5255 | 5229 | 0.14 | 0.08 | true | true |
| sqrt | 24618 | 18647 | 20455 | 0.50 | 0.28 | true | true |
| square | 18484 | 18291 | 18317 | 0.34 | 0.25 | true | true |
| arbiter | 11839 | 11839 | 11839 | 0.59 | 0.16 | true | true |
| cavlc | 693 | 687 | 688 | 0.01 | 0.00 | true | true |
| ctrl | 174 | 137 | 138 | 0.00 | 0.00 | true | true |
| dec | 304 | 304 | 304 | 0.00 | 0.00 | true | true |
| i2c | 1342 | 1321 | 1286 | 0.02 | 0.01 | true | true |
| int2float | 260 | 228 | 234 | 0.00 | 0.00 | true | true |
| mem_ctrl | 46836 | 46663 | 46786 | 0.64 | 0.36 | true | true |
| priority | 978 | 893 | 884 | 0.01 | 0.01 | true | true |
| router | 257 | 252 | 251 | 0.01 | 0.00 | true | true |
| voter | 13758 | 11573 | 12232 | 0.35 | 0.15 | true | true |