Skip to content

Commit

Permalink
Merge pull request #2190 from hansungk/graphics
Browse files Browse the repository at this point in the history
Add GPU project chipyard changes
  • Loading branch information
richardyrh authored Feb 21, 2025
2 parents 1b54cf1 + e4739eb commit 424249b
Show file tree
Hide file tree
Showing 18 changed files with 296 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/check-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ search () {
}


submodules=("cva6" "boom" "ibex" "gemmini" "icenet" "nvdla" "rocket-chip" "rocket-chip-blocks" "rocket-chip-inclusive-cache" "testchipip" "riscv-sodor" "mempress" "bar-fetchers" "shuttle" "constellation" "fft-generator" "hardfloat" "caliptra-aes-acc" "rocc-acc-utils" "diplomacy" "rerocc" "compress-acc" "saturn" "ara" "vexiiriscv" "tacit")
submodules=("cva6" "boom" "ibex" "gemmini" "icenet" "nvdla" "rocket-chip" "rocket-chip-blocks" "rocket-chip-inclusive-cache" "testchipip" "riscv-sodor" "mempress" "bar-fetchers" "shuttle" "constellation" "fft-generator" "hardfloat" "caliptra-aes-acc" "rocc-acc-utils" "diplomacy" "rerocc" "compress-acc" "saturn" "ara" "vexiiriscv" "tacit" "radiance")
dir="generators"
branches=("master" "main" "dev")
search
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ REMOTE_COURSIER_CACHE=$REMOTE_WORK_DIR/.coursier-cache

# key value store to get the build groups
declare -A grouping
grouping["group-cores"]="chipyard-cva6 chipyard-ibex chipyard-rocket chipyard-hetero chipyard-boomv3 chipyard-boomv4 chipyard-sodor chipyard-digitaltop chipyard-multiclock-rocket chipyard-nomem-scratchpad chipyard-spike chipyard-clone chipyard-prefetchers chipyard-shuttle chipyard-shuttle3 chipyard-vexiiriscv chipyard-tacit-rocket"
grouping["group-cores"]="chipyard-cva6 chipyard-ibex chipyard-rocket chipyard-hetero chipyard-boomv3 chipyard-boomv4 chipyard-sodor chipyard-digitaltop chipyard-multiclock-rocket chipyard-nomem-scratchpad chipyard-spike chipyard-clone chipyard-prefetchers chipyard-shuttle chipyard-shuttle3 chipyard-vexiiriscv chipyard-tacit-rocket chipyard-radiance"
grouping["group-peripherals"]="chipyard-dmirocket chipyard-dmiboomv3 chipyard-dmiboomv4 chipyard-spiflashwrite chipyard-mmios chipyard-nocores chipyard-manyperipherals chipyard-chiplike chipyard-tethered chipyard-symmetric chipyard-llcchiplet"
grouping["group-accels"]="chipyard-compressacc chipyard-mempress chipyard-gemmini chipyard-manymmioaccels chipyard-nvdla chipyard-aes256ecb chipyard-rerocc chipyard-rocketvector chipyard-shuttlevector chipyard-hlsacc" # chipyard-shuttleara - Add when Ara works again
grouping["group-constellation"]="chipyard-constellation"
Expand Down Expand Up @@ -80,6 +80,7 @@ mapping["chipyard-rerocc"]=" CONFIG=ReRoCCTestConfig"
mapping["chipyard-rocketvector"]=" CONFIG=MINV128D64RocketConfig"
mapping["chipyard-shuttlevector"]=" CONFIG=GENV256D128ShuttleConfig"
mapping["chipyard-shuttleara"]=" CONFIG=V4096Ara2LaneShuttleConfig USE_ARA=1 verilog"
mapping["chipyard-radiance"]=" CONFIG=RadianceFP16ClusterConfig verilog"

mapping["constellation"]=" SUB_PROJECT=constellation"
mapping["icenet"]="SUB_PROJECT=icenet"
Expand Down
3 changes: 3 additions & 0 deletions .github/scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ case $1 in
chipyard-tacit-rocket)
run_binary LOADMEM=1 BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/benchmarks/dhrystone.riscv
;;
chipyard-radiance)
# Verilator fails to build sim binary, just generate verilog
;;
icenet)
run_binary BINARY=none
;;
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/chipyard-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,29 @@ jobs:
group-key: "group-cores"
project-key: "chipyard-shuttle3"

