Skip to content

Allow "lite" Chipyard builds with a minimal subset of submodules #2212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
run: |
conda activate ${{ env.conda-env-name-no-time }}-$(date --date "${{ env.workflow-timestamp }}" +%Y%m%d)
git submodule sync
./scripts/init-submodules-no-riscv-tools.sh
./scripts/init-submodules-no-riscv-tools.sh --full
shell: bash -leo pipefail {0}

# Note: You shouldn't need the other inputs since it shouldn't build RTL from scratch
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/remote-do-rtl-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ source $SCRIPT_DIR/defaults.sh

cd $REMOTE_CHIPYARD_DIR
git submodule sync
./scripts/init-submodules-no-riscv-tools.sh
./scripts/init-submodules-no-riscv-tools.sh --full

# Constellation can run without espresso, but this improves
# elaboration time drastically
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/chipyard-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ jobs:
- name: Build Gemmini FireMarshal
run: |
conda activate ${{ env.conda-env-name-no-time }}-$(date --date "${{ env.workflow-timestamp }}" +%Y%m%d)
cd ${{ github.workspace }} && ./scripts/init-submodules-no-riscv-tools.sh
cd ${{ github.workspace }} && ./scripts/init-submodules-no-riscv-tools.sh --full
cd ${{ github.workspace }} && source ./scripts/fix-open-files.sh
git submodule update --init software/firemarshal && cd software/firemarshal && ./init-submodules.sh
cd ${{ github.workspace }}/generators/gemmini/software && ${{ github.workspace }}/software/firemarshal/marshal -v -d build gemmini-smoke.json
Expand Down
35 changes: 27 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,40 @@ lazy val testchipip = (project in file("generators/testchipip"))
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(commonSettings)

lazy val chipyard = (project in file("generators/chipyard"))
.dependsOn(testchipip, rocketchip, boom, rocketchip_blocks, rocketchip_inclusive_cache,
dsptools, rocket_dsp_utils,
radiance, gemmini, icenet, tracegen, cva6, nvdla, sodor, ibex, fft_generator,
constellation, mempress, barf, shuttle, caliptra_aes, rerocc,
compressacc, saturn, ara, firrtl2_bridge, vexiiriscv, tacit)
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(
lazy val chipyard = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly not horrible. I wonder if we can encode this a bit better though... maybe we can write a quick SBT plugin to do this for us for any Chipyard submodule). Dropping https://github.com/sbt/sbt-sriracha/blob/master/src/main/scala/SrirachaPlugin.scala for a reference on how to write a plugin. Or maybe we can write a quick SBT function to wrap this (like freshProject).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SBT function seems fine.

var chipyard = (project in file("generators/chipyard"))
.dependsOn(testchipip, rocketchip, boom, rocketchip_blocks, rocketchip_inclusive_cache,
dsptools, rocket_dsp_utils,
radiance, gemmini, icenet, tracegen, cva6, nvdla, sodor, ibex, fft_generator,
constellation, barf, shuttle, rerocc,
saturn, firrtl2_bridge, vexiiriscv, tacit)
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(
libraryDependencies ++= Seq(
"org.reflections" % "reflections" % "0.10.2"
)
)
.settings(commonSettings)
.settings(Compile / unmanagedSourceDirectories += file("tools/stage/src/main/scala"))

val includeAra = file("generators/ara/.git").exists()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, why not add this for every SBT project Chipyard depends on (for most this would automatically add the dependency).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scheme currently supports only leaf projects, so we can't blanket apply this.

if (includeAra) chipyard = chipyard.dependsOn(ara)

val includeCaliptraAes = file("generators/caliptra-aes-acc/.git").exists()
if (includeCaliptraAes) chipyard = chipyard.dependsOn(caliptra_aes)

val includeCompressAcc = file("generators/compress-acc/.git").exists()
if (includeCompressAcc) chipyard = chipyard.dependsOn(compressacc)

val includeMempress = file("generators/mempress/.git").exists()
if (includeMempress) chipyard = chipyard.dependsOn(mempress)

val includeSaturn = file("generators/saturn/.git").exists()
if (includeSaturn) chipyard = chipyard.dependsOn(saturn)

chipyard
}

lazy val compressacc = (project in file("generators/compress-acc"))
.dependsOn(rocketchip)
.settings(libraryDependencies ++= rocketLibDeps.value)
Expand Down
15 changes: 8 additions & 7 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,30 @@ HELP_COMMANDS += \
# include additional subproject make fragments
# see HELP_COMPILATION_VARIABLES
#########################################################################################
include $(base_dir)/generators/cva6/cva6.mk
include $(base_dir)/generators/ibex/ibex.mk
include $(base_dir)/generators/ara/ara.mk
include $(base_dir)/generators/tracegen/tracegen.mk
include $(base_dir)/generators/nvdla/nvdla.mk
include $(base_dir)/generators/radiance/radiance.mk
include $(base_dir)/tools/torture.mk
Comment on lines 68 to 69
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Do we want to also ignore unfound files for the other repositories?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR will eventually make those repos also optional

