Skip to content

cpu-exec: skip idle hot-path bookkeeping#1082

Open
xiaokamikami wants to merge 1 commit into
masterfrom
perf/hotpath-bookkeeping-fastskip
Open

cpu-exec: skip idle hot-path bookkeeping#1082
xiaokamikami wants to merge 1 commit into
masterfrom
perf/hotpath-bookkeeping-fastskip

Conversation

@xiaokamikami

Copy link
Copy Markdown
Member

The normal performance path does not enable per-BB profiling, checkpoint generation, or mcontrol6 triggers, but the execute, trigger, and basic-block lookup paths still paid repeated bookkeeping overhead before discovering that no slow-path work was needed.

Skip per-BB profiling at the call site when all profiling/checkpoint modes are inactive, cache whether any mcontrol6 trigger is active, guard hot trigger call sites before entering the mcontrol6 checker, and use shift-mask arithmetic for power-of-two basic-block hash lookup. On the aggregate fw_payload 1B-instruction workload, this reduces host instructions from 121.896B to 117.077B with PERF_OPT=y, a 3.95% incremental reduction over the previous aggregate node.

@github-actions

Copy link
Copy Markdown

NEMU Performance Results - XS Interpreter

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions) Change vs Baseline (Throughput)
bitmanip.bin 1.385e+05 4.548e+07 3.046e+07 3.342e+07 5.199e+07 2.746e+07 +12.52% +21.72%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 1.356e+08 2.474e+08 2.348e+08 1.752e+08 1.774e+08 +22.62% +32.39%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 1.354e+08 2.507e+08 2.450e+08 1.747e+08 1.814e+08 +22.51% +35.07%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 1.326e+08 2.289e+08 2.322e+08 1.718e+08 1.667e+08 +22.85% +39.31%
amtest-riscv64-xs.bin 1.587e+04 8.454e+06 1.877e+07 1.698e+07 8.706e+06 1.999e+07 +2.90% -15.08%
aliastest-riscv64-xs.bin 1.376e+03 7.676e+06 1.793e+06 4.968e+06 7.709e+06 7.438e+06 +0.43% -33.21%
softprefetchtest-riscv64-xs.bin 2.643e+03 7.712e+06 3.427e+06 6.021e+06 7.757e+06 5.660e+06 +0.58% +6.38%
zacas-riscv64-xs.bin 6.470e+04 1.129e+07 5.733e+07 2.095e+07 1.222e+07 1.940e+07 +7.66% +7.96%
linux-hello 6.677e+07 1.097e+10 6.089e+07 6.682e+07 1.676e+10 4.792e+07 +34.58% +39.43%

NEMU Performance Results - XS Ref Shared Object

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions) Change vs Baseline (Throughput)
bitmanip.bin 1.385e+05 1.086e+09 1.276e+06 1.099e+06 1.094e+09 1.037e+06 +0.77% +5.94%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 6.343e+09 5.288e+06 4.641e+06 6.387e+09 4.383e+06 +0.68% +5.88%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 6.372e+09 5.327e+06 4.573e+06 6.415e+09 4.405e+06 +0.68% +3.83%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 5.992e+09 5.064e+06 4.256e+06 6.036e+09 4.084e+06 +0.72% +4.21%
amtest-riscv64-xs.bin 1.588e+04 3.411e+07 4.655e+06 2.043e+06 3.435e+07 1.857e+06 +0.71% +9.99%
aliastest-riscv64-xs.bin 1.379e+03 4.814e+06 2.864e+06 8.419e+05 4.850e+06 7.778e+05 +0.74% +8.24%
softprefetchtest-riscv64-xs.bin 2.646e+03 6.896e+06 3.837e+06 1.360e+06 6.938e+06 1.383e+06 +0.61% -1.65%
zacas-riscv64-xs.bin 6.471e+04 1.279e+08 5.058e+06 2.021e+06 1.288e+08 1.997e+06 +0.67% +1.22%
linux-hello 7.522e+07 6.608e+11 1.138e+06 1.161e+06 6.673e+11 1.091e+06 +0.98% +6.39%
  • Host Instructions is measured by DynamoRIO's inscount client.
  • Estimated Host Throughput assumes a fixed 4GHz CPU and IPC=2.5.
  • Actual NEMU Throughput is a single native NEMU run and may vary with host CPU performance.
  • Baseline columns are populated on pull_request runs when the PR base contains the same defconfig.
  • Change vs Baseline (Instructions) is computed from host instruction count; positive means fewer host instructions than baseline.
  • Change vs Baseline (Throughput) is computed from native throughput; positive means faster than baseline.

