Skip to content

Commit fd6d327

Browse files
authored
Merge pull request #188 from PSAL-POSTECH/develop
Develop
2 parents eab1257 + 92aeeef commit fd6d327

278 files changed

Lines changed: 4347 additions & 3436 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/docker-image.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
build-and-test:
9-
runs-on: ubuntu-latest
9+
runs-on: self-hosted
1010

1111
permissions:
1212
contents: read
@@ -35,6 +35,7 @@ jobs:
3535
context: .
3636
file: ./Dockerfile
3737
push: true
38+
no-cache: true
3839
tags: ghcr.io/psal-postech/torchsim-test:${{ github.sha }}
3940

4041
# Step 4: Wait for GHCR propagation

.github/workflows/pytorchsim_test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,3 +662,37 @@ jobs:
662662
-e TORCHSIM_VECTOR_LANE="${{ inputs.vector_lane }}" \
663663
-e TORCHSIM_SPAD_SIZE="${{ inputs.spad_size }}" \
664664
${{ inputs.image_name }} python3 PyTorchSim/tests/test_scheduler.py
665+
666+
test_accuracy:
667+
name: Run test_accuracy
668+
runs-on: self-hosted
669+
steps:
670+
- name: Log in to GitHub Container Registry
671+
uses: docker/login-action@v3
672+
with:
673+
registry: ghcr.io
674+
username: ${{ github.actor }}
675+
password: ${{ secrets.GITHUB_TOKEN }}
676+
677+
- name: Prepare volume directory
678+
run: mkdir -p /tmp/torchsim-ci/${GITHUB_SHA}
679+
680+
- name: Run run_cycle.sh
681+
run: |
682+
echo "Running run_cycle.sh"
683+
docker run --rm \
684+
-v /tmp/torchsim-ci/${GITHUB_SHA}:/dump \
685+
-e TORCHSIM_DUMP_PATH=/dump \
686+
-e TORCHSIM_VECTOR_LANE="${{ inputs.vector_lane }}" \
687+
-e TORCHSIM_SPAD_SIZE="${{ inputs.spad_size }}" \
688+
${{ inputs.image_name }} bash -c \
689+
"cd /workspace && PyTorchSim/experiments/artifact/cycle_validation/run_cycle.sh && \
690+
cp PyTorchSim/experiments/artifact/cycle_validation/summary_cycle.out /dump/summary_cycle.out"
691+
ls /tmp/torchsim-ci/${GITHUB_SHA}
692+
693+
- name: Upload Accuracy Report Artifact
694+
uses: actions/upload-artifact@v4
695+
with:
696+
name: accuracy-report
697+
path: /tmp/torchsim-ci/${{ github.sha }}/summary_cycle.out
698+
if-no-files-found: error

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__pycache__/
2-
PyTorchSimBackend/build/
2+
TOGSim/build/
33
.vscode

.gitmodules

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
[submodule "PyTorchSimBackend/extern/onnx"]
2-
path = PyTorchSimBackend/extern/onnx
1+
[submodule "TOGSim/extern/onnx"]
2+
path = TOGSim/extern/onnx
33
url = https://github.com/onnx/onnx.git
4-
[submodule "PyTorchSimBackend/extern/protobuf"]
5-
path = PyTorchSimBackend/extern/protobuf
4+
[submodule "TOGSim/extern/protobuf"]
5+
path = TOGSim/extern/protobuf
66
url = https://github.com/protocolbuffers/protobuf.git
7-
[submodule "PyTorchSimBackend/extern/booksim"]
8-
path = PyTorchSimBackend/extern/booksim
7+
[submodule "TOGSim/extern/booksim"]
8+
path = TOGSim/extern/booksim
99
url = https://github.com/PSAL-POSTECH/booksim.git
10-
[submodule "PyTorchSimBackend/extern/torch2timeloop"]
11-
path = PyTorchSimBackend/extern/torch2timeloop
12-
url = https://github.com/Accelergy-Project/pytorch2timeloop-converter.git
13-
[submodule "PyTorchSimBackend/extern/ramulator2"]
14-
path = PyTorchSimBackend/extern/ramulator2
10+
[submodule "TOGSim/extern/ramulator2"]
11+
path = TOGSim/extern/ramulator2
1512
url = https://github.com/PSAL-POSTECH/ramulator2
16-
[submodule "PyTorchSimBackend/extern/stonneCore"]
17-
path = PyTorchSimBackend/extern/stonneCore
13+
[submodule "TOGSim/extern/stonneCore"]
14+
path = TOGSim/extern/stonneCore
1815
url = https://github.com/PSAL-POSTECH/stonne_core.git

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM ghcr.io/psal-postech/torchsim_base:latest
44
# Prepare PyTorchSim project
55
COPY . /workspace/PyTorchSim
66

7-
RUN cd PyTorchSim/PyTorchSimBackend && \
7+
RUN cd PyTorchSim/TOGSim && \
88
mkdir -p build && \
99
cd build && \
1010
conan install .. --build=missing && \

