From 365524332f71b7f2685123d49ea1c942573cb3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Fri, 18 Oct 2019 00:00:00 +0000 Subject: [PATCH] 59f96b192a653f4980f19478320a4cb29533b794 --- index.html | 108 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 87 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index 900574f..02a4511 100644 --- a/index.html +++ b/index.html @@ -1098,16 +1098,17 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b
  • 19.2.3. Interesting benchmarks @@ -7557,7 +7558,10 @@ qemu-x86_64: /path/to/linux-kernel-module-cheat/submodules/qemu/accel/tcg/cpu-ex

    Let’s see if user mode runs considerably faster than full system or not.

    -

    First we build Dhrystone manually statically since dynamic linking is broken in gem5 as explained at: Section 10.6, “gem5 syscall emulation mode”.

    +

    First we build Dhrystone manually statically since dynamic linking is broken in gem5 as explained at: Section 10.6, “gem5 syscall emulation mode”.

    +
    +
    +

    TODO: move this section to our new custom dhrystone setup: Section 19.2.3.1, “Dhrystone”.

    gem5 user mode:

    @@ -17467,7 +17471,7 @@ root

    OK, this is why we used gem5 in the first place, performance measurements!

    -

    Let’s see how many cycles Dhrystone, which Buildroot provides, takes for a few different input parameters.

    +

    Let’s see how many cycles Dhrystone, which Buildroot provides, takes for a few different input parameters.

    We will do that for various input parameters on full system by taking a checkpoint after the boot finishes a fast atomic CPU boot, and then we will restore in a more detailed mode and run the benchmark:

    @@ -18150,7 +18154,69 @@ m5 dumpstats

    There are not yet enabled, but it should be easy to so, see: Section 20.5, “Add new Buildroot packages”

    -
    19.2.3.1. BST vs heap vs hashmap
    +
    19.2.3.1. Dhrystone
    + +
    +

    Created in the 80’s, it is not a representative measure of performance in modern computers anymore. It has mostly been replaced by SPEC, which is…​ closed source! Unbelievable.

    +
    +
    +

    Buildroot has a dhrystone package, but because it is so interesting to us, we decided to also build it ourselves, which allows things like static and baremetal compilation more easily.

    +
    +
    +

    Build and run on QEMU User mode simulation:

    +
    +
    +
    +
    git submodule update --init submodules/dhrystone
    +./build-dhrystone --mode userland
    +./run --userland "$(./getvar userland_build_dir)/submodules/dhrystone/dhrystone"
    +
    +
    +
    +

    Build and run on gem5 use mode:

    +
    +
    +
    +
    ./build-dhrystone --mode userland --static --force-rebuild
    +./run --emulator gem5 --userland "$(./getvar userland_build_dir)/submodules/dhrystone/dhrystone"
    +
    +
    +
    +

    TODO automate run more nicely.

    +
    +
    +

    Build for Baremetal execution and run it in baremetal QEMU:

    +
    +
    +
    +
    ./build-dhrystone --arch aarch64 --mode baremetal
    +./run --arch aarch64 --baremetal "$(./getvar baremetal_build_dir)/submodules/dhrystone/dhrystone"
    +
    +
    +
    +

    TODO: fix the build, just need to factor out all run arguments from build-baremetal into common.py and it should just work, no missing syscalls.

    +
    +
    +

    If you really want the Buildroot package for some reason, build it with:

    +
    +
    +
    +
    ./build-buildroot --config 'BR2_PACKAGE_DHRYSTONE=y'
    +
    +
    +
    +

    and run inside the guest from PATH with:

    +
    +
    +
    +
    dhrystone
    +
    +
    +
    +
    +
    19.2.3.2. BST vs heap vs hashmap

    The following benchmark setup works both:

    @@ -18263,7 +18329,7 @@ xdg-open bst_vs_heap_vs_hashmap_gem5.tmp.png
    -
    19.2.3.2. BLAS
    +
    19.2.3.3. BLAS

    Buildroot supports it, which makes everything just trivial:

    @@ -18315,7 +18381,7 @@ cblas_dgemm( CblasColMajor, CblasNoTrans, CblasTrans,3,3,2 ,1, A,3, B,
    -
    19.2.3.3. Eigen
    +
    19.2.3.4. Eigen

    Header only linear algebra library with a mainline Buildroot package:

    @@ -18353,7 +18419,7 @@ cblas_dgemm( CblasColMajor, CblasNoTrans, CblasTrans,3,3,2 ,1, A,3, B,
    -
    19.2.3.4. PARSEC benchmark
    +
    19.2.3.5. PARSEC benchmark

    We have ported parts of the PARSEC benchmark for cross compilation at: https://github.com/cirosantilli/parsec-benchmark See the documentation on that repo to find out which benchmarks have been ported. Some of the benchmarks were are segfaulting, they are documented in that repo.

    @@ -18371,7 +18437,7 @@ cblas_dgemm( CblasColMajor, CblasNoTrans, CblasTrans,3,3,2 ,1, A,3, B,
    -
    19.2.3.4.1. PARSEC benchmark without parsecmgmt
    +
    19.2.3.5.1. PARSEC benchmark without parsecmgmt
    ./build --arch arm --download-dependencies gem5-buildroot parsec-benchmark
    @@ -18405,7 +18471,7 @@ cblas_dgemm(      CblasColMajor, CblasNoTrans, CblasTrans,3,3,2  ,1,    A,3,  B,
     
    -
    19.2.3.4.2. PARSEC change the input size
    +
    19.2.3.5.2. PARSEC change the input size

    Running a benchmark of a size different than test, e.g. simsmall, requires a rebuild with:

    @@ -18469,7 +18535,7 @@ cblas_dgemm( CblasColMajor, CblasNoTrans, CblasTrans,3,3,2 ,1, A,3, B,
    -
    19.2.3.4.3. PARSEC benchmark with parsecmgmt
    +
    19.2.3.5.3. PARSEC benchmark with parsecmgmt

    Most users won’t want to use this method because:

    @@ -18532,7 +18598,7 @@ parsecmgmt -a run -p splash2x.fmm -i test
    -
    19.2.3.4.4. PARSEC uninstall
    +
    19.2.3.5.4. PARSEC uninstall

    If you want to remove PARSEC later, Buildroot doesn’t provide an automated package removal mechanism as mentioned at: Section 20.6, “Remove Buildroot packages”, but the following procedure should be satisfactory:

    @@ -18550,7 +18616,7 @@ parsecmgmt -a run -p splash2x.fmm -i test
    -
    19.2.3.4.5. PARSEC benchmark hacking
    +
    19.2.3.5.5. PARSEC benchmark hacking

    If you end up going inside submodules/parsec-benchmark to hack up the benchmark (you will!), these tips will be helpful.

    @@ -20701,7 +20767,7 @@ make menuconfig

    Also mentioned at: https://stackoverflow.com/questions/47320800/how-to-clean-only-target-in-buildroot

    -

    See this for a sample manual workaround: Section 19.2.3.4.4, “PARSEC uninstall”.

    +

    See this for a sample manual workaround: Section 19.2.3.5.4, “PARSEC uninstall”.