@xiaokamikami xiaokamikami force-pushed the perf/hotpath-bookkeeping-fastskip branch from dea1487 to c67be96 Compare June 29, 2026 02:17
@github-actions

Copy link
Copy Markdown

NEMU Performance Results - XS Interpreter

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions) Change vs Baseline (Throughput)
bitmanip.bin 1.385e+05 4.548e+07 3.045e+07 3.302e+07 5.199e+07 2.917e+07 +12.53% +13.18%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 1.356e+08 2.474e+08 2.343e+08 1.783e+08 1.763e+08 +23.95% +32.89%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 1.354e+08 2.507e+08 2.384e+08 1.777e+08 1.797e+08 +23.83% +32.72%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 1.326e+08 2.289e+08 2.244e+08 1.749e+08 1.699e+08 +24.18% +32.12%
amtest-riscv64-xs.bin 1.587e+04 8.456e+06 1.877e+07 2.606e+07 8.738e+06 1.696e+07 +3.23% +53.69%
aliastest-riscv64-xs.bin 1.376e+03 7.682e+06 1.791e+06 3.207e+06 7.715e+06 3.593e+06 +0.42% -10.72%
softprefetchtest-riscv64-xs.bin 2.643e+03 7.716e+06 3.425e+06 5.783e+06 7.768e+06 1.218e+07 +0.67% -52.52%
zacas-riscv64-xs.bin 6.470e+04 1.129e+07 5.731e+07 1.685e+07 1.233e+07 1.957e+07 +8.46% -13.86%
linux-hello 6.677e+07 1.097e+10 6.089e+07 6.657e+07 1.682e+10 4.416e+07 +34.79% +50.74%

NEMU Performance Results - XS Ref Shared Object

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions) Change vs Baseline (Throughput)
bitmanip.bin 1.385e+05 1.086e+09 1.276e+06 1.080e+06 1.094e+09 1.101e+06 +0.77% -1.91%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 6.343e+09 5.288e+06 4.360e+06 6.387e+09 4.324e+06 +0.68% +0.82%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 6.372e+09 5.327e+06 4.522e+06 6.415e+09 4.587e+06 +0.68% -1.41%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 5.992e+09 5.064e+06 4.311e+06 6.036e+09 4.108e+06 +0.72% +4.95%
amtest-riscv64-xs.bin 1.588e+04 3.411e+07 4.654e+06 1.792e+06 3.435e+07 1.810e+06 +0.71% -0.99%
aliastest-riscv64-xs.bin 1.379e+03 4.817e+06 2.863e+06 8.851e+05 4.851e+06 7.939e+05 +0.70% +11.49%
softprefetchtest-riscv64-xs.bin 2.646e+03 6.898e+06 3.836e+06 1.342e+06 6.938e+06 1.438e+06 +0.58% -6.69%
zacas-riscv64-xs.bin 6.471e+04 1.279e+08 5.058e+06 2.123e+06 1.288e+08 2.248e+06 +0.66% -5.59%
linux-hello 7.522e+07 6.608e+11 1.138e+06 1.157e+06 6.673e+11 1.105e+06 +0.98% +4.77%
  • Host Instructions is measured by DynamoRIO's inscount client.
  • Estimated Host Throughput assumes a fixed 4GHz CPU and IPC=2.5.
  • Actual NEMU Throughput is a single native NEMU run and may vary with host CPU performance.
  • Baseline columns are populated on pull_request runs when the PR base contains the same defconfig.
  • Change vs Baseline (Instructions) is computed from host instruction count; positive means fewer host instructions than baseline.
  • Change vs Baseline (Throughput) is computed from native throughput; positive means faster than baseline.