Dockerfile.ksc2025

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright (c) 2020 The Regents of the University of California
2+
# All Rights Reserved.
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions are
6+
# met: redistributions of source code must retain the above copyright
7+
# notice, this list of conditions and the following disclaimer;
8+
# redistributions in binary form must reproduce the above copyright
9+
# notice, this list of conditions and the following disclaimer in the
10+
# documentation and/or other materials provided with the distribution;
11+
# neither the name of the copyright holders nor the names of its
12+
# contributors may be used to endorse or promote products derived from
13+
# this software without specific prior written permission.
14+
#
15+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
FROM pytorch/pytorch:2.2.0-cuda12.1-cudnn8-runtime
27+
28+
# Copied from Gem5 Docker file
29+
ENV DEBIAN_FRONTEND=noninteractive
30+
RUN apt -y update && apt -y upgrade && \
31+
apt -y install build-essential git m4 scons zlib1g zlib1g-dev \
32+
libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev \
33+
python3-dev python-is-python3 doxygen libboost-all-dev \
34+
libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config pip \
35+
python3-venv black libssl-dev libasan5 libubsan1
36+
RUN pip install mypy pre-commit jupyter
37+
38+
# Pass Access Token securely
39+
ENV PATH=$PATH:/root/.local/bin
40+
ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/opt/conda/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH
41+
42+
# Build Gem5
43+
RUN git clone https://github.com/PSAL-POSTECH/gem5.git --branch TorchSim
44+
RUN cd gem5 && scons build/RISCV/gem5.opt -j $(nproc)
45+
ENV GEM5_PATH=/workspace/gem5/build/RISCV/gem5.opt
46+
47+
# Build LLVM RISC-V
48+
RUN git clone https://github.com/PSAL-POSTECH/llvm-project.git --branch torchsim --depth 1
49+
RUN cd llvm-project && mkdir build && cd build && \
50+
cmake -DLLVM_ENABLE_PROJECTS=mlir -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/riscv-llvm -DLLVM_TARGETS_TO_BUILD=RISCV -G "Unix Makefiles" ../llvm && \
51+
make -j && make install
52+
53+
# Store RISC-V LLVM for TorchSim
54+
ENV TORCHSIM_LLVM_PATH=/riscv-llvm/bin
55+
ENV TORCHSIM_LLVM_INCLUDE_PATH=/riscv-llvm/include
56+
ENV TORCHSIM_DIR=/workspace/PyTorchSim
57+
ENV LLVM_DIR=/riscv-llvm
58+
59+
# Download RISC-V tool chain
60+
RUN apt install -y wget && \
61+
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.12.14/riscv64-glibc-ubuntu-22.04-llvm-nightly-2023.12.14-nightly.tar.gz && \
62+
wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.12.14/riscv64-elf-ubuntu-20.04-llvm-nightly-2023.12.14-nightly.tar.gz && \
63+
tar -zxvf riscv64-elf-ubuntu-20.04-llvm-nightly-2023.12.14-nightly.tar.gz && tar -zxvf riscv64-elf-ubuntu-20.04-llvm-nightly-2023.12.14-nightly.tar.gz && \
64+
rm *.tar.gz
65+
66+
ENV RISCV=/workspace/riscv
67+
ENV PATH=$RISCV/bin:$PATH
68+
69+
# Install Spike simulator
70+
RUN apt -y install device-tree-compiler
71+
RUN git clone https://github.com/PSAL-POSTECH/riscv-isa-sim.git --branch TorchSim && cd riscv-isa-sim && mkdir build && cd build && \
72+
../configure --prefix=$RISCV && make -j && make install
73+
74+
# Install Proxy kernel
75+
RUN git clone https://github.com/riscv-software-src/riscv-pk.git && \
76+
cd riscv-pk && git checkout 4f3debe4d04f56d31089c1c716a27e2d5245e9a1 && mkdir build && cd build && \
77+
../configure --prefix=$RISCV --host=riscv64-unknown-elf && make -j && make install
78+
79+
# Install torchsim dependency
80+
RUN apt install ninja-build && pip install onnx matplotlib && pip install --user conan==1.56.0
81+
82+
# Prepare ONNXim project
83+
RUN git clone https://github.com/PSAL-POSTECH/PyTorchSim.git --branch tutorial
84+
RUN cd PyTorchSim/TOGSim && \
85+
git submodule update --recursive --init && \
86+
mkdir -p build && \
87+
cd build && \
88+
conan install .. --build=missing && \
89+
cmake .. && \
90+
make -j$(nproc)

PyTorchSimBackend/configs/heterogeneous_c2_simple_noc.json

Lines changed: 0 additions & 34 deletions
This file was deleted.

PyTorchSimBackend/configs/stonne_big_c1_simple_noc.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

PyTorchSimBackend/configs/stonne_single_c1_simple_noc.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

PyTorchSimBackend/configs/stonne_validation_c1_simple_noc.json

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)