-include $(base_dir)/generators/cva6/cva6.mk
-include $(base_dir)/generators/ibex/ibex.mk
-include $(base_dir)/generators/ara/ara.mk
-include $(base_dir)/generators/nvdla/nvdla.mk
-include $(base_dir)/generators/radiance/radiance.mk


#########################################################################################
# Prerequisite lists
#########################################################################################
# Returns a list of files in directories $1 with single file extension $2.
# If available, use 'fd' to find the list of files, which is faster than 'find'.
ifeq ($(shell which fd 2> /dev/null),)
lookup_srcs = $(shell find -L $(1)/ -name target -prune -o \( -iname "*.$(2)" ! -iname ".*" \) -print 2> /dev/null)
lookup_srcs = $(shell find -L $(1)/ -name target -prune -o \( ! -xtype l -a -iname "*.$(2)" ! -iname ".*" \) -print 2> /dev/null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this find expression easier to read, i.e. not a symlink and (name is $(2) and not name .*). Currently, this is quite hard to parse.

else
lookup_srcs = $(shell fd -L -t f -e $(2) . $(1))
endif

# Returns a list of files in directories $1 with *any* of the file extensions in $2
lookup_srcs_by_multiple_type = $(foreach type,$(2),$(call lookup_srcs,$(1),$(type)))

CHECK_SUBMODULES_COMMAND = echo "Checking all submodules in generators/ are initialized. Uninitialized submodules will be displayed" ; ! git submodule status $(base_dir)/generators | grep ^-
CHECK_SUBMODULES_COMMAND = echo "Checking required submodules in generators/ are initialized. Uninitialized submodules will be displayed" ; ! git submodule status $(base_dir)/generators | grep '^-.*' | grep -vE "(ara|caliptra|compress|mempress|saturn)"

SCALA_EXT = scala
VLOG_EXT = sv v
Expand Down
2 changes: 1 addition & 1 deletion generators/ara
Submodule ara updated 1 files
+32 −0 chipyard/AraConfigs.scala
2 changes: 1 addition & 1 deletion generators/caliptra-aes-acc
32 changes: 0 additions & 32 deletions generators/chipyard/src/main/scala/config/AraConfigs.scala

This file was deleted.

1 change: 1 addition & 0 deletions generators/chipyard/src/main/scala/config/AraConfigs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,6 @@ class LeanGemminiPrintfRocketConfig extends Config(
new chipyard.config.WithSystemBusWidth(128) ++
new chipyard.config.AbstractConfig)

class MempressRocketConfig extends Config(
new mempress.WithMemPress ++ // use Mempress (memory traffic generation) accelerator
new chipyard.config.WithExtMemIdBits(7) ++ // use 7 bits for tl like request id
new chipyard.config.WithSystemBusWidth(128) ++
new freechips.rocketchip.subsystem.WithNBanks(8) ++
new freechips.rocketchip.subsystem.WithInclusiveCache(nWays=16, capacityKB=2048) ++
new freechips.rocketchip.subsystem.WithNMemoryChannels(4) ++
new freechips.rocketchip.rocket.WithNHugeCores(1) ++
new chipyard.config.AbstractConfig)

class AES256ECBRocketConfig extends Config(
new aes.WithAES256ECBAccel ++ // use Caliptra AES 256 ECB accelerator
new freechips.rocketchip.rocket.WithNHugeCores(1) ++
new chipyard.config.WithSystemBusWidth(256) ++
new chipyard.config.AbstractConfig)

class ReRoCCTestConfig extends Config(
new rerocc.WithReRoCC ++
new chipyard.config.WithCharacterCountRoCC ++ // rerocc tile4 is charcnt
Expand All @@ -67,7 +51,3 @@ class ReRoCCManyGemminiConfig extends Config(
new freechips.rocketchip.rocket.WithNHugeCores(4) ++ // 4 rocket cores
new chipyard.config.AbstractConfig)

class ZstdCompressorRocketConfig extends Config(
new compressacc.WithZstdCompressor ++
new freechips.rocketchip.rocket.WithNHugeCores(1) ++
new chipyard.config.AbstractConfig)
183 changes: 0 additions & 183 deletions generators/chipyard/src/main/scala/config/SaturnConfigs.scala

This file was deleted.

2 changes: 1 addition & 1 deletion generators/compress-acc
2 changes: 1 addition & 1 deletion generators/mempress
Loading
Loading