forked from github/verilator
Fix performance when mulithreaded on 1 CPU, bug1455.
This commit is contained in:
parent
f6f8073058
commit
4e115d4b69
2
Changes
2
Changes
@ -28,6 +28,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
||||
|
||||
**** Fix invalid XML output due to special chars, bug1444. [Kanad Kanhere]
|
||||
|
||||
**** Fix performance when mulithreaded on 1 CPU, bug1455. [Stefan Wallentowitz]
|
||||
|
||||
|
||||
* Verilator 4.014 2019-05-08
|
||||
|
||||
|
@ -52,6 +52,10 @@ public:
|
||||
|
||||
// METHODS
|
||||
static vluint64_t yields() { return s_yields; }
|
||||
static void yieldThread() {
|
||||
++s_yields; // Statistics
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
// Block until notify() has occurred, then return.
|
||||
// If notify() has already occurred, return immediately.
|
||||
@ -63,11 +67,10 @@ public:
|
||||
unsigned ct = 0;
|
||||
while (VL_UNLIKELY(!notified())) {
|
||||
VL_CPU_RELAX();
|
||||
ct++;
|
||||
++ct;
|
||||
if (VL_UNLIKELY(ct > VL_LOCK_SPINS)) {
|
||||
ct = 0;
|
||||
++s_yields; // Statistics
|
||||
std::this_thread::yield();
|
||||
yieldThread();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,8 +152,14 @@ public:
|
||||
return m_upstreamDepsDone.load(std::memory_order_acquire) == target;
|
||||
}
|
||||
inline void waitUntilUpstreamDone(bool evenCycle) const {
|
||||
unsigned ct = 0;
|
||||
while (VL_UNLIKELY(!areUpstreamDepsDone(evenCycle))) {
|
||||
VL_CPU_RELAX();
|
||||
++ct;
|
||||
if (VL_UNLIKELY(ct > VL_LOCK_SPINS)) {
|
||||
ct = 0;
|
||||
VlNotification::yieldThread();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
28
test_regress/t/t_bench_mux4k_onecpu.pl
Executable file
28
test_regress/t/t_bench_mux4k_onecpu.pl
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/perl
|
||||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
|
||||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
|
||||
#
|
||||
# Copyright 2003 by Wilson Snyder. This program is free software; you can
|
||||
# redistribute it and/or modify it under the terms of either the GNU
|
||||
# Lesser General Public License Version 3 or the Perl Artistic License
|
||||
# Version 2.0.
|
||||
|
||||
scenarios(vltmt => 1);
|
||||
|
||||
top_filename("t/t_bench_mux4k.v");
|
||||
|
||||
compile(
|
||||
v_flags2 => ["--stats"],
|
||||
);
|
||||
|
||||
if (`numactl --show` !~ /cpu/) {
|
||||
skip("No numactl available");
|
||||
} else {
|
||||
execute(
|
||||
run_env => 'numactl -m 0 -C 0,0,0,0,0,0,0,0',
|
||||
check_finished => 1,
|
||||
);
|
||||
ok(1);
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user