Skip to content

riscv_dis_opts_batch_1

Tsukasa OI edited this page Nov 26, 2022 · 18 revisions

Disassembler: Core improvements and optimizations (batch 1)

Conflicts With

Based On

Feature Summary

To improve the core disassembler (both for performance and feature), this patchset now implements several optimizations for further performance on objdump and GDB.

It will be a prerequisite of upcoming core disassembler changes:

Changes in this Patchset:

Benchmarking System

This benchmark is performed on:

  • Ubuntu 22.04 LTS
  • AMD Ryzen 5 PRO 5650G processor

In the parallel run, I ran 6 parallel jobs with -j6 (corresponding 6 cores; although the processor has 12 hardware threads, -j12 just slowed the benchmark).

Aggregate Performance Improvements

On disassembling linked RISC-V ELF programs using objdump, performance improvements achieved by this patchset is usually about 25-33%. Isn't it nice to have?

Note that a few percent may be compensated by future non-performance changes. In fact, some performance changes for objdump -d hurts GDB performance a bit because of extra initialization (which is caused per instruction on the current GDB design).

This is relative to the latest master at the time of the benchmack (commit b82817674f4).

objdump -d (ELF)

Program Improvements Notes
Busybox 1.35.1 (RV64GC) 30.6-32.9%
OpenSBI 1.1 (generic fw_*.elf) 43.7-43.9%
Linux kernel 5.18 (vmlinux) 28.4-30.2%
Linux kernel 5.18 (vmlinux.o) 3.3-15.7% Not finally linked
glibc (libc.so.6) 28.0-32.8%

Due to extra overhead handling many debugging information and symbols, disassembling *.o will be relatively slower.

Some overhead will be handled in the next batch of the disassembler optimization.

objdump -d (ELF-based archive)

Program Improvements
glibc (libc.a) 8.4-8.7%
newlib (libc.a) 9.4-13.2%

Due to extra archive file handling, disassembler performance improvements are not large enough.

Some overhead will be handled in the next batch of the disassembler optimization.

objdump -D (binary)

Program Improvements
Linux kernel 5.18 (vmlinux) 69.8-95.6%
Random files (/dev/urandom) 92.2-114.7%
1M (1048576) CSR instructions 378.8%

gdb: disas of near all code region

Program Improvements
Linux kernel 5.18 (vmlinux) with debug info 30.8%
Linux kernel 5.18 (vmlinux) without debug info 90.2%
OpenSBI 1.1 (generic fw_*.elf) 65.8-66.4%
1M (1048576) CSR instructions (ELF) 204.1%

Batch: objdump -d on Linux distribution

Serial Run: All ELF Files Under the Directory

System Path N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) /usr/bin 563 27.2%
Debian unstable (as of 2022-07-20) /usr/bin 269 27.4%
Ubuntu 22.04 LTS (image for HiFive Unmatched) /usr/lib 6797 16.2%
Debian unstable (as of 2022-07-20) /usr/lib 548 12.1%

Parallel Run: All (including data-only ELFs)

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 7666 13.8%
Debian unstable (as of 2022-07-20) 946 6.7%

Batch: objdump -D (as binary) on Linux distribution

Serial Run: All ELF Files Under the Directory

System Path N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) /usr/bin 563 50.5%
Debian unstable (as of 2022-07-20) /usr/bin 269 43.4%

Parallel Run: All (including data-only ELFs)

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 7666 58.1%
Debian unstable (as of 2022-07-20) 946 45.3%
Clone this wiki locally