diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fc69c486b..692aa0df4f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Build ETISS and run smoke tests on: [push, pull_request] @@ -6,442 +6,137 @@ env: BUILD_TYPE: Release jobs: - build: - strategy: - matrix: - config: - - {name: "Linux", os: ubuntu-latest, cmakegen: "", llvm: "linux-gnu-ubuntu-20.04", llvm-ext: ".tar.xz", tc: "linux-ubuntu14", tc-ext: ".tar.gz", unpack: "tar xf"} - #- {name: "Windows", os: windows-latest, cmakegen: "-G \"Unix Makefiles\" -DCMAKE_MAKE_PROGRAM=make", llvm: "", llvm-ext: "", tc: "w64-mingw32", tc-ext: ".zip", unpack: "unzip"} - #- {name: "Mac", os: macos-10.15, cmakegen: "", llvm: "apple-darwin", llvm-ext: ".tar.xz", tc: "apple-darwin", tc-ext: ".tar.gz", unpack: "tar xf"} - - runs-on: ${{ matrix.config.os }} - name: ${{ matrix.config.name }}_build + build_etiss: + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + path: etiss_source - - name: Requirements (Linux) - if: matrix.config.name == 'Linux' - run: | - sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-program-options-dev - - - name: Requirements (Windows) - if: matrix.config.name == 'Windows' - working-directory: ${{runner.workspace}} - shell: bash + - name: Install build dependencies run: | - choco install boost-msvc-14.2 - choco install wget unzip - choco install llvm --version=11.0.0 --allow-downgrade - choco install make - ln -s "/c/Program Files/LLVM" llvm-lib + sudo apt-get update + sudo apt-get install -y libboost-filesystem-dev libboost-program-options-dev \ + llvm-11-dev libclang-11-dev clang-11 - - name: Requirements (Mac) - if: matrix.config.name == 'Mac' + - name: CMake config run: | - brew install boost coreutils + cmake -B etiss_build -S etiss_source -DCMAKE_INSTALL_PREFIX=etiss_prebuilt -DCMAKE_BUILD_TYPE=$BUILD_TYPE - - name: Requirements (Linux/Mac) - if: matrix.config.name == 'Linux' || matrix.config.name == 'Mac' - working-directory: ${{runner.workspace}} - shell: bash + - name: CMake build run: | - LLVM_NAME="clang+llvm-11.0.0-x86_64-${{ matrix.config.llvm }}" - wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/$LLVM_NAME${{ matrix.config.llvm-ext }} - ${{ matrix.config.unpack }} $LLVM_NAME${{ matrix.config.llvm-ext }} - mv $LLVM_NAME llvm-lib + cmake --build etiss_build -j$(nproc) - - name: Requirements - shell: bash - working-directory: ${{runner.workspace}} + - name: CMake install run: | - TC_NAME="riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-${{ matrix.config.tc }}" - wget https://static.dev.sifive.com/dev-tools/$TC_NAME${{ matrix.config.tc-ext }} - ${{ matrix.config.unpack }} $TC_NAME${{ matrix.config.tc-ext }} - mv $TC_NAME riscv-tc + cmake --build etiss_build --target install - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/build + - name: Upload compiled ETISS + uses: actions/upload-artifact@v4 + with: + name: etiss_prebuilt + path: etiss_prebuilt - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/build - run: | - export LLVM_DIR=${{runner.workspace}}/llvm-lib - cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=../install + build_examples: + runs-on: ubuntu-22.04 - - name: Build - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake --build . --config $BUILD_TYPE + strategy: + matrix: + bits: ["32", "64"] - - name: Install - working-directory: ${{runner.workspace}}/build - shell: bash - run: cmake --build . --config $BUILD_TYPE --target install + steps: + - uses: actions/checkout@v4 + with: + repository: tum-ei-eda/etiss_riscv_examples + path: examples_source - - name: Create Test Build Environment + - name: Install cross compiler run: | - cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv/build - cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv/build64 - cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv_cpp/build - cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv_cpp/build64 - cmake -E make_directory ${{runner.workspace}}/install/examples/SW/riscv_dhry/build + wget https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz + tar xf xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz + mv xpack-riscv-none-elf-gcc-13.2.0-2 riscv_tc - - name: Setup tests - working-directory: ${{runner.workspace}}/install/examples - shell: bash + - name: Configure examples run: | - cd SW/riscv/build - cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf ${{matrix.config.cmakegen}} - cmake --build . --config $BUILD_TYPE - cd - - cd SW/riscv/build64 - cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf -DRISCV_ARCH=rv64gc -DRISCV_ABI=lp64d ${{matrix.config.cmakegen}} - cmake --build . --config $BUILD_TYPE - cd - - cd SW/riscv_cpp/build - cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf ${{matrix.config.cmakegen}} - cmake --build . --config $BUILD_TYPE - cd - - cd SW/riscv_cpp/build64 - cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf -DRISCV_ARCH=rv64gc -DRISCV_ABI=lp64d ${{matrix.config.cmakegen}} - cmake --build . --config $BUILD_TYPE - cd - - cd SW/riscv_dhry/build - cmake .. -DRISCV_ELF_GCC_PREFIX=../../../../../riscv-tc -DRISCV_ELF_GCC_BASENAME=riscv64-unknown-elf ${{matrix.config.cmakegen}} - cmake --build . --config $BUILD_TYPE + cmake -B examples_build_rv${{matrix.bits}} -S examples_source -DCMAKE_TOOLCHAIN_FILE=rv${{matrix.bits}}gc-toolchain.cmake -DRISCV_TOOLCHAIN_BASENAME=riscv-none-elf -DRISCV_TOOLCHAIN_PREFIX=$GITHUB_WORKSPACE/riscv_tc -DCMAKE_INSTALL_PREFIX=examples_prebuilt_rv${{matrix.bits}} -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - name: Build examples + run: | + cmake --build examples_build_rv${{matrix.bits}} -j$(nproc) - - name: Compress Compiled System - run: tar -C ${{runner.workspace}} -cvf ${{runner.workspace}}/etiss.tar install + - name: Install examples + run: | + cmake --build examples_build_rv${{matrix.bits}} --target install - - name: Upload Compiled System + - name: Upload prebuilt examples uses: actions/upload-artifact@v4 with: - name: etiss-${{matrix.config.name}}.tar - path: ${{runner.workspace}}/etiss.tar + name: examples_prebuilt_rv${{matrix.bits}} + path: examples_prebuilt_rv${{matrix.bits}} + + run_examples: + runs-on: ubuntu-22.04 + needs: [build_etiss, build_examples] - test: strategy: matrix: - config: - - {name: "Linux", os: ubuntu-latest, cmakegen: "", llvm: "linux-gnu-ubuntu-20.04", llvm-ext: ".tar.xz", tc: "linux-ubuntu14", tc-ext: ".tar.gz", unpack: "tar xf"} - #- {name: "Windows", os: windows-latest, cmakegen: "-G \"MinGW Makefiles\"", llvm: "", llvm-ext: "", tc: "w64-mingw32", tc-ext: ".zip", unpack: "unzip"} - #- {name: "Mac", os: macos-10.15, cmakegen: "", llvm: "apple-darwin", llvm-ext: ".tar.xz", tc: "apple-darwin", tc-ext: ".tar.gz", unpack: "tar xf"} - - needs: build - runs-on: ${{ matrix.config.os }} - name: ${{ matrix.config.name }}_test + bits: ["32", "64"] + jit_engine: ["TCC", "GCC", "LLVM"] + test_program: ["example_c", "example_cpp", "test_cases"] steps: - - name: Fetch Compiled System + - name: Fetch precompiled artifacts uses: actions/download-artifact@v4 - with: - name: etiss-${{matrix.config.name}}.tar - path: ${{runner.workspace}} - - - name: Unpack Compiled System - working-directory: ${{runner.workspace}} - run: tar -xf etiss.tar - - name: Requirements (Linux) - if: matrix.config.name == 'Linux' + - name: Install dependencies run: | - sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-program-options-dev + sudo apt-get update + sudo apt-get install -y libboost-filesystem-dev libboost-program-options-dev libllvm11 - # - name: Requirements (Windows) - # if: matrix.config.name == 'Windows' - # working-directory: ${{runner.workspace}} - # shell: bash - # run: | - # choco install boost-msvc-14.2 - # choco install wget unzip - # choco install llvm --version=11.0.0 --allow-downgrade - # choco install make - # ln -s "/c/Program Files/LLVM" llvm-lib - - - name: Requirements (Mac) - if: matrix.config.name == 'Mac' - run: | - brew install boost coreutils - - - name: Test (Linux/Mac) - working-directory: ${{runner.workspace}}/install/bin - if: matrix.config.name == 'Linux' - shell: bash + - name: Run test run: | - ./run_helper.sh ../examples/SW/riscv/build/riscv_example.elf noloop - ./run_helper.sh ../examples/SW/riscv/build/riscv_example.elf gcc noloop - ./run_helper.sh ../examples/SW/riscv/build/riscv_example.elf llvm noloop - ./run_helper.sh ../examples/SW/riscv_cpp/build/riscv_example.elf noloop - ./run_helper.sh ../examples/SW/riscv_cpp/build/riscv_example.elf gcc noloop - ./run_helper.sh ../examples/SW/riscv_cpp/build/riscv_example.elf llvm noloop - ./run_helper.sh ../examples/SW/riscv/build64/riscv_example.elf noloop - ./run_helper.sh ../examples/SW/riscv_cpp/build64/riscv_example.elf noloop + chmod +x etiss_prebuilt/bin/bare_etiss_processor + etiss_prebuilt/bin/bare_etiss_processor -iexamples_prebuilt_rv${{matrix.bits}}/ini/${{matrix.test_program}}.ini --jit.type=${{matrix.jit_engine}}JIT - # - name: Test (Windows) - # working-directory: ${{runner.workspace}}/install/examples/bare_etiss_processor/build - # if: matrix.config.name == 'Windows' - # shell: bash - # run: | - # PATH=$PATH:/d/a/etiss/install/lib/ - # cd $BUILD_TYPE - # ./main.exe --vp.elf_file=../../../SW/riscv/build/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv/memsegs.ini -pLogger - # ./main.exe --vp.elf_file=../../../SW/riscv/build/riscv_example.elf --jit.type=LLVMJIT --etiss.loglevel=4 -i../../../SW/riscv/memsegs.ini -pLogger - # ./main.exe --vp.elf_file=../../../SW/riscv_cpp/build/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv_cpp/memsegs.ini -pLogger - # ./main.exe --vp.elf_file=../../../SW/riscv_cpp/build/riscv_example.elf --jit.type=LLVMJIT --etiss.loglevel=4 -i../../../SW/riscv_cpp/memsegs.ini -pLogger - # ./main.exe --vp.elf_file=../../../SW/riscv/build64/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv/memsegs.ini -pLogger - # ./main.exe --vp.elf_file=../../../SW/riscv_cpp/build64/riscv_example.elf --jit.type=TCCJIT --etiss.loglevel=4 -i../../../SW/riscv_cpp/memsegs.ini -pLogger + run_benchmarks: + runs-on: ubuntu-22.04 + needs: [build_etiss, build_examples] - benchmark: strategy: matrix: - run-no: [1, 2, 3, 4, 5] - jit-engine: ["tcc", "gcc", "llvm"] - - if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'pull_request' - needs: build - runs-on: ubuntu-latest + bits: ["32", "64"] + jit_engine: ["TCC", "GCC", "LLVM"] + run_no: [1, 2, 3, 4, 5] steps: - - name: Fetch Compiled System + - name: Fetch precompiled artifacts uses: actions/download-artifact@v4 - with: - name: etiss-Linux.tar - path: ${{runner.workspace}} - - - name: Unpack Compiled System - working-directory: ${{runner.workspace}} - run: tar -xf etiss.tar - - name: Requirements (Linux) + - name: Install dependencies run: | - sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-program-options-dev + sudo apt-get update + sudo apt-get install -y libboost-filesystem-dev libboost-program-options-dev libllvm11 - - name: create directory to store results - working-directory: ${{runner.workspace}} - run: mkdir ${{runner.workspace}}/results - - - name: Run Benchmarks - working-directory: ${{runner.workspace}}/install/bin + - name: Run benchmark run: | - ./run_helper.sh ../examples/SW/riscv_dhry/build/riscv_example ${{matrix.jit-engine}} noloop --vp.stats_file_path=${{runner.workspace}}/results/run.json - mv ${{runner.workspace}}/results/run.json ${{runner.workspace}}/results/run_${{matrix.jit-engine}}_${{matrix.run-no}}.json + chmod +x etiss_prebuilt/bin/bare_etiss_processor + etiss_prebuilt/bin/bare_etiss_processor -iexamples_prebuilt_rv${{matrix.bits}}/ini/dhry.ini --jit.type=${{matrix.jit_engine}}JIT --vp.stats_file_path=${{github.workspace}}/run_${{matrix.jit_engine}}_${{matrix.bits}}_${{matrix.run_no}}.json - - name: Save Benchmark Results + - name: Save Benchmark results uses: actions/upload-artifact@v4 with: - name: run_${{matrix.jit-engine}}_${{matrix.run-no}}.json - path: ${{runner.workspace}}/results/run_${{matrix.jit-engine}}_${{matrix.run-no}}.json + name: run_${{matrix.jit_engine}}_${{matrix.bits}}_${{matrix.run_no}} + path: run_${{matrix.jit_engine}}_${{matrix.bits}}_${{matrix.run_no}}.json - compare_mips: - needs: benchmark - runs-on: ubuntu-latest + merge_benchmark_results: + runs-on: ubuntu-22.04 + needs: run_benchmarks steps: - - uses: actions/checkout@v4 - - - name: Fetch results - uses: actions/download-artifact@v4 - with: - path: artifacts - - - name: Prepare files - run: | - rm -rf benchmark_results_new - mkdir benchmark_results_new - find artifacts -type f -name '*.json' -exec mv {} benchmark_results_new \; - find artifacts -type f -name '*.tar' -exec mv {} . \; - - - name: install dependencies - run: pip install -r script/requirements.txt - - - name: get old benchmark results - uses: actions/checkout@v4 - with: - ref: benchmark_results - path: benchmark_results_old - - - name: creating a directory results_ for storing wiki text, issue text and the graph - run: | - ls benchmark_results_new - rm -rf results_ - mkdir results_ - - - name: Run comparison (Push) - if: ${{github.event_name == 'push'}} - run: python3 script/compare.py benchmark_results_new/run_*.json -o benchmark_results_old/stats_file.json -i results_/issue.md -w results_/wiki.md -gr results_/performance_metrics.svg -g ${{ github.sha }} -r $GITHUB_REPOSITORY - - - name: Run comparison (PR) - if: ${{github.event_name == 'pull_request'}} - run: python3 script/compare.py benchmark_results_new/run_*.json -o benchmark_results_old/stats_file.json -i results_/issue.md -w results_/wiki.md -gr results_/performance_metrics.svg -g ${{ github.event.pull_request.head.sha }} -r $GITHUB_REPOSITORY - - - name: Deploy results to git - if: ${{github.event_name == 'push'}} - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./benchmark_results_old - publish_branch: benchmark_results - enable_jekyll: true - - - name: uploading benchmark_results - uses: actions/upload-artifact@v4 - with: - name: stats_file.json - - path: benchmark_results_old/stats_file.json - - - name: uploading image - uses: actions/upload-artifact@v4 - with: - name: performance_metrics.svg - path: results_/performance_metrics.svg - - - name: Upload comment text - uses: actions/upload-artifact@v4 - with: - name: issue.md - - path: results_/issue.md - - - name: Upload wiki text - uses: actions/upload-artifact@v4 - with: - name: wiki.md - path: results_/wiki.md - -# display-push: -# needs: compare_mips -# runs-on: ubuntu-latest -# if: ${{github.event_name == 'push'}} -# -# steps: -# - name: Get comment text -# uses: actions/download-artifact@v4 -# with: -# name: issue.md -# -# - name: Load comment body -# id: get-comment-body -# run: | -# body=$(cat issue.md) -# body="${body//'%'/'%25'}" -# body="${body//$'\n'/'%0A'}" -# body="${body//$'\r'/'%0D'}" -# echo ::set-output name=body::$body -# - name: Find Comment -# uses: peter-evans/find-comment@v1 -# id: fc -# with: -# issue-number: 19 -# -# body-includes: This comment was created automatically, please do not change! -# -# - name: Create comment -# if: ${{ steps.fc.outputs.comment-id == 0 }} -# uses: peter-evans/create-or-update-comment@v1 -# with: -# issue-number: 19 -# edit-mode: replace -# body: ${{ steps.get-comment-body.outputs.body }} -# -# - name: Update comment -# if: ${{ steps.fc.outputs.comment-id != 0 }} -# uses: peter-evans/create-or-update-comment@v1 -# with: -# comment-id: ${{ steps.fc.outputs.comment-id }} -# edit-mode: replace -# body: ${{ steps.get-comment-body.outputs.body }} - - display-pr: - needs: compare_mips - runs-on: ubuntu-latest - if: ${{github.event_name == 'pull_request'}} - - steps: - - name: Get comment text - uses: actions/download-artifact@v4 - with: - name: issue.md - - - name: Load comment body - id: get-comment-body - run: | - body=$(cat issue.md) - body="${body//'%'/'%25'}" - body="${body//$'\n'/'%0A'}" - body="${body//$'\r'/'%0D'}" - echo ::set-output name=body::$body - - - name: Find Comment - uses: peter-evans/find-comment@v1 - id: fc - with: - issue-number: ${{github.event.number}} - body-includes: This comment was created automatically, please do not change! - - - name: Create comment - if: ${{ steps.fc.outputs.comment-id == 0 }} - uses: peter-evans/create-or-update-comment@v1 - with: - issue-number: ${{github.event.number}} - edit-mode: replace - body: ${{ steps.get-comment-body.outputs.body }} - - - name: Update comment - if: ${{ steps.fc.outputs.comment-id != 0 }} - uses: peter-evans/create-or-update-comment@v1 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - edit-mode: replace - body: ${{ steps.get-comment-body.outputs.body }} - - - - display-wiki: - needs: compare_mips - runs-on: ubuntu-latest - if: ${{github.event_name == 'push'}} - - steps: - - name: Get comment text - uses: actions/download-artifact@v4 - with: - name: wiki.md - - - name: Get performance_metrics.svg - uses: actions/download-artifact@v4 - with: - name: performance_metrics.svg - - - name: Update wiki - run: | - echo "Cloning wiki repo https://github.com/$GITHUB_REPOSITORY.wiki.git" - git clone "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.wiki.git" "wiki" - cd wiki - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - rm -rf ./performance_metrics.svg - cp ../wiki.md ./Performance_Metrics.md - cp ../performance_metrics.svg ./performance_metrics.svg - git add Performance_Metrics.md performance_metrics.svg - git commit -m "update perf" - git push - - delete-artifact: - if: always() - needs: [display-wiki, display-pr, test] - runs-on: ubuntu-latest - continue-on-error: true - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Delete Artifact - uses: geekyeggo/delete-artifact@v2 - with: - name: "*" - useGlob: true + - name: Download artifacts + uses: actions/upload-artifact/merge@v4 + with: + name: dhry_results + pattern: run_* + delete-merged: true \ No newline at end of file