@xiaokamikami xiaokamikami force-pushed the perf/hotpath-bookkeeping-fastskip branch from c67be96 to fbdd265 Compare July 7, 2026 09:49
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

NEMU Performance Results - XS Interpreter

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions)
bitmanip.bin 1.385e+05 4.548e+07 3.045e+07 1.918e+07 5.199e+07 2.666e+07 +12.52%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 1.356e+08 2.474e+08 2.148e+08 1.783e+08 1.699e+08 +23.95%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 1.354e+08 2.507e+08 2.282e+08 1.777e+08 1.700e+08 +23.83%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 1.326e+08 2.289e+08 1.882e+08 1.749e+08 1.559e+08 +24.18%
amtest-riscv64-xs.bin 1.587e+04 8.456e+06 1.877e+07 1.991e+07 8.738e+06 1.878e+07 +3.23%
aliastest-riscv64-xs.bin 1.376e+03 7.682e+06 1.791e+06 3.222e+06 7.715e+06 2.626e+06 +0.42%
softprefetchtest-riscv64-xs.bin 2.643e+03 7.716e+06 3.425e+06 1.436e+07 7.765e+06 5.152e+06 +0.64%
zacas-riscv64-xs.bin 6.470e+04 1.129e+07 5.731e+07 1.579e+07 1.233e+07 1.190e+07 +8.47%
rvv-workload-suite 4.566e+04 8.949e+07 5.102e+06 6.201e+06 1.081e+08 6.354e+06 +17.20%
linux-hello 6.677e+07 1.097e+10 6.089e+07 6.818e+07 1.682e+10 4.819e+07 +34.79%

NEMU Performance Results - XS Ref Shared Object

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions)
bitmanip.bin 1.385e+05 1.086e+09 1.276e+06 8.747e+05 1.094e+09 7.192e+05 +0.77%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 6.343e+09 5.288e+06 3.467e+06 6.387e+09 3.270e+06 +0.68%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 6.372e+09 5.327e+06 3.808e+06 6.415e+09 3.315e+06 +0.68%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 5.992e+09 5.064e+06 4.368e+06 6.036e+09 4.463e+06 +0.72%
amtest-riscv64-xs.bin 1.588e+04 3.411e+07 4.654e+06 1.557e+06 3.435e+07 1.794e+06 +0.71%
aliastest-riscv64-xs.bin 1.379e+03 4.816e+06 2.863e+06 4.684e+05 4.851e+06 6.282e+05 +0.72%
softprefetchtest-riscv64-xs.bin 2.646e+03 6.897e+06 3.836e+06 9.611e+05 6.939e+06 1.312e+06 +0.59%
zacas-riscv64-xs.bin 6.471e+04 1.279e+08 5.058e+06 2.036e+06 1.288e+08 1.950e+06 +0.66%
rvv-workload-suite 4.568e+04 4.107e+08 1.112e+06 5.549e+05 4.298e+08 5.704e+05 +4.46%
linux-hello 7.522e+07 6.608e+11 1.138e+06 1.100e+06 6.673e+11 1.093e+06 +0.98%
  • Host Instructions is measured by DynamoRIO's inscount client.
  • Estimated Host Throughput assumes a fixed 4GHz CPU and IPC=2.5.
  • Actual NEMU Throughput is a single native NEMU run and may vary with host CPU performance.
  • Baseline columns are populated on pull_request runs when the PR base contains the same defconfig.
  • Change vs Baseline (Instructions) is computed from host instruction count; positive means fewer host instructions than baseline.

The normal performance path often runs with per-BB profiling, checkpoint generation, and mcontrol6 triggers inactive, but execute, trigger, and basic-block lookup code still paid repeated bookkeeping overhead before discovering that no slow-path work was needed.

This keeps guest execution, difftest stepping, trigger semantics, and checkpoint/profiling behavior unchanged. It only avoids entering bookkeeping paths when their controlling runtime state says no work is pending; when profiling, checkpointing, or triggers are active, the existing slow paths remain available.

Aggregate measurements with absolute host instructions:

- PERF_OPT=ON cumulative node: 111.399B -> 100.030B, CI Change vs Previous (Instructions) +10.21%

