Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4fc07c8
make: Expose `SN_PYTHON` version for datagen and clustergen
fischeti Oct 16, 2025
62fd6e1
python: Migrate to `uv`
fischeti Oct 16, 2025
7b4b6e1
Docker: Try to set up uv
fischeti Oct 16, 2025
5e1a32b
Docker: install uv in `tools` folder and install python with uv
fischeti Oct 20, 2025
53dd915
python: Commit uv lock file
fischeti Oct 20, 2025
4954528
Docker: Don't sync during building Docker container
fischeti Oct 20, 2025
33ce9b6
make: Prefix `peakrdl` with python executable i.e. uv
fischeti Oct 21, 2025
6896e95
docker: Enable virtual environment instead of `uv run`
fischeti Oct 21, 2025
94df1fa
pyproject.toml: Add minimum python version
fischeti Oct 21, 2025
9eea509
docker: Debug commands
fischeti Oct 21, 2025
06a0188
Revert "make: Prefix `peakrdl` with python executable i.e. uv"
fischeti Oct 21, 2025
8877494
Revert "docker: Debug commands"
fischeti Oct 21, 2025
bc94a13
Revert stuff again
fischeti Oct 21, 2025
edf0996
docker: Expose venv again
fischeti Oct 21, 2025
12c0e6a
pyproject.toml: Use CPU-only version for torch
fischeti Oct 21, 2025
b260f41
uv: pin python version
fischeti Oct 21, 2025
db2f348
docker: Don't explicitely install python but sync with uv
fischeti Oct 21, 2025
e895e8c
make: Add `SN_UV` prefix to make targets
fischeti Oct 21, 2025
d1e5350
env: Use `SN_UV` in `iis-setup.sh`
fischeti Oct 21, 2025
82acf33
docker: Install ca-certificates
fischeti Oct 21, 2025
692faf1
make: Clean up indentation
fischeti Oct 21, 2025
048df5e
pyproject.toml: remove `torchvision` index
fischeti Oct 21, 2025
9e6efe4
ci: Run pytest with uv environment
fischeti Oct 21, 2025
f596a37
docker: Specify all extras for uv environment
fischeti Oct 21, 2025
93a97ed
ci: Use uv environment for experiment runs
fischeti Oct 21, 2025
3b759fd
make: Couple more uv prefixes
fischeti Oct 22, 2025
dfebc76
docker: Clean up
fischeti Oct 22, 2025
f7a066c
ci: Try activating python environment
fischeti Oct 22, 2025
d7653e7
ci: Inline action and run with uv
fischeti Oct 23, 2025
7d75057
ci: Fix typo
fischeti Oct 23, 2025
4235358
make: Run `list-dependent-make-targets` without python prefix
fischeti Oct 23, 2025
4ee1e53
ci: Fix once again
fischeti Oct 23, 2025
f8ec9c4
make: Remove `SN_PYTHON` again in favor of `SN_UV`
fischeti Oct 24, 2025
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
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Run pytest
run: pytest
run: uv run pytest

##############################################
# Simulate SW on Snitch Cluster w/ Verilator #
Expand All @@ -151,10 +151,9 @@ jobs:
submodules: 'recursive'
- name: Hash Verilator prerequisites
id: verilator-hash
uses: colluca/[email protected]
with:
target: verilator
flags: --recursive
run: |
hash=$(uv run list-make-prerequisites verilator --recursive --hash)
echo "hash=$hash" >> "$GITHUB_OUTPUT"
- name: Set up cache for Verilator build
id: verilator-cache
uses: actions/cache@v4
Expand Down Expand Up @@ -184,8 +183,8 @@ jobs:
- name: Run Tests
working-directory: test
run: |
../util/experiments/run.py run.yaml --simulator verilator -j
../util/experiments/run.py riscv_tests_isa.yaml --simulator verilator -j
uv run ../util/experiments/run.py run.yaml --simulator verilator -j
uv run ../util/experiments/run.py riscv_tests_isa.yaml --simulator verilator -j
- name: Annotate traces
# Build the traces using the --permissive flag, since the Verilator
# testbench does not wait until all the instructions are retired
Expand Down
31 changes: 0 additions & 31 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,17 @@ variables:
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: /usr/pack/gcc-9.2.0-af/linux-x64/bin/gcc
LLVM_SYS_120_PREFIX: /usr/pack/llvm-12.0.1-af
CMAKE: cmake-3.18.1
# Override pip cache directory
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

default:
before_script:
source iis-setup.sh
cache: &global_cache
key:
files:
- pyproject.toml
paths:
- .cache/pip
policy: pull


#########
# Setup #
#########

setup:
cache:
# inherit all global cache settings
<<: *global_cache
# override the policy
policy: pull-push
script:
- echo "Setup completed."

##############
# Build docs #
##############

docs:
needs: [setup]
script:
- make docs

Expand All @@ -54,7 +31,6 @@ docs:
#####################

pytest:
needs: [setup]
script:
- pytest

Expand All @@ -63,7 +39,6 @@ pytest:
#################################

snitch-cluster-sw:
needs: [setup]
script:
- make sw -j
artifacts:
Expand All @@ -82,7 +57,6 @@ snitch-cluster-sw:
# - snitch_dma
# - snitch
snitch-ip-tests:
needs: [setup]
parallel:
matrix:
- IP:
Expand Down Expand Up @@ -133,7 +107,6 @@ snitch-cluster-vsim:

# Test OmegaNet TCDM interconnect
snitch-cluster-omega-vsim:
needs: [setup]
script:
- make CFG_OVERRIDE=cfg/omega.json sw -j
- make vsim -j
Expand All @@ -142,7 +115,6 @@ snitch-cluster-omega-vsim:

# Test Multi-channel DMA
snitch-cluster-mchan-vsim:
needs: [setup]
script:
- make CFG_OVERRIDE=cfg/dma_mchan.json sw -j
- make vsim -j
Expand All @@ -151,7 +123,6 @@ snitch-cluster-mchan-vsim:

# Additional tests for different FREP configurations
snitch-cluster-frep-vsim:
needs: [setup]
script:
# Large FREP configuration
- make CFG_OVERRIDE=cfg/frep_xl.json sw -j
Expand All @@ -167,7 +138,6 @@ snitch-cluster-frep-vsim:

# COPIFT and scalar chaining experiments
snitch-cluster-copift-sc-vsim:
needs: [setup]
script:
- make CFG_OVERRIDE=experiments/copift/cfg.json vsim -j
- cd experiments/copift
Expand All @@ -180,7 +150,6 @@ snitch-cluster-copift-sc-vsim:
############

nonfree:
needs: [setup]
script:
- make nonfree
- make elab
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ doc-srcs: $(GENERATED_DOC_SRCS)
doxygen-docs: $(DOXYGEN_DOCS_DIR)

docs: doc-srcs doxygen-docs
mkdocs build
$(SN_UV) mkdocs build

clean-docs:
rm -rf $(GENERATED_DOCS_DIR)
Expand All @@ -121,7 +121,7 @@ $(GENERATED_DOCS_DIR)/peripherals.md: hw/snitch_cluster/src/snitch_cluster_perip
$(SN_PEAKRDL) markdown $< -o $@

$(DOXYGEN_DOCS_DIR): $(DOXYFILE) $(DOXYGEN_INPUTS)
doxygen $<
$(SN_UV) doxygen $<

#######
# RTL #
Expand Down
13 changes: 2 additions & 11 deletions iis-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,12 @@
export CC=gcc-9.2.0
export CXX=g++-9.2.0
export SN_BENDER=bender-0.28.1
# TODO(fischeti): Install it locally? or tell IT to install it system-wide?
export SN_UV="/home/fischeti/.local/bin/uv run"
export SN_VCS_SEPP=vcs-2024.09
export SN_VERILATOR_SEPP=oseda
export SN_QUESTA_SEPP=questa-2023.4
export SN_LLVM_BINROOT=/usr/scratch2/vulcano/colluca/tools/riscv32-snitch-llvm-almalinux8-15.0.0-snitch-0.2.0/bin

# Create Python virtual environment with required packages
/usr/local/anaconda3-2023.07/bin/python -m venv .venv
source .venv/bin/activate
# Install local packages in editable mode and unpack packages in a
# local temporary directory which can be safely cleaned after installation.
# Also protects against "No space left on device" errors
# occurring when the /tmp folder is filled by other processes.
mkdir tmp
TMPDIR=tmp pip install -e .[all]
rm -rf tmp

# Add simulator binaries to PATH
export PATH=$PWD/target/sim/build/bin:$PATH
9 changes: 5 additions & 4 deletions make/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ SN_BIN_DIR = $(SN_TARGET_DIR)/sim/build/bin
SN_WORK_DIR = $(SN_TARGET_DIR)/sim/build/work

# External executables
SN_BENDER ?= bender
SN_PEAKRDL ?= peakrdl
SN_BENDER ?= bender
SN_UV ?=
SN_PEAKRDL ?= $(SN_UV) peakrdl
SN_VERIBLE_FMT ?= verible-verilog-format
SN_CLANG_FORMAT ?= clang-format
SN_RISCV_MC ?= $(SN_LLVM_BINROOT)/llvm-mc
Expand Down Expand Up @@ -96,7 +97,7 @@ endef
define sn_cluster_gen_rule
$(1): $(SN_CFG) $(SN_CLUSTER_GEN) $(SN_CLUSTER_GEN_SRC) $(2) | $(call sn_normalize_dir,$(dir $(1)))
@echo "[CLUSTERGEN] Generate $$@"
$(SN_CLUSTER_GEN) -c $$< -o $$@ --template $(2)
$(SN_UV) $(SN_CLUSTER_GEN) -c $$< -o $$@ --template $(2)
endef

# Common rule to generate a Makefile with RTL source and header
Expand Down Expand Up @@ -125,5 +126,5 @@ endef
# Usage:
# $(call sn_include_deps)
define sn_include_deps
$(eval $(if $(strip $(MAKECMDGOALS)),$(shell list-dependent-make-targets -M -r $(SN_DEPS))))
$(eval $(if $(strip $(MAKECMDGOALS)),$(shell $(SN_UV) list-dependent-make-targets -M -r $(SN_DEPS))))
endef
2 changes: 1 addition & 1 deletion make/rtl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ $(SN_BOOTROM_ELF) $(SN_BOOTROM_DUMP) $(SN_BOOTROM_BIN) $(SN_BOOTROM): $(SN_BOOTR
$(SN_RISCV_CC) -mabi=ilp32d -march=rv32imafd -static -nostartfiles -fuse-ld=$(SN_RISCV_LD) -L$(SN_ROOT)/sw/runtime -T$(SN_BOOTROM_DIR)/bootrom.ld $< -o $(SN_BOOTROM_ELF)
$(SN_RISCV_OBJDUMP) -d $(SN_BOOTROM_ELF) > $(SN_BOOTROM_DUMP)
$(SN_RISCV_OBJCOPY) -j .text -O binary $(SN_BOOTROM_ELF) $(SN_BOOTROM_BIN)
$(SN_BOOTROM_GEN) --sv-module snitch_bootrom $(SN_BOOTROM_BIN) > $(SN_BOOTROM)
$(SN_UV) $(SN_BOOTROM_GEN) --sv-module snitch_bootrom $(SN_BOOTROM_BIN) > $(SN_BOOTROM)

# General RTL targets
.PHONY: sn-rtl sn-clean-rtl
Expand Down
12 changes: 6 additions & 6 deletions make/traces.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ sn-clean-visual-trace:
rm -f $(SN_VISUAL_TRACE)

$(addprefix $(SN_LOGS_DIR)/,trace_hart_%.txt hart_%_perf.json dma_%_perf.json): $(SN_LOGS_DIR)/trace_hart_%.dasm $(SN_GENTRACE_PY) $(SN_GENTRACE_SRC)
$(SN_GENTRACE_PY) $< $(SN_GENTRACE_PY_FLAGS) --dma-trace $(SN_SIM_DIR)/dma_trace_$*_00000.log --dump-hart-perf $(SN_LOGS_DIR)/hart_$*_perf.json --dump-dma-perf $(SN_LOGS_DIR)/dma_$*_perf.json -o $(SN_LOGS_DIR)/trace_hart_$*.txt
$(SN_UV) $(SN_GENTRACE_PY) $< $(SN_GENTRACE_PY_FLAGS) --dma-trace $(SN_SIM_DIR)/dma_trace_$*_00000.log --dump-hart-perf $(SN_LOGS_DIR)/hart_$*_perf.json --dump-dma-perf $(SN_LOGS_DIR)/dma_$*_perf.json -o $(SN_LOGS_DIR)/trace_hart_$*.txt

# Generate source-code interleaved traces for all harts
$(SN_LOGS_DIR)/trace_hart_%.s: $(SN_LOGS_DIR)/trace_hart_%.txt $(SN_ANNOTATE_PY) $(SN_ANNOTATE_SRC)
$(SN_ANNOTATE_PY) $(SN_ANNOTATE_FLAGS) -o $@ $(SN_BINARY) $<
$(SN_UV) $(SN_ANNOTATE_PY) $(SN_ANNOTATE_FLAGS) -o $@ $(SN_BINARY) $<
$(SN_LOGS_DIR)/trace_hart_%.diff: $(SN_LOGS_DIR)/trace_hart_%.txt $(SN_ANNOTATE_PY) $(SN_ANNOTATE_SRC)
$(SN_ANNOTATE_PY) $(SN_ANNOTATE_FLAGS) -o $@ $(SN_BINARY) $< -d
$(SN_UV) $(SN_ANNOTATE_PY) $(SN_ANNOTATE_FLAGS) -o $@ $(SN_BINARY) $< -d

$(SN_JOINT_PERF_DUMP): $(SN_PERF_DUMPS) $(SN_JOIN_PY)
$(SN_JOIN_PY) -i $(shell ls $(SN_LOGS_DIR)/*_perf.json) -o $@
$(SN_UV) $(SN_JOIN_PY) -i $(shell ls $(SN_LOGS_DIR)/*_perf.json) -o $@

$(SN_ROI_DUMP): $(SN_JOINT_PERF_DUMP) $(SN_ROI_SPEC) $(SN_ROI_PY)
$(SN_ROI_PY) $(SN_JOINT_PERF_DUMP) $(SN_ROI_SPEC) --cfg $(SN_CFG) -o $@
$(SN_UV) $(SN_ROI_PY) $(SN_JOINT_PERF_DUMP) $(SN_ROI_SPEC) --cfg $(SN_CFG) -o $@

$(SN_VISUAL_TRACE): $(SN_ROI_DUMP) $(SN_VISUALIZE_PY)
$(SN_VISUALIZE_PY) $(SN_ROI_DUMP) $(SN_VISUALIZE_PY_FLAGS) -o $@
$(SN_UV) $(SN_VISUALIZE_PY) $(SN_ROI_DUMP) $(SN_VISUALIZE_PY_FLAGS) -o $@
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ name = "snitch"
authors = [
{name = "Luca Colagrande", email = "[email protected]"}
]
requires-python = ">=3.11"
dynamic = ["version"]
dependencies = [
# Alphabetically sorted.
Expand Down Expand Up @@ -61,6 +62,16 @@ all = [
"snitch[kernels,docs]"
]

[tool.uv.sources]
torch = [
{ index = "pytorch-cpu" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true

[tool.setuptools.package-dir]
"snitch.dnn" = "sw/kernels/dnn"
"snitch.blas" = "sw/kernels/blas"
Expand Down
2 changes: 1 addition & 1 deletion sw/kernels/datagen.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ $(dir $(DATA_H)):

$(DATA_H): DATAGEN_ARGS := $($(APP)_DATAGEN_ARGS)
$(DATA_H): $(DATAGEN_PY) $($(APP)_DATA_CFG) | $(dir $(DATA_H))
$< $(DATAGEN_ARGS) $@
$(SN_UV) $< $(DATAGEN_ARGS) $@
Loading