Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/ci-pivoted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies in venv
run: |
uv venv -p 3.11
uv pip install -r /src/requirements.txt
- name: Clean and make pivoted
run: |
. .venv/bin/activate
cp results/pivoted.csv results/pivoted_old.csv.txt
make clean
make
Expand Down
4 changes: 3 additions & 1 deletion Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@ rule dasm_to_trace:
params:
spike=config["spike"],
gentrace=config["gentrace"],
llvm_mc=config["llvm-mc"],
llvm_mcflags=config["llvm-mcflags"],
shell:
"{params.spike} < {input} | {params.gentrace} --permissive --dump-hart-perf {log.json} -o {log.txt}"
"{params.gentrace} {input} --mc-exec {params.llvm_mc} --mc-flags \"{params.llvm_mcflags}\" --permissive --dump-hart-perf {log.json} -o {log.txt}"


# Rule used to generate traces for debugging purposes, not used for csv generation
Expand Down
54 changes: 22 additions & 32 deletions default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
xdsl-opt: xdsl-opt # from virtualenv
mlir-opt: /usr/bin/mlir-opt-16
mlir-translate: /usr/bin/mlir-translate-16
cc: /opt/snitch-llvm/bin/clang++
cc: /tools/riscv-llvm/bin/clang++
llvm-mc: /tools/riscv-llvm/bin/llvm-mc
spike: /opt/snitch-spike/bin/spike-dasm
vltsim: /opt/snitch-rtl/bin/snitch_cluster.vlt
vltsim: snitch_cluster.vlt
gentrace: /opt/snitch_cluster/util/trace/gen_trace.py

# Flags
Expand All @@ -19,18 +20,11 @@ asflags:
- -fno-common
- -O3
- -D__DEFINED_uint64_t
- -I/opt/snitch_cluster/target/snitch_cluster/sw/runtime/rtl/src
- -I/opt/snitch_cluster/target/snitch_cluster/sw/runtime/common
- -I/opt/snitch_cluster/sw/snRuntime/api
- -I/opt/snitch_cluster/sw/snRuntime/src
- -I/opt/snitch_cluster/sw/snRuntime/src/omp/
- -I/opt/snitch_cluster/sw/snRuntime/api/omp/
- -I/opt/snitch_cluster/sw/math/arch/riscv64/bits/
- -I/opt/snitch_cluster/sw/math/arch/generic
- -I/opt/snitch_cluster/sw/math/src/include
- -I/opt/snitch_cluster/sw/math/src/internal
- -I/opt/snitch_cluster/sw/math/include/bits
- -I/opt/snitch_cluster/sw/math/include
- -I/opt/snitch_cluster/sw/runtime/src
- -I/opt/snitch_cluster/sw/runtime/impl
- -I/opt/snitch_cluster/sw/runtime/api
- -I/opt/snitch_cluster/sw/runtime/src/omp/
- -I/opt/snitch_cluster/sw/runtime/api/omp/
cflags:
- -Wno-unused-command-line-argument
- -menable-experimental-extensions
Expand All @@ -43,30 +37,26 @@ cflags:
- -fno-common
- -O3
- -D__DEFINED_uint64_t
- -I/opt/snitch_cluster/target/snitch_cluster/sw/runtime/rtl/src
- -I/opt/snitch_cluster/target/snitch_cluster/sw/runtime/common
- -I/opt/snitch_cluster/sw/snRuntime/api
- -I/opt/snitch_cluster/sw/snRuntime/src
- -I/opt/snitch_cluster/sw/snRuntime/src/omp/
- -I/opt/snitch_cluster/sw/snRuntime/api/omp/
- -I/opt/snitch_cluster/sw/math/arch/riscv64/bits/
- -I/opt/snitch_cluster/sw/math/arch/generic
- -I/opt/snitch_cluster/sw/math/src/include
- -I/opt/snitch_cluster/sw/math/src/internal
- -I/opt/snitch_cluster/sw/math/include/bits
- -I/opt/snitch_cluster/sw/math/include
- -I/opt/snitch_cluster/sw/runtime/src
- -I/opt/snitch_cluster/sw/runtime/impl
- -I/opt/snitch_cluster/sw/runtime/api
- -I/opt/snitch_cluster/sw/runtime/src/omp/
- -I/opt/snitch_cluster/sw/runtime/api/omp/
ldflags:
- -fuse-ld=/opt/snitch-llvm/bin/ld.lld
- -fuse-ld=/tools/riscv-llvm/bin/ld.lld
- -nostartfiles
- -nostdlib
- -L/opt/snitch-llvm/lib/clang/15.0.0/lib/
- -L/opt/snitch_cluster/target/snitch_cluster/sw/runtime/
- -L/opt/snitch_cluster/target/snitch_cluster/sw/runtime/rtl
- -L/opt/snitch_cluster/target/snitch_cluster/sw/runtime/rtl/build
- -T/opt/snitch_cluster/sw/snRuntime/base.ld
- -L/tools/riscv-llvm/lib/clang/15.0.0/lib/
- -L/opt/snitch_cluster/sw/runtime/
- -L/opt/snitch_cluster/sw/runtime/impl
- -L/opt/snitch_cluster/sw/runtime/build
- -T/opt/snitch_cluster/sw/runtime/base.ld
- -lc
- -lsnRuntime
- -lclang_rt.builtins-riscv32
llvm-mcflags:
- -disassemble
- -mcpu=snitch
xdsl-passes:
- test-lower-linalg-to-snitch
mlir-opt-flags-linalg:
Expand Down
67 changes: 9 additions & 58 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,59 +1,14 @@
#-------------------------------------------------------------------------------
# Stage 1: Builder
# Clones the repository and builds the necessary artifacts.
#-------------------------------------------------------------------------------
FROM ghcr.io/pulp-platform/snitch_cluster:main AS builder
FROM ghcr.io/pulp-platform/snitch_cluster-sw@sha256:bfe84cbb917169c39ae6a26c811c19665d3bc04ebf926155bc442bcd5cba59db AS toolchain