- PERF_OPT=OFF ref-so-runner 9-workload node: 134.711B -> 127.912B, CI Change vs Previous (Instructions) +5.05%
@xiaokamikami xiaokamikami force-pushed the perf/hotpath-bookkeeping-fastskip branch from fbdd265 to 8190608 Compare July 9, 2026 02:30
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

NEMU Performance Results - XS Interpreter

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions)
bitmanip.bin 1.385e+05 5.097e+07 2.718e+07 2.411e+07 5.747e+07 2.181e+07 +11.32%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 1.522e+08 2.204e+08 1.505e+08 1.946e+08 1.731e+08 +21.82%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 1.518e+08 2.235e+08 2.000e+08 1.940e+08 1.306e+08 +21.71%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 1.491e+08 2.036e+08 1.972e+08 1.911e+08 1.258e+08 +22.01%
amtest-riscv64-xs.bin 1.587e+04 8.552e+06 1.856e+07 1.674e+07 8.830e+06 1.528e+07 +3.15%
aliastest-riscv64-xs.bin 1.376e+03 7.695e+06 1.788e+06 3.092e+06 7.730e+06 3.163e+06 +0.45%
softprefetchtest-riscv64-xs.bin 2.643e+03 7.734e+06 3.417e+06 4.549e+06 7.783e+06 6.263e+06 +0.63%
zacas-riscv64-xs.bin 6.470e+04 1.162e+07 5.566e+07 1.031e+07 1.266e+07 1.997e+07 +8.19%
rvv-workload-suite 4.566e+04 9.258e+07 4.931e+06 8.328e+06 1.112e+08 5.293e+06 +16.72%
linux-hello 6.677e+07 1.105e+10 6.041e+07 6.651e+07 1.690e+10 4.692e+07 +34.59%

NEMU Performance Results - XS Ref Shared Object

Test Guest Instructions Host Instructions Estimated Host Throughput (instr/s) Actual NEMU Throughput (instr/s) Baseline Host Instructions Baseline Actual NEMU Throughput (instr/s) Change vs Baseline (Instructions)
bitmanip.bin 1.385e+05 1.089e+09 1.272e+06 1.054e+06 1.097e+09 1.136e+06 +0.77%
coremark-riscv64-xs-rv64gc-o2.bin 3.354e+06 6.403e+09 5.238e+06 4.371e+06 6.447e+09 4.660e+06 +0.68%
coremark-riscv64-xs-rv64gc-o3.bin 3.394e+06 6.432e+09 5.277e+06 4.518e+06 6.475e+09 4.375e+06 +0.67%
coremark-riscv64-xs-rv64gcb-o3.bin 3.035e+06 6.046e+09 5.019e+06 4.189e+06 6.090e+09 4.411e+06 +0.71%
amtest-riscv64-xs.bin 1.588e+04 3.439e+07 4.616e+06 1.623e+06 3.464e+07 1.658e+06 +0.70%
aliastest-riscv64-xs.bin 1.379e+03 4.842e+06 2.848e+06 7.894e+05 4.877e+06 7.486e+05 +0.71%
softprefetchtest-riscv64-xs.bin 2.646e+03 6.946e+06 3.809e+06 9.925e+05 6.987e+06 1.209e+06 +0.59%
zacas-riscv64-xs.bin 6.471e+04 1.291e+08 5.012e+06 2.042e+06 1.300e+08 2.054e+06 +0.66%
rvv-workload-suite 4.568e+04 4.120e+08 1.109e+06 6.294e+05 4.311e+08 6.340e+05 +4.44%
linux-hello 7.522e+07 6.618e+11 1.137e+06 1.122e+06 6.683e+11 1.125e+06 +0.97%
  • Host Instructions is measured by DynamoRIO's inscount client.
  • Estimated Host Throughput assumes a fixed 4GHz CPU and IPC=2.5.
  • Actual NEMU Throughput is a single native NEMU run and may vary with host CPU performance.
  • Baseline columns are populated on pull_request runs when the PR base contains the same defconfig.
  • Change vs Baseline (Instructions) is computed from host instruction count; positive means fewer host instructions than baseline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant