Initial implementation of generic multithreaded tracing (#2269)

The --trace-threads option can now be used to perform tracing on a
thread separate from the main thread when using VCD tracing (with
--trace-threads 1). For FST tracing --trace-threads can be 1 or 2, and
--trace-fst --trace-threads 1 is the same a what --trace-fst-threads
used to be (which is now deprecated).

Performance numbers on SweRV EH1 CoreMark, clang 6.0.0, Intel i7-3770 @
3.40GHz, IO to ramdisk, with numactl set to schedule threads on different
physical cores. Relative speedup:

--trace     ->  --trace --trace-threads 1      +22%
--trace-fst ->  --trace-fst --trace-threads 1  +38% (as --trace-fst-thread)
--trace-fst ->  --trace-fst --trace-threads 2  +93%

Speed relative to --trace with no threaded tracing:
--trace                                 1.00 x
--trace --trace-threads 1               0.82 x
--trace-fst                             1.79 x
--trace-fst --trace-threads 1           1.23 x
--trace-fst --trace-threads 2           0.87 x

This means FST tracing with 2 extra threads is now faster than single
threaded VCD tracing, and is on par with threaded VCD tracing. You do
pay for it in total compute though as --trace-fst --trace-threads 2 uses
about 240% CPU vs 150% for --trace-fst --trace-threads 1, and 155% for
--trace --trace threads 1. Still for interactive use it should be
helpful with large designs.
This commit is contained in:
Geza Lore
2020-04-21 23:49:07 +01:00
committed by GitHub
parent 6ab51de96d
commit c52f3349d1
25 changed files with 735 additions and 62 deletions
+13 -1
View File
@@ -631,6 +631,9 @@ void V3Options::notify() {
&& !v3Global.opt.preprocOnly() //
&& !v3Global.opt.xmlOnly());
}
// --trace-threads implies --threads 1 unless explicitly specified
if (traceThreads() && !threads()) { m_threads = 1; }
}
//######################################################################
@@ -1062,8 +1065,16 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
addLdLibs("-lz");
} else if (!strcmp(sw, "-trace-fst-thread")) {
m_trace = true;
m_traceFormat = TraceFormat::FST_THREAD;
m_traceFormat = TraceFormat::FST;
addLdLibs("-lz");
fl->v3warn(DEPRECATED, "Option --trace-fst-thread is deprecated. "
"Use --trace-fst with --trace-threads > 0.");
if (m_traceThreads == 0) m_traceThreads = 1;
} else if (!strcmp(sw, "-trace-threads")) {
shift;
m_trace = true;
m_traceThreads = atoi(argv[i]);
if (m_traceThreads < 0) fl->v3fatal("--trace-threads must be >= 0: " << argv[i]);
} else if (!strcmp(sw, "-trace-depth") && (i + 1) < argc) {
shift;
m_traceDepth = atoi(argv[i]);
@@ -1568,6 +1579,7 @@ V3Options::V3Options() {
m_traceParams = true;
m_traceStructs = false;
m_traceUnderscore = false;
m_traceThreads = 0;
m_underlineZero = false;
m_verilate = true;
m_vpi = false;