# Patch .gitmodules to replace SSH URLs with HTTPS
# Clone the snitch_cluster repository into /repo
# If the repo URL or commit hash doesn't change, this layer remains cached.
RUN git config --global url."https://github".insteadOf "git://github" \
&& git config --global url."https://github.com/".insteadOf "[email protected]:" \
&& git clone --recursive https://github.com/pulp-platform/snitch_cluster /repo \
&& cd /repo \
&& git reset --hard 7f430f2 \
# Build the verilator model and software in the same layer
&& make -C target/snitch_cluster verilator \
&& make -C target/snitch_cluster DEBUG=ON sw \
&& cd /repo/target/snitch_cluster/work-vlt/riscv-isa-sim \
&& ./configure --prefix=/opt/snitch-spike \
&& make install

WORKDIR /src

RUN curl -L -o riscv32-snitch-llvm-ubuntu2204-15.0.0-snitch-0.2.0.tar.gz https://github.com/pulp-platform/llvm-project/releases/download/15.0.0-snitch-0.2.0/riscv32-snitch-llvm-ubuntu2204-15.0.0-snitch-0.2.0.tar.gz \
&& tar -xzf riscv32-snitch-llvm-ubuntu2204-15.0.0-snitch-0.2.0.tar.gz -C /src

#-------------------------------------------------------------------------------
# Stage 2: Final Toolchain Image
# Creates the final, lean image by copying artifacts from the builder
# and installing only necessary runtime dependencies.
#-------------------------------------------------------------------------------
FROM ubuntu:22.04 AS toolchain

# Set this environment variable early.
ENV DEBIAN_FRONTEND=noninteractive

# Combine related COPY commands to reduce image layers.
# Copying parent directories is more efficient than many individual sub-directories.

COPY --from=builder /repo/target/snitch_cluster/bin/snitch_cluster_bin.vlt /opt/snitch-rtl/bin/snitch_cluster.vlt

COPY --from=builder /opt/snitch-spike /opt/snitch-spike

COPY --from=builder /src/riscv32-snitch-llvm-ubuntu2204-15.0.0-snitch-0.2.0 /opt/snitch-llvm

# Copy the entire 'sw' directory at once instead of its individual sub-directories.
COPY --from=builder /repo/sw /opt/snitch_cluster/sw

# Copy the entire runtime directory at once.
COPY --from=builder /repo/target/snitch_cluster/sw/runtime /opt/snitch_cluster/target/snitch_cluster/sw/runtime

# Copy Snitch Python package files.
COPY --from=builder /repo/pyproject.toml /opt/snitch_cluster/
COPY --from=builder /repo/util /opt/snitch_cluster/util
COPY --from=builder /repo/nonfree/util /opt/snitch_cluster/nonfree/util
COPY --from=builder /repo/target/snitch_cluster/util /opt/snitch_cluster/target/snitch_cluster/util
&& git clone --recursive https://github.com/pulp-platform/snitch_cluster /opt/snitch_cluster \
&& cd /opt/snitch_cluster \
&& git reset --hard 7c343831fc09819511a4eea54a725a02c4da765f \
&& make DEBUG=ON sn-runtime -j

# === Optimized Package Installation ===
# Split apt commands into logical, cacheable layers.
Expand Down Expand Up @@ -95,13 +50,9 @@ RUN apt-get -y update \
# 4. Clean up in the SAME RUN command to reduce final image size.
&& rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*

# Install uv and Python in a single layer, and ensure uv is in PATH
# Install uv and ensure uv is in PATH
RUN wget -qO- https://astral.sh/uv/install.sh | sh \
&& ln -s /root/.local/bin/uv /usr/local/bin/uv \
&& /root/.local/bin/uv python install

COPY docker/entrypoint.sh /entrypoint.sh
# Ensure the entrypoint is executable
RUN chmod +x /entrypoint.sh
&& ln -s /root/.local/bin/uv /usr/local/bin/uv

ENTRYPOINT ["/entrypoint.sh"]
COPY requirements.txt ./requirements.txt
RUN uv pip install -r ./requirements.txt
13 changes: 0 additions & 13 deletions docker/entrypoint.sh

This file was deleted.

19 changes: 0 additions & 19 deletions docker/venv.sh

This file was deleted.

1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ seaborn
numpy
snakemake==8.14.0
git+https://github.com/xdslproject/xdsl.git@902bfbc8#egg=xdsl
/opt/snitch_cluster/
Loading