From 7032acd37c4c38659dc11410affeaa3a5a01091b Mon Sep 17 00:00:00 2001 From: tahaelbayad Date: Thu, 9 Jan 2025 14:17:44 +0100 Subject: [PATCH 1/7] add gvsoc as simulator for snitch platform --- .github/workflows/BuildDocker.yml | 2 +- .github/workflows/CI.yml | 22 +++++++++------ .github/workflows/TestRunnerCortexM.yml | 2 +- .github/workflows/TestRunnerGeneric.yml | 2 +- .github/workflows/TestRunnerMempool.yml | 2 +- .github/workflows/TestRunnerSiracusa.yml | 2 +- .github/workflows/TestRunnerSnitch.yml | 20 ++++++++------ .github/workflows/TestRunnerTiledSiracusa.yml | 2 +- .../TestRunnerTiledSiracusaSequential.yml | 2 +- .../TestRunnerTiledSiracusaWithNeureka.yml | 2 +- ...nnerTiledSiracusaWithNeurekaSequential.yml | 2 +- .../TestRunnerTiledSnitchSequential.yml | 27 ++++++++++--------- Container/Dockerfile | 5 ++++ .../SnitchProfileExecutionBlock.py | 2 +- DeeployTest/Platforms/Snitch/CMakeLists.txt | 1 + DeeployTest/Platforms/Snitch/main.c | 6 ++--- DeeployTest/testRunner_snitch.py | 2 +- DeeployTest/testRunner_tiled_snitch.py | 2 +- DeeployTest/testUtils/testRunner.py | 5 ++++ Makefile | 17 +++++++++++- cmake/simulation.cmake | 7 ++++- cmake/snitch/snitch.cmake | 13 +++++++++ 22 files changed, 102 insertions(+), 45 deletions(-) diff --git a/.github/workflows/BuildDocker.yml b/.github/workflows/BuildDocker.yml index 47f631e1..d07e90ad 100644 --- a/.github/workflows/BuildDocker.yml +++ b/.github/workflows/BuildDocker.yml @@ -38,4 +38,4 @@ jobs: file: Container/Dockerfile push: true # JUNGVI: If you operate from a fork and want to build a new docker make sure to replace 'pulp-platform' by your uname. - tags: ghcr.io/pulp-platform/deeploy:main + tags: ghcr.io/tahaelbayad/deeploy:main diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e359aaca..7524fc02 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: build-deeploy: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -104,6 +104,9 @@ jobs: TestRQAdd testRQGEMMTransB num-cores: 9 + simulators: | + banshee + gvsoc snitch-kernels-tiled-singlebuffer-L2: uses: ./.github/workflows/TestRunnerTiledSnitchSequential.yml @@ -131,6 +134,9 @@ jobs: "L1": [5000, 10000] } ] + simulators: | + banshee + gvsoc ### Mempool Tests ### mempool-kernels: @@ -543,7 +549,7 @@ jobs: deeploy-state-serialization: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -563,7 +569,7 @@ jobs: deeploy-memory-level-extension: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -583,7 +589,7 @@ jobs: deeploy-tiler-extension: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -607,7 +613,7 @@ jobs: deeploy-memory-allocation-extension: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -629,7 +635,7 @@ jobs: deeploy-typing: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -646,7 +652,7 @@ jobs: deeploy-regex-matching: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -663,7 +669,7 @@ jobs: linting: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerCortexM.yml b/.github/workflows/TestRunnerCortexM.yml index 5f0e523d..9d80f556 100644 --- a/.github/workflows/TestRunnerCortexM.yml +++ b/.github/workflows/TestRunnerCortexM.yml @@ -11,7 +11,7 @@ jobs: test-runner-cortexm: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerGeneric.yml b/.github/workflows/TestRunnerGeneric.yml index ce20fdae..c123ca51 100644 --- a/.github/workflows/TestRunnerGeneric.yml +++ b/.github/workflows/TestRunnerGeneric.yml @@ -11,7 +11,7 @@ jobs: test-runner-generic: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerMempool.yml b/.github/workflows/TestRunnerMempool.yml index e8414ffc..a1796679 100644 --- a/.github/workflows/TestRunnerMempool.yml +++ b/.github/workflows/TestRunnerMempool.yml @@ -11,7 +11,7 @@ jobs: test-runner-mempool: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerSiracusa.yml b/.github/workflows/TestRunnerSiracusa.yml index 0b8b8cc5..0143396c 100644 --- a/.github/workflows/TestRunnerSiracusa.yml +++ b/.github/workflows/TestRunnerSiracusa.yml @@ -14,7 +14,7 @@ jobs: test-runner-siracusa: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerSnitch.yml b/.github/workflows/TestRunnerSnitch.yml index c7ae8c09..89cb03f0 100644 --- a/.github/workflows/TestRunnerSnitch.yml +++ b/.github/workflows/TestRunnerSnitch.yml @@ -9,16 +9,15 @@ on: num-cores: required: true type: number - simulator: - required: false - default: "banshee" + simulators: + required: true type: string jobs: test-runner-snitch: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -29,11 +28,16 @@ jobs: - name: Run Test run: | testNames="${{ inputs.test-names }}" + simulators="${{inputs.simulators}}" cd DeeployTest - echo "$testNames" | while IFS= read -r testName; do - if [[ -n "$testName" ]]; then - echo "Running test: $testName" - python testRunner_snitch.py -t Tests/$testName --simulator=${{ inputs.simulator }} --cores=${{ inputs.num-cores }} --toolchain_install_dir /app/install/riscv-llvm/ + echo "$simulators" | while IFS= read -r simulator; do + if [[ -n "$simulator" ]]; then + echo "$testNames" | while IFS= read -r testName; do + if [[ -n "$testName" ]]; then + echo "Running test $testName using $simulator" + python testRunner_snitch.py -t Tests/$testName --simulator=$simulator --cores=${{ inputs.num-cores }} --toolchain_install_dir /app/install/riscv-llvm/ + fi + done fi done shell: bash \ No newline at end of file diff --git a/.github/workflows/TestRunnerTiledSiracusa.yml b/.github/workflows/TestRunnerTiledSiracusa.yml index 48a8cb39..9f101c63 100644 --- a/.github/workflows/TestRunnerTiledSiracusa.yml +++ b/.github/workflows/TestRunnerTiledSiracusa.yml @@ -32,7 +32,7 @@ jobs: L1: ${{ fromJSON(inputs.L1) }} runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSiracusaSequential.yml b/.github/workflows/TestRunnerTiledSiracusaSequential.yml index 684036a1..5e9e275f 100644 --- a/.github/workflows/TestRunnerTiledSiracusaSequential.yml +++ b/.github/workflows/TestRunnerTiledSiracusaSequential.yml @@ -24,7 +24,7 @@ jobs: test-runner-siracusa-tiled: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml b/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml index 143c9893..d16699f1 100644 --- a/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml +++ b/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml @@ -36,7 +36,7 @@ jobs: L1: ${{ fromJSON(inputs.L1) }} runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml b/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml index 32715987..c362d860 100644 --- a/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml +++ b/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml @@ -28,7 +28,7 @@ jobs: test-runner-siracusa-neureka-tiled: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSnitchSequential.yml b/.github/workflows/TestRunnerTiledSnitchSequential.yml index 10a101a9..83830225 100644 --- a/.github/workflows/TestRunnerTiledSnitchSequential.yml +++ b/.github/workflows/TestRunnerTiledSnitchSequential.yml @@ -14,9 +14,8 @@ on: required: false default: "L2" type: string - simulator: - required: false - default: "banshee" + simulators: + required: true type: string @@ -25,7 +24,7 @@ jobs: test-runner-snitch-tiled: runs-on: ubuntu-22.04 container: - image: ghcr.io/pulp-platform/deeploy:main + image: ghcr.io/tahaelbayad/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -43,18 +42,22 @@ jobs: key: ${{ runner.os }}-ccache - name: Run Tests run: | + simulators="${{inputs.simulators}}" cd DeeployTest echo '${{ inputs.tests-config }}' > tests.json mkdir -p /app/.ccache export CCACHE_DIR=/app/.ccache - - jq -c '.[]' tests.json | while read test; do - testName=$(echo "$test" | jq -r '.name') - L1_values=$(echo "$test" | jq -r '.L1[]') - for L1_value in $L1_values; do - echo "Running test: $testName with L1: $L1_value" - python testRunner_tiled_snitch.py -t Tests/$testName --cores=${{ inputs.num-cores }} --simulator=${{ inputs.simulator }} --l1 $L1_value --defaultMemLevel=${{ inputs.default-memory-level }} --toolchain_install_dir /app/install/riscv-llvm/ - done + echo "$simulators" | while IFS= read -r simulator; do + if [[ -n "$simulator" ]]; then + jq -c '.[]' tests.json | while read test; do + testName=$(echo "$test" | jq -r '.name') + L1_values=$(echo "$test" | jq -r '.L1[]') + for L1_value in $L1_values; do + echo "Running test: $testName with L1: $L1_value using $simulator" + python testRunner_tiled_snitch.py -t Tests/$testName --cores=${{ inputs.num-cores }} --simulator=$simulator --l1 $L1_value --defaultMemLevel=${{ inputs.default-memory-level }} --toolchain_install_dir /app/install/riscv-llvm/ + done + done + fi done shell: bash \ No newline at end of file diff --git a/Container/Dockerfile b/Container/Dockerfile index 2327af8e..ebd0d1f2 100644 --- a/Container/Dockerfile +++ b/Container/Dockerfile @@ -78,6 +78,7 @@ RUN make pulp-sdk RUN make qemu RUN make mempool RUN make banshee +RUN make gvsoc && cp -r /app/toolchain/gvsoc/core/requirements.txt /app/core-requirements.txt && cp -r /app/toolchain/gvsoc/gapy/requirements.txt /app/gapy-requirements.txt # Dependencies needed for compiling Snitch ## Bender's installaton @@ -114,6 +115,7 @@ ENV CMAKE=/usr/bin/cmake ENV PULP_SDK_HOME=/app/install/pulp-sdk ENV LLVM_INSTALL_DIR=/app/install/llvm ENV SNITCH_HOME=/app/install/snitch_cluster +ENV GVSOC_INSTALL_DIR=/app/install/gvsoc ENV MEMPOOL_HOME=/app/install/mempool ENV PATH=/app/install/qemu/bin:/app/install/banshee:$PATH ENV PATH="/root/.cargo/bin:${PATH}" @@ -140,6 +142,9 @@ pip install toml-to-requirements && \ toml-to-req --toml-file pyproject.toml && \ pip install -r requirements.txt +COPY --from=builder /app/core-requirements.txt ./core-requirements.txt +COPY --from=builder /app/gapy-requirements.txt ./gapy-requirements.txt +RUN pip install -r core-requirements.txt -r gapy-requirements.txt # Copy pre-built toolchains and emulators COPY --from=builder /app/install ./install diff --git a/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py b/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py index c2cce339..8d4db03d 100644 --- a/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py +++ b/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py @@ -31,7 +31,7 @@ _dumpCycleCntTemplate = NodeTemplate(""" snrt_cluster_hw_barrier(); if (snrt_is_dm_core()) { - #ifndef BANSHEE_SIMULATION + #ifndef BANSHEE_SIMULATION || GVSOC_SIMULATION DUMP(getCycles()); #else printf("${position} of ${nodeName} block at cycle %d \\n", getCycles()); diff --git a/DeeployTest/Platforms/Snitch/CMakeLists.txt b/DeeployTest/Platforms/Snitch/CMakeLists.txt index 7992d8e4..50ad1352 100644 --- a/DeeployTest/Platforms/Snitch/CMakeLists.txt +++ b/DeeployTest/Platforms/Snitch/CMakeLists.txt @@ -9,5 +9,6 @@ add_deeploy_executable(${ProjectId} EXCLUDE_FROM_ALL ${SOURCES}) target_link_libraries(${ProjectId} PRIVATE network deeploylib) target_compile_options(${ProjectId} INTERFACE network) add_banshee_simulation(${ProjectId}) +add_gvsoc_simulation(${ProjectId}) add_snitch_cluster_vsim_simulation(${ProjectId}) add_snitch_cluster_vsim_gui_simulation(${ProjectId}) \ No newline at end of file diff --git a/DeeployTest/Platforms/Snitch/main.c b/DeeployTest/Platforms/Snitch/main.c index 38cfa96c..e8c6bb15 100644 --- a/DeeployTest/Platforms/Snitch/main.c +++ b/DeeployTest/Platforms/Snitch/main.c @@ -40,7 +40,7 @@ int main(void) { uint32_t core_id = snrt_global_core_idx(); uint32_t compute_core_id = snrt_global_compute_core_idx(); -#ifdef BANSHEE_SIMULATION +#ifdef BANSHEE_SIMULATION || GVSOC_SIMULATION uint32_t const num_compute_cores = (NUM_CORES - 1); #else uint32_t const num_compute_cores = snrt_global_compute_core_num(); @@ -98,7 +98,7 @@ int main(void) { snrt_cluster_hw_barrier(); -#ifndef BANSHEE_SIMULATION +#ifndef BANSHEE_SIMULATION || GVSOC_SIMULATION if (snrt_is_dm_core()) { ResetTimer(); StartTimer(); @@ -108,7 +108,7 @@ int main(void) { RunNetwork(compute_core_id, num_compute_cores); uint32_t runtimeCycles = 0; -#ifndef BANSHEE_SIMULATION +#ifndef BANSHEE_SIMULATION || GVSOC_SIMULATION if (snrt_is_dm_core()) { runtimeCycles = getCycles(); DUMP(runtimeCycles); diff --git a/DeeployTest/testRunner_snitch.py b/DeeployTest/testRunner_snitch.py index 54e90d89..56455982 100644 --- a/DeeployTest/testRunner_snitch.py +++ b/DeeployTest/testRunner_snitch.py @@ -42,7 +42,7 @@ metavar = "", dest = "simulator", type = str, - choices = ["banshee", "vsim", "vsim.gui"], + choices = ["banshee", "vsim", "vsim.gui", "gvsoc"], default = "banshee", help = "Select the simulator to use") args = parser.parse_args() diff --git a/DeeployTest/testRunner_tiled_snitch.py b/DeeployTest/testRunner_tiled_snitch.py index 4cd53246..9573f759 100644 --- a/DeeployTest/testRunner_tiled_snitch.py +++ b/DeeployTest/testRunner_tiled_snitch.py @@ -41,7 +41,7 @@ metavar = "", dest = "simulator", type = str, - choices = ["banshee", "vsim", "vsim.gui"], + choices = ["banshee", "vsim", "vsim.gui", "gvsoc"], default = "banshee", help = "Select the simulator to use") diff --git a/DeeployTest/testUtils/testRunner.py b/DeeployTest/testUtils/testRunner.py index 4002de68..22c4cc17 100644 --- a/DeeployTest/testUtils/testRunner.py +++ b/DeeployTest/testUtils/testRunner.py @@ -319,6 +319,11 @@ def configure_cmake_project(self): else: self.cmake_args += " -D banshee_simulation=OFF" + if self._simulator == 'gvsoc': + self.cmake_args += " -D gvsoc_simulation=ON" + else: + self.cmake_args += " -D gvsoc_simulation=OFF" + command = f"$CMAKE -D TOOLCHAIN={self._args.toolchain} -D TOOLCHAIN_INSTALL_DIR={self._dir_toolchain} -D GENERATED_SOURCE={self._dir_gen} -D platform={self._platform} {self.cmake_args} -B {self._dir_build} -D TESTNAME={self._name_test} .." if self._args.verbose >= 3: diff --git a/Makefile b/Makefile index 5ce77e74..54f9e7f7 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ QEMU_INSTALL_DIR ?= ${DEEPLOY_INSTALL_DIR}/qemu BANSHEE_INSTALL_DIR ?= ${DEEPLOY_INSTALL_DIR}/banshee MEMPOOL_INSTALL_DIR ?= ${DEEPLOY_INSTALL_DIR}/mempool SNITCH_INSTALL_DIR ?= ${DEEPLOY_INSTALL_DIR}/snitch_cluster +GVSOC_INSTALL_DIR ?= ${DEEPLOY_INSTALL_DIR}/gvsoc CMAKE ?= cmake @@ -75,6 +76,7 @@ echo-bash: @echo "TL/DR: add these lines to run ~/.bashrc" @echo "export PULP_SDK_HOME=${PULP_SDK_INSTALL_DIR}" @echo "export SNITCH_HOME=${SNITCH_INSTALL_DIR}" + @echo "export GVSOC_INSTALL_DIR=${GVSOC_INSTALL_DIR}" @echo "export LLVM_INSTALL_DIR=${LLVM_INSTALL_DIR}" @echo "export PULP_RISCV_GCC_TOOLCHAIN=/PULP_SDK_IS_A_MESS" @echo "export MEMPOOL_HOME=${MEMPOOL_INSTALL_DIR}" @@ -279,10 +281,23 @@ ${SNITCH_INSTALL_DIR}: ${TOOLCHAIN_DIR}/snitch_cluster TMPDIR=tmp pip install -r python-requirements.txt && rm -rf tmp && \ bender vendor init && \ cd ${SNITCH_INSTALL_DIR}/target/snitch_cluster && \ - make sw/runtime/banshee sw/math + make sw/runtime/banshee sw/runtime/rtl sw/math snitch_runtime: ${SNITCH_INSTALL_DIR} +${TOOLCHAIN_DIR}/gvsoc: + cd ${TOOLCHAIN_DIR} && \ + git clone https://github.com/gvsoc/gvsoc.git && \ + cd ${TOOLCHAIN_DIR}/gvsoc && \ + git submodule update --init --recursive && \ + pip install -r core/requirements.txt && pip install -r gapy/requirements.txt + +${GVSOC_INSTALL_DIR}: ${TOOLCHAIN_DIR}/gvsoc + cd ${TOOLCHAIN_DIR}/gvsoc && \ + make all TARGETS=pulp.snitch.snitch_cluster_single INSTALLDIR=${GVSOC_INSTALL_DIR} + +gvsoc: ${GVSOC_INSTALL_DIR} + ${TOOLCHAIN_DIR}/qemu: cd ${TOOLCHAIN_DIR} && \ git clone https://github.com/qemu/qemu.git --depth 1 -b stable-6.1 && \ diff --git a/cmake/simulation.cmake b/cmake/simulation.cmake index c4a0bc47..237cd540 100644 --- a/cmake/simulation.cmake +++ b/cmake/simulation.cmake @@ -11,9 +11,13 @@ set(num_threads 1 CACHE STRING "Number of active cores") set(banshee_stack_size 16777216 CACHE STRING "Stack size of banshee threads") OPTION(banshee_simulation "Optimize binary for banshee simulation" OFF) -if(banshee_simulation) +OPTION(gvsoc_simulation "adapt preprocessor macro for gvsoc simulation" OFF) +if(banshee_simulation OR gvsoc_simulation) add_compile_definitions(BANSHEE_SIMULATION) endif() +if(gvsoc_simulation) + add_compile_definitions(GVSOC_SIMULATION) +endif() ######################### ## Utility Functions ## @@ -26,6 +30,7 @@ macro(print_simulation_config) message(STATUS "[Simulator] VCS = " ${VCS}) message(STATUS "[Simulator] banshee_simulation = " ${banshee_simulation}) message(STATUS "[Simulator] banshee_configuration = " ${BANSHEE_CONFIG}) + message(STATUS "[Simulator] gvsoc_simulation = " ${gvsoc_simulation}) message(STATUS "[Simulator] banshee_stack_size = " ${banshee_stack_size}) message(STATUS "[Simulator] num_threads = " ${num_threads}) message(STATUS "================================================================================") diff --git a/cmake/snitch/snitch.cmake b/cmake/snitch/snitch.cmake index b56b6368..e1eaadbe 100644 --- a/cmake/snitch/snitch.cmake +++ b/cmake/snitch/snitch.cmake @@ -1,4 +1,5 @@ set(SNITCH_HOME $ENV{SNITCH_HOME}) +set(GVSOC_INSTALL_DIR $ENV{GVSOC_INSTALL_DIR}) set(SNITCH_RUNTIME_HOME ${SNITCH_HOME}/sw/snRuntime) add_compile_definitions( @@ -22,6 +23,18 @@ macro(add_snitch_cluster_vsim_simulation name) ) endmacro() +macro(add_gvsoc_simulation name) + add_custom_target(gvsoc_${name} + WORKING_DIRECTORY ${GVSOC_INSTALL_DIR} + DEPENDS ${name} + COMMAND ./bin/gvsoc --target=pulp.snitch.snitch_cluster_single --binary ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${name} image flash run + COMMENT "Simulating deeploytest with gvsoc" + POST_BUILD + USES_TERMINAL + VERBATIM + ) +endmacro() + macro(add_snitch_cluster_vsim_gui_simulation name) add_custom_target(vsim.gui_${name} WORKING_DIRECTORY ${SNITCH_HOME}/target/snitch_cluster From 3d252a909a53d4fd80873cee779b62e241feb74d Mon Sep 17 00:00:00 2001 From: tahaelbayad Date: Mon, 13 Jan 2025 13:26:22 +0100 Subject: [PATCH 2/7] apply Luka's comment --- .../CodeTransformationPasses/SnitchProfileExecutionBlock.py | 2 +- DeeployTest/Platforms/Snitch/main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py b/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py index 8d4db03d..7559a1a5 100644 --- a/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py +++ b/Deeploy/Targets/Snitch/CodeTransformationPasses/SnitchProfileExecutionBlock.py @@ -31,7 +31,7 @@ _dumpCycleCntTemplate = NodeTemplate(""" snrt_cluster_hw_barrier(); if (snrt_is_dm_core()) { - #ifndef BANSHEE_SIMULATION || GVSOC_SIMULATION + #if !defined(BANSHEE_SIMULATION) && !defined(GVSOC_SIMULATION) DUMP(getCycles()); #else printf("${position} of ${nodeName} block at cycle %d \\n", getCycles()); diff --git a/DeeployTest/Platforms/Snitch/main.c b/DeeployTest/Platforms/Snitch/main.c index e8c6bb15..bdb8fbce 100644 --- a/DeeployTest/Platforms/Snitch/main.c +++ b/DeeployTest/Platforms/Snitch/main.c @@ -40,7 +40,7 @@ int main(void) { uint32_t core_id = snrt_global_core_idx(); uint32_t compute_core_id = snrt_global_compute_core_idx(); -#ifdef BANSHEE_SIMULATION || GVSOC_SIMULATION +#if !defined(BANSHEE_SIMULATION) && !defined(GVSOC_SIMULATION) uint32_t const num_compute_cores = (NUM_CORES - 1); #else uint32_t const num_compute_cores = snrt_global_compute_core_num(); @@ -98,7 +98,7 @@ int main(void) { snrt_cluster_hw_barrier(); -#ifndef BANSHEE_SIMULATION || GVSOC_SIMULATION +#if !defined(BANSHEE_SIMULATION) && !defined(GVSOC_SIMULATION) if (snrt_is_dm_core()) { ResetTimer(); StartTimer(); @@ -108,7 +108,7 @@ int main(void) { RunNetwork(compute_core_id, num_compute_cores); uint32_t runtimeCycles = 0; -#ifndef BANSHEE_SIMULATION || GVSOC_SIMULATION +#if !defined(BANSHEE_SIMULATION) && !defined(GVSOC_SIMULATION) if (snrt_is_dm_core()) { runtimeCycles = getCycles(); DUMP(runtimeCycles); From 2322c09e0d2c87bfa3fb070fb814e3b7fdc72dd9 Mon Sep 17 00:00:00 2001 From: tahaelbayad Date: Mon, 13 Jan 2025 13:35:23 +0100 Subject: [PATCH 3/7] apply Luka's comment --- cmake/simulation.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/simulation.cmake b/cmake/simulation.cmake index 237cd540..d974f9bc 100644 --- a/cmake/simulation.cmake +++ b/cmake/simulation.cmake @@ -12,7 +12,7 @@ set(banshee_stack_size 16777216 CACHE STRING "Stack size of banshee threads") OPTION(banshee_simulation "Optimize binary for banshee simulation" OFF) OPTION(gvsoc_simulation "adapt preprocessor macro for gvsoc simulation" OFF) -if(banshee_simulation OR gvsoc_simulation) +if(banshee_simulation) add_compile_definitions(BANSHEE_SIMULATION) endif() if(gvsoc_simulation) From 395dd68f56b00f4fb93aaeeb0e49eb3a172b6104 Mon Sep 17 00:00:00 2001 From: tahaelbayad Date: Mon, 13 Jan 2025 13:41:28 +0100 Subject: [PATCH 4/7] add gvsoc commit hash --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 54f9e7f7..b6895b29 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ PULP_SDK_COMMIT_HASH ?= c216298881cee767afc30928e055982b9e40e568 BANSHEE_COMMIT_HASH ?= 0e105921e77796e83d01c2aa4f4cadfa2005b4d9 MEMPOOL_COMMIT_HASH ?= affd45d94e05e375a6966af6a762deeb182a7bd6 SNITCH_COMMIT_HASH ?= e02cc9e3f24b92d4607455d5345caba3eb6273b2 +GVSOC_COMMIT_HASH ?= e96253a0ca7bbd113850988c2d77289926db37f3 RUSTUP_CARGO ?= $$(rustup which cargo) @@ -288,7 +289,7 @@ snitch_runtime: ${SNITCH_INSTALL_DIR} ${TOOLCHAIN_DIR}/gvsoc: cd ${TOOLCHAIN_DIR} && \ git clone https://github.com/gvsoc/gvsoc.git && \ - cd ${TOOLCHAIN_DIR}/gvsoc && \ + cd ${TOOLCHAIN_DIR}/gvsoc && git checkout ${GVSOC_COMMIT_HASH} && \ git submodule update --init --recursive && \ pip install -r core/requirements.txt && pip install -r gapy/requirements.txt From 06834d03e201f6300b22c1587302edb2929300ac Mon Sep 17 00:00:00 2001 From: tahaelbayad Date: Mon, 13 Jan 2025 14:16:49 +0100 Subject: [PATCH 5/7] change comments --- DeeployTest/Platforms/Snitch/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DeeployTest/Platforms/Snitch/main.c b/DeeployTest/Platforms/Snitch/main.c index bdb8fbce..e27d075b 100644 --- a/DeeployTest/Platforms/Snitch/main.c +++ b/DeeployTest/Platforms/Snitch/main.c @@ -103,7 +103,7 @@ int main(void) { ResetTimer(); StartTimer(); } -#endif // BANSHEE_SIMULATION +#endif // BANSHEE_SIMULATION and GVSOC_SIMULATION RunNetwork(compute_core_id, num_compute_cores); @@ -114,7 +114,7 @@ int main(void) { DUMP(runtimeCycles); StopTimer(); } -#endif // BANSHEE_SIMULATION +#endif // BANSHEE_SIMULATION and GVSOC_SIMULATION snrt_cluster_hw_barrier(); From 2efcdb78507b144a723f7ff1c6cd605ec6ae9d35 Mon Sep 17 00:00:00 2001 From: tahaelbayad Date: Mon, 13 Jan 2025 14:20:34 +0100 Subject: [PATCH 6/7] add comment in the dockerfile --- Container/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Container/Dockerfile b/Container/Dockerfile index ebd0d1f2..2faba86b 100644 --- a/Container/Dockerfile +++ b/Container/Dockerfile @@ -78,6 +78,7 @@ RUN make pulp-sdk RUN make qemu RUN make mempool RUN make banshee +# Copy gvsoc requirements for later as they are removed when toolchain folder is deleted RUN make gvsoc && cp -r /app/toolchain/gvsoc/core/requirements.txt /app/core-requirements.txt && cp -r /app/toolchain/gvsoc/gapy/requirements.txt /app/gapy-requirements.txt # Dependencies needed for compiling Snitch From ebddd7ec96f420c73ed5a723ab05221942d4bcf7 Mon Sep 17 00:00:00 2001 From: tahaelbayad Date: Tue, 14 Jan 2025 15:40:06 +0100 Subject: [PATCH 7/7] change CHANGELOG and docker image --- .github/workflows/BuildDocker.yml | 2 +- .github/workflows/CI.yml | 16 +++++------ .github/workflows/TestRunnerCortexM.yml | 2 +- .github/workflows/TestRunnerGeneric.yml | 2 +- .github/workflows/TestRunnerMempool.yml | 2 +- .github/workflows/TestRunnerSiracusa.yml | 2 +- .github/workflows/TestRunnerSnitch.yml | 2 +- .github/workflows/TestRunnerTiledSiracusa.yml | 2 +- .../TestRunnerTiledSiracusaSequential.yml | 2 +- .../TestRunnerTiledSiracusaWithNeureka.yml | 2 +- ...nnerTiledSiracusaWithNeurekaSequential.yml | 2 +- .../TestRunnerTiledSnitchSequential.yml | 2 +- CHANGELOG.md | 27 ++++++++++++++++++- 13 files changed, 45 insertions(+), 20 deletions(-) diff --git a/.github/workflows/BuildDocker.yml b/.github/workflows/BuildDocker.yml index d07e90ad..47f631e1 100644 --- a/.github/workflows/BuildDocker.yml +++ b/.github/workflows/BuildDocker.yml @@ -38,4 +38,4 @@ jobs: file: Container/Dockerfile push: true # JUNGVI: If you operate from a fork and want to build a new docker make sure to replace 'pulp-platform' by your uname. - tags: ghcr.io/tahaelbayad/deeploy:main + tags: ghcr.io/pulp-platform/deeploy:main diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7524fc02..02d716fe 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: build-deeploy: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -549,7 +549,7 @@ jobs: deeploy-state-serialization: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -569,7 +569,7 @@ jobs: deeploy-memory-level-extension: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -589,7 +589,7 @@ jobs: deeploy-tiler-extension: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -613,7 +613,7 @@ jobs: deeploy-memory-allocation-extension: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -635,7 +635,7 @@ jobs: deeploy-typing: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -652,7 +652,7 @@ jobs: deeploy-regex-matching: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -669,7 +669,7 @@ jobs: linting: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerCortexM.yml b/.github/workflows/TestRunnerCortexM.yml index 9d80f556..5f0e523d 100644 --- a/.github/workflows/TestRunnerCortexM.yml +++ b/.github/workflows/TestRunnerCortexM.yml @@ -11,7 +11,7 @@ jobs: test-runner-cortexm: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerGeneric.yml b/.github/workflows/TestRunnerGeneric.yml index c123ca51..ce20fdae 100644 --- a/.github/workflows/TestRunnerGeneric.yml +++ b/.github/workflows/TestRunnerGeneric.yml @@ -11,7 +11,7 @@ jobs: test-runner-generic: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerMempool.yml b/.github/workflows/TestRunnerMempool.yml index a1796679..e8414ffc 100644 --- a/.github/workflows/TestRunnerMempool.yml +++ b/.github/workflows/TestRunnerMempool.yml @@ -11,7 +11,7 @@ jobs: test-runner-mempool: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerSiracusa.yml b/.github/workflows/TestRunnerSiracusa.yml index 0143396c..0b8b8cc5 100644 --- a/.github/workflows/TestRunnerSiracusa.yml +++ b/.github/workflows/TestRunnerSiracusa.yml @@ -14,7 +14,7 @@ jobs: test-runner-siracusa: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerSnitch.yml b/.github/workflows/TestRunnerSnitch.yml index 89cb03f0..7778fbdd 100644 --- a/.github/workflows/TestRunnerSnitch.yml +++ b/.github/workflows/TestRunnerSnitch.yml @@ -17,7 +17,7 @@ jobs: test-runner-snitch: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSiracusa.yml b/.github/workflows/TestRunnerTiledSiracusa.yml index 9f101c63..48a8cb39 100644 --- a/.github/workflows/TestRunnerTiledSiracusa.yml +++ b/.github/workflows/TestRunnerTiledSiracusa.yml @@ -32,7 +32,7 @@ jobs: L1: ${{ fromJSON(inputs.L1) }} runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSiracusaSequential.yml b/.github/workflows/TestRunnerTiledSiracusaSequential.yml index 5e9e275f..684036a1 100644 --- a/.github/workflows/TestRunnerTiledSiracusaSequential.yml +++ b/.github/workflows/TestRunnerTiledSiracusaSequential.yml @@ -24,7 +24,7 @@ jobs: test-runner-siracusa-tiled: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml b/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml index d16699f1..143c9893 100644 --- a/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml +++ b/.github/workflows/TestRunnerTiledSiracusaWithNeureka.yml @@ -36,7 +36,7 @@ jobs: L1: ${{ fromJSON(inputs.L1) }} runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml b/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml index c362d860..32715987 100644 --- a/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml +++ b/.github/workflows/TestRunnerTiledSiracusaWithNeurekaSequential.yml @@ -28,7 +28,7 @@ jobs: test-runner-siracusa-neureka-tiled: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/.github/workflows/TestRunnerTiledSnitchSequential.yml b/.github/workflows/TestRunnerTiledSnitchSequential.yml index 83830225..a99407f8 100644 --- a/.github/workflows/TestRunnerTiledSnitchSequential.yml +++ b/.github/workflows/TestRunnerTiledSnitchSequential.yml @@ -24,7 +24,7 @@ jobs: test-runner-snitch-tiled: runs-on: ubuntu-22.04 container: - image: ghcr.io/tahaelbayad/deeploy:main + image: ghcr.io/pulp-platform/deeploy:main steps: - name: Checkout Repo uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index b02c2312..c9660a41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,4 +36,29 @@ - Minimal library with CycleCounter and utility function ### Changed -- Update the Banshee's commit to include a recent PR. \ No newline at end of file +- Update the Banshee's commit to include a recent PR. + +## Snitch Cluster Tiling Support + +### Added +- Support for single-buffered tiling from L2. +- Parsers, Templates, TypeCheckers, Layers, and TCF for the newly supported operators. +- A code transformation pass to filter DMA cores or compute cores for an `ExecutionBlock`. +- A code transformation pass to profile an `ExecutionBlock`. +- Test for single kernels, both with and without tiling. +- Adds the `--debug` flag to `cargo install` when installing Banshee to get the possibility of enabling the debug prints. +- New tests for the `snitch_cluster` platform. +- Add macros to `main.c` to disable printing and testing (convenient when running RTL simulations). + +### Changed +- Add the possibility of changing the simulator when using the snitch-tiled test runner. + +## GVSOC support for the Snitch Cluster Platform + +### Added +- gvsoc in the Makefile and dockerfile +- cmake flow for gvsoc +- CI tests regarding Snitch run on GVSOC as well + +### Changed +- Add the RTL library to the snitch_cluster build process in the Makefile, required for GVSOC simulation