chipyard-radiance-run-tests:
name: chipyard-radiance-run-tests
needs: prepare-chipyard-cores
runs-on: as4
steps:
- name: Delete old checkout
run: |
ls -alh .
rm -rf ${{ github.workspace }}/* || true
rm -rf ${{ github.workspace }}/.* || true
ls -alh .
- name: Checkout
uses: actions/checkout@v4
- name: Git workaround
uses: ./.github/actions/git-workaround
- name: Create conda env
uses: ./.github/actions/create-conda-env
- name: Run tests
uses: ./.github/actions/run-tests
with:
group-key: "group-cores"
project-key: "chipyard-radiance"

chipyard-tacit-rocket-run-tests:
name: chipyard-tacit-rocket-run-tests
needs: prepare-chipyard-cores
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,6 @@
[submodule "generators/tacit"]
path = generators/tacit
url = https://github.com/ucb-bar/tacit.git
[submodule "generators/radiance"]
path = generators/radiance
url = https://github.com/ucb-bar/radiance.git
13 changes: 12 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ lazy val testchipip = (project in file("generators/testchipip"))
lazy val chipyard = (project in file("generators/chipyard"))
.dependsOn(testchipip, rocketchip, boom, rocketchip_blocks, rocketchip_inclusive_cache,
dsptools, rocket_dsp_utils,
gemmini, icenet, tracegen, cva6, nvdla, sodor, ibex, fft_generator,
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)
Expand Down Expand Up @@ -243,6 +243,17 @@ lazy val sodor = (project in file("generators/riscv-sodor"))
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(commonSettings)

lazy val radiance = (project in file("generators/radiance"))
.dependsOn(rocketchip, gemmini)
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chiseltest" % chiselTestVersion,
"org.scalatest" %% "scalatest" % "3.2.+" % "test",
"junit" % "junit" % "4.13" % "test",
"org.scalacheck" %% "scalacheck" % "1.14.3" % "test",
))
.settings(commonSettings)

lazy val gemmini = freshProject("gemmini", file("generators/gemmini"))
.dependsOn(rocketchip)
.settings(libraryDependencies ++= rocketLibDeps.value)
Expand Down
31 changes: 26 additions & 5 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ HELP_COMPILATION_VARIABLES += \
" EXTRA_SIM_LDFLAGS = additional LDFLAGS for building simulators" \
" EXTRA_SIM_SOURCES = additional simulation sources needed for simulator" \
" EXTRA_SIM_REQS = additional make requirements to build the simulator" \
" EXTRA_SIM_OUT_NAME = additional suffix appended to the simulation .out log filename" \
" EXTRA_SIM_PREPROC_DEFINES = additional Verilog preprocessor defines passed to the simulator" \
" ENABLE_YOSYS_FLOW = if set, add compilation flags to enable the vlsi flow for yosys(tutorial flow)" \
" EXTRA_CHISEL_OPTIONS = additional options to pass to the Chisel compiler" \
" MFC_BASE_LOWERING_OPTIONS = override lowering options to pass to the MLIR FIRRTL compiler" \
Expand All @@ -26,6 +28,7 @@ EXTRA_SIM_CXXFLAGS ?=
EXTRA_SIM_LDFLAGS ?=
EXTRA_SIM_SOURCES ?=
EXTRA_SIM_REQS ?=
EXTRA_SIM_OUT_NAME ?=

ifneq ($(ASPECTS), )
comma = ,
Expand Down Expand Up @@ -67,6 +70,7 @@ 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

#########################################################################################
Expand Down Expand Up @@ -233,6 +237,8 @@ $(TOP_SMEMS_CONF) $(MODEL_SMEMS_CONF) &: $(MFC_SMEMS_CONF) $(MFC_MODEL_HRCHY_JS
--model-module-name $(MODEL) \
--out-dut-smems-conf $(TOP_SMEMS_CONF) \
--out-model-smems-conf $(MODEL_SMEMS_CONF)
# for blackboxed SRAMs: add custom.mems.conf as blackbox and use generated module name in blackbox verilog source
-[ -f $(GEN_COLLATERAL_DIR)/custom.mems.conf ] && cat $(GEN_COLLATERAL_DIR)/custom.mems.conf >> $(TOP_SMEMS_CONF)

# This file is for simulation only. VLSI flows should replace this file with one containing hard SRAMs
TOP_MACROCOMPILER_MODE ?= --mode synflops
Expand All @@ -256,7 +262,7 @@ ifneq (,$(EXT_FILELISTS))
else
rm -f $@
endif
sort -u $(sim_files) $(ALL_MODS_FILELIST) | grep -v '.*\.\(svh\|h\)$$' >> $@
sort -u $(sim_files) $(ALL_MODS_FILELIST) | grep -v '.*\.\(svh\|h\|conf\)$$' >> $@
echo "$(TOP_SMEMS_FILE)" >> $@
echo "$(MODEL_SMEMS_FILE)" >> $@

Expand Down Expand Up @@ -305,15 +311,15 @@ get_loadarch_flag = +loadarch=$(subst mem.elf,loadarch,$(1))
endif

# get the output path base name for simulation outputs, First arg is the binary
get_sim_out_name = $(output_dir)/$(call get_out_name,$(1))
get_sim_out_name = $(output_dir)/$(call get_out_name,$(1))$(if $(EXTRA_SIM_OUT_NAME),.$(EXTRA_SIM_OUT_NAME),)
# sim flags that are common to run-binary/run-binary-fast/run-binary-debug
get_common_sim_flags = $(SIM_FLAGS) $(EXTRA_SIM_FLAGS) $(SEED_FLAG) $(call get_loadmem_flag,$(1)) $(call get_loadarch_flag,$(1))

.PHONY: %.run %.run.debug %.run.fast

# run normal binary with hardware-logged insn dissassembly
run-binary: check-binary $(BINARY).run
run-binaries: check-binaries $(addsuffix .run,$(BINARIES))
run-binaries: check-binaries $(addsuffix .run,$(wildcard $(BINARIES)))

%.run: %.check-exists $(SIM_PREREQ) | $(output_dir)
(set -o pipefail && $(NUMA_PREFIX) $(sim) \
Expand All @@ -327,7 +333,7 @@ run-binaries: check-binaries $(addsuffix .run,$(BINARIES))

# run simulator as fast as possible (no insn disassembly)
run-binary-fast: check-binary $(BINARY).run.fast
run-binaries-fast: check-binaries $(addsuffix .run.fast,$(BINARIES))
run-binaries-fast: check-binaries $(addsuffix .run.fast,$(wildcard $(BINARIES)))

%.run.fast: %.check-exists $(SIM_PREREQ) | $(output_dir)
(set -o pipefail && $(NUMA_PREFIX) $(sim) \
Expand All @@ -340,7 +346,9 @@ run-binaries-fast: check-binaries $(addsuffix .run.fast,$(BINARIES))

# run simulator with as much debug info as possible
run-binary-debug: check-binary $(BINARY).run.debug
run-binaries-debug: check-binaries $(addsuffix .run.debug,$(BINARIES))
run-binary-debug-bg: check-binary $(BINARY).run.debug.bg
run-binaries-debug: check-binaries $(addsuffix .run.debug,$(wildcard $(BINARIES)))
run-binaries-debug-bg: check-binaries $(addsuffix .run.debug.bg,$(wildcard $(BINARIES)))

%.run.debug: %.check-exists $(SIM_DEBUG_PREREQ) | $(output_dir)
ifeq (1,$(DUMP_BINARY))
Expand All @@ -356,6 +364,19 @@ endif
$(BINARY_ARGS) \
</dev/null 2> >(spike-dasm > $(call get_sim_out_name,$*).out) | tee $(call get_sim_out_name,$*).log)

%.run.debug.bg: %.check-exists $(SIM_DEBUG_PREREQ) | $(output_dir)
if [ "$*" != "none" ]; then riscv64-unknown-elf-objdump -D -S $* > $(call get_sim_out_name,$*).dump ; fi
(set -o pipefail && $(NUMA_PREFIX) $(sim_debug) \
$(PERMISSIVE_ON) \
$(call get_common_sim_flags,$*) \
$(VERBOSE_FLAGS) \
$(call get_waveform_flag,$(call get_sim_out_name,$*)) \
$(PERMISSIVE_OFF) \
$* \
$(BINARY_ARGS) \
</dev/null 2> >(spike-dasm > $(call get_sim_out_name,$*).out) >$(call get_sim_out_name,$*).log \
& echo "PID=$$!")

run-fast: run-asm-tests-fast run-bmark-tests-fast

#########################################################################################
Expand Down
2 changes: 2 additions & 0 deletions generators/chipyard/src/main/scala/DigitalTop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class DigitalTop(implicit p: Parameters) extends ChipyardSystem
with sifive.blocks.devices.gpio.HasPeripheryGPIO // Enables optionally adding the sifive GPIOs
with sifive.blocks.devices.spi.HasPeripherySPIFlash // Enables optionally adding the sifive SPI flash controller
with sifive.blocks.devices.spi.HasPeripherySPI // Enables optionally adding the sifive SPI port
with radiance.memory.CanHaveMemtraceCore // Enables memtrace core
with radiance.memory.CanHaveRadianceROMs // Enables radiance argument ROMs
with icenet.CanHavePeripheryIceNIC // Enables optionally adding the IceNIC for FireSim
with chipyard.example.CanHavePeripheryInitZero // Enables optionally adding the initzero example widget
with chipyard.example.CanHavePeripheryGCD // Enables optionally adding the GCD example widget
Expand Down
20 changes: 20 additions & 0 deletions generators/chipyard/src/main/scala/config/CoalescerConfigs.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package chipyard

import org.chipsalliance.cde.config.{Config}
import freechips.rocketchip.prci.AsynchronousCrossing

class MemtraceCoreConfig extends Config(
// Memtrace
new radiance.subsystem.WithMemtraceCore("vecadd.core1.thread4.trace",
traceHasSource = false) ++
// new radiance.subsystem.WithMemtraceCore("nvbit.vecadd.n100000.filter_sm0.lane32.trace",
// traceHasSource = false) ++
new radiance.subsystem.WithCoalescer(nNewSrcIds = 2) ++
new radiance.subsystem.WithSimtConfig(nMemLanes = 4, nSrcIds = 8) ++
// L2
new freechips.rocketchip.subsystem.WithInclusiveCache(nWays=8, capacityKB=512) ++
new freechips.rocketchip.subsystem.WithNBanks(4) ++
new chipyard.config.WithSystemBusWidth(16 * 8) ++
new chipyard.NoCoresConfig
)

Loading

0 comments on commit 424249b

Please # to comment.