Skip to content

riscv_dis_opts_batch_1

Tsukasa OI edited this page Jul 30, 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 (commit 8e883b5e112).

objdump -d (ELF)

Program Improvements Notes
Busybox 1.35.1 (RV64GC) 29.0-32.8%
OpenSBI 1.1 (generic fw_*.elf) 42.3-42.5%
Linux kernel 5.18 (vmlinux) 27.3-29.2%
Linux kernel 5.18 (vmlinux.o) 2.5-14.8% Not finally linked
glibc (libc.so.6) 26.7-30.5%

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

objdump -d (ELF-based archive)

Program Improvements
glibc (libc.a) 6.5-7.2%
newlib (libc.a) 7.0-10.6%

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

objdump -D (binary)

Program Improvements
Linux kernel 5.18 (vmlinux) 73.3-101.1%
Random files (/dev/urandom) 91.9-113.9%
1M (1048576) CSR instructions 374.1%

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 91.6%
OpenSBI 1.1 (generic fw_*.elf) 80.0-80.5%
1M (1048576) CSR instructions (ELF) 220.1%

Batch: objdump -d on Linux distribution

Serial Run: All /usr/bin Programs

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 563 25.2%
Debian unstable (as of 2022-07-20) 269 25.4%

Parallel Run: Top 100 in Size (including data-only ELFs)

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 100 13.0%
Debian unstable (as of 2022-07-20) 100 5.0%

Parallel Run: All (including data-only ELFs)

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

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

Serial Run: All /usr/bin Programs

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 563 50.0%
Debian unstable (as of 2022-07-20) 269 42.1%

Parallel Run: Top 100 in Size (including data-only ELFs)

System N Improvements
Ubuntu 22.04 LTS (image for HiFive Unmatched) 100 70.5%
Debian unstable (as of 2022-07-20) 100 50.0%

Parallel Run: All (including data-only ELFs)

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