Skip to content

Commit e359ac8

Browse files
authored
Merge pull request #166 from PSAL-POSTECH/torch_v2.8
PyTorch version upgrade: tested on single-operator tests
2 parents 3ccfc11 + 88e79e0 commit e359ac8

153 files changed

Lines changed: 7671 additions & 2323 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-base-image-2-8.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Docker Base Image CI (PyTorch 2.8)
22

33
on:
44
push:
5-
branches: [ "base" ]
5+
branches: [ "base_v2.8" ]
66
workflow_dispatch:
77
repository_dispatch:
88
types: [ build_base ]
@@ -63,7 +63,7 @@ jobs:
6363
file: ./Dockerfile.base
6464
push: true
6565
build-args: |
66-
PYTORCH_IMAGE=pytorch/pytorch:2.8.0-cuda12.6-cudnn9-runtime
66+
PYTORCH_IMAGE=pytorch/pytorch:2.8.0-cuda12.6-cudnn9-devel
6767
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
6868
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
6969
SPIKE_ASSET_ID=${{ env.SPIKE_ASSET_ID }}

.github/workflows/docker-base-image.yml

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

.github/workflows/docker-image-2-8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Docker image CI (PyTorch 2.8)
22

33
on:
44
pull_request:
5-
branches: [ "torch_v2.8" ]
5+
branches: [ "master", "develop" ]
66
workflow_dispatch:
77

88
jobs:

.github/workflows/docker-image.yml

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

.github/workflows/pytorchsim_test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,27 @@ jobs:
684684
-e vpu_spad_size_kb_per_lane="${{ inputs.spad_size }}" \
685685
${{ inputs.image_name }} python3 PyTorchSim/tests/Llama/test_llama.py
686686
687+
test_yolov5:
688+
name: Run test_yolov5
689+
runs-on: self-hosted
690+
steps:
691+
- name: Log in to GitHub Container Registry
692+
uses: docker/login-action@v3
693+
with:
694+
registry: ghcr.io
695+
username: ${{ github.actor }}
696+
password: ${{ secrets.GITHUB_TOKEN }}
697+
698+
- name: Run test_yolov5.py
699+
run: |
700+
echo "Running test_yolov5.py"
701+
docker run --rm \
702+
-v /tmp/torchsim-ci/${GITHUB_SHA}:/dump \
703+
-e TORCHSIM_DUMP_PATH=/dump \
704+
-e vpu_num_lanes="${{ inputs.vector_lane }}" \
705+
-e vpu_spad_size_kb_per_lane="${{ inputs.spad_size }}" \
706+
${{ inputs.image_name }} python3 PyTorchSim/tests/Yolov5/test_yolov5.py
707+
687708
test_accuracy:
688709
name: Run test_accuracy
689710
runs-on: self-hosted

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
__pycache__/
22
TOGSim/build/
33
.vscode
4-
*.txt
54
*.ipynb_checkpoints
65
output
76
togsim_results/*

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ RUN cd PyTorchSim/TOGSim && \
1010
cd build && \
1111
conan install .. --build=missing && \
1212
cmake .. && \
13-
make -j$(nproc)
13+
make -j$(nproc)
14+
15+
RUN cd PyTorchSim/PyTorchSimDevice && \
16+
python -m pip install --no-build-isolation -e .

Dockerfile.base

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ RUN apt -y update && \
3434
python3-dev python-is-python3 libboost-all-dev \
3535
libhdf5-serial-dev python3-pydot libpng-dev libelf-dev pkg-config pip \
3636
python3-venv black libssl-dev libasan5 libubsan1 curl device-tree-compiler wget ninja-build && \
37-
pip install onnx matplotlib scikit-learn pydot tabulate && pip install --user conan==1.56.0 && rm -rf /var/lib/apt/lists/*
37+
pip install onnx matplotlib scikit-learn pydot tabulate && pip install --user conan==1.56.0 cmake==3.26.4 && rm -rf /var/lib/apt/lists/*
3838

3939
# Download RISC-V tool chain
4040
RUN 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 && \
@@ -45,6 +45,14 @@ RUN wget https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2
4545
# Install torchsim dependency
4646
RUN apt install ninja-build && pip install onnx matplotlib && pip install --user conan==1.56.0 && pip install "transformers<4.44" && pip install diffusers==0.34.0
4747

48+
# FlashAttention
49+
RUN python -m pip install --no-build-isolation flash-attn
50+
51+
# Extra Python deps for YOLO/vision tests
52+
RUN python -m pip install -U pip setuptools wheel && \
53+
python -m pip install --no-cache-dir --no-deps ultralytics && \
54+
python -m pip install --no-cache-dir opencv-python-headless pandas seaborn
55+
4856
ENV RISCV=/workspace/riscv
4957
ENV PATH=$RISCV/bin:$PATH
5058

PyTorchSimDevice/CMakeLists.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
2+
3+
project(TORCH_OPENREG CXX C)
4+
5+
include(GNUInstallDirs)
6+
include(CheckCXXCompilerFlag)
7+
8+
set(CMAKE_CXX_STANDARD 17)
9+
set(CMAKE_C_STANDARD 11)
10+
set(CMAKE_CXX_EXTENSIONS OFF)
11+
12+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
13+
set(CMAKE_SKIP_BUILD_RPATH FALSE)
14+
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
15+
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
16+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
17+
18+
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
19+
20+
if(APPLE)
21+
set(CMAKE_INSTALL_RPATH "@loader_path/lib;@loader_path")
22+
elseif(UNIX)
23+
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib:$ORIGIN")
24+
elseif(WIN32)
25+
set(CMAKE_INSTALL_RPATH "")
26+
endif()
27+
set(CMAKE_INSTALL_LIBDIR lib)
28+
set(CMAKE_INSTALL_MESSAGE NEVER)
29+
30+
set(Torch_DIR ${PYTORCH_INSTALL_DIR}/share/cmake/Torch)
31+
find_package(Torch REQUIRED)
32+
33+
if(DEFINED PYTHON_INCLUDE_DIR)
34+
include_directories(${PYTHON_INCLUDE_DIR})
35+
else()
36+
message(FATAL_ERROR "Cannot find Python directory")
37+
endif()
38+
39+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
40+
include(${PROJECT_SOURCE_DIR}/cmake/TorchPythonTargets.cmake)
41+
42+
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/openreg)
43+
add_subdirectory(${PROJECT_SOURCE_DIR}/csrc)
44+
add_subdirectory(${PROJECT_SOURCE_DIR}/torch_openreg/csrc)

0 commit comments

Comments
 (0)