Skip to content

Commit 424249b

Browse files
authored
Merge pull request #2190 from hansungk/graphics
Add GPU project chipyard changes
2 parents 1b54cf1 + e4739eb commit 424249b

18 files changed

+296
-13
lines changed

Diff for: .github/scripts/check-commit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ search () {
4646
}
4747

4848

49-
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")
49+
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")
5050
dir="generators"
5151
branches=("master" "main" "dev")
5252
search

Diff for: .github/scripts/defaults.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ REMOTE_COURSIER_CACHE=$REMOTE_WORK_DIR/.coursier-cache
2525

2626
# key value store to get the build groups
2727
declare -A grouping
28-
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"
28+
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"
2929
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"
3030
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
3131
grouping["group-constellation"]="chipyard-constellation"
@@ -80,6 +80,7 @@ mapping["chipyard-rerocc"]=" CONFIG=ReRoCCTestConfig"
8080
mapping["chipyard-rocketvector"]=" CONFIG=MINV128D64RocketConfig"
8181
mapping["chipyard-shuttlevector"]=" CONFIG=GENV256D128ShuttleConfig"
8282
mapping["chipyard-shuttleara"]=" CONFIG=V4096Ara2LaneShuttleConfig USE_ARA=1 verilog"
83+
mapping["chipyard-radiance"]=" CONFIG=RadianceFP16ClusterConfig verilog"
8384

8485
mapping["constellation"]=" SUB_PROJECT=constellation"
8586
mapping["icenet"]="SUB_PROJECT=icenet"

Diff for: .github/scripts/run-tests.sh

+3
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ case $1 in
173173
chipyard-tacit-rocket)
174174
run_binary LOADMEM=1 BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/benchmarks/dhrystone.riscv
175175
;;
176+
chipyard-radiance)
177+
# Verilator fails to build sim binary, just generate verilog
178+
;;
176179
icenet)
177180
run_binary BINARY=none
178181
;;

Diff for: .github/workflows/chipyard-run-tests.yml

+23
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,29 @@ jobs:
535535
group-key: "group-cores"
536536
project-key: "chipyard-shuttle3"
537537

538+
chipyard-radiance-run-tests:
539+
name: chipyard-radiance-run-tests
540+
needs: prepare-chipyard-cores
541+
runs-on: as4
542+
steps:
543+
- name: Delete old checkout
544+
run: |
545+
ls -alh .
546+
rm -rf ${{ github.workspace }}/* || true
547+
rm -rf ${{ github.workspace }}/.* || true
548+
ls -alh .
549+
- name: Checkout
550+
uses: actions/checkout@v4
551+
- name: Git workaround
552+
uses: ./.github/actions/git-workaround
553+
- name: Create conda env
554+
uses: ./.github/actions/create-conda-env
555+
- name: Run tests
556+
uses: ./.github/actions/run-tests
557+
with:
558+
group-key: "group-cores"
559+
project-key: "chipyard-radiance"
560+
538561
chipyard-tacit-rocket-run-tests:
539562
name: chipyard-tacit-rocket-run-tests
540563
needs: prepare-chipyard-cores

Diff for: .gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,6 @@
157157
[submodule "generators/tacit"]
158158
path = generators/tacit
159159
url = https://github.com/ucb-bar/tacit.git
160+
[submodule "generators/radiance"]
161+
path = generators/radiance
162+
url = https://github.com/ucb-bar/radiance.git

Diff for: build.sbt

+12-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ lazy val testchipip = (project in file("generators/testchipip"))
156156
lazy val chipyard = (project in file("generators/chipyard"))
157157
.dependsOn(testchipip, rocketchip, boom, rocketchip_blocks, rocketchip_inclusive_cache,
158158
dsptools, rocket_dsp_utils,
159-
gemmini, icenet, tracegen, cva6, nvdla, sodor, ibex, fft_generator,
159+
radiance, gemmini, icenet, tracegen, cva6, nvdla, sodor, ibex, fft_generator,
160160
constellation, mempress, barf, shuttle, caliptra_aes, rerocc,
161161
compressacc, saturn, ara, firrtl2_bridge, vexiiriscv, tacit)
162162
.settings(libraryDependencies ++= rocketLibDeps.value)
@@ -243,6 +243,17 @@ lazy val sodor = (project in file("generators/riscv-sodor"))
243243
.settings(libraryDependencies ++= rocketLibDeps.value)
244244
.settings(commonSettings)
245245

246+
lazy val radiance = (project in file("generators/radiance"))
247+
.dependsOn(rocketchip, gemmini)
248+
.settings(libraryDependencies ++= rocketLibDeps.value)
249+
.settings(libraryDependencies ++= Seq(
250+
"edu.berkeley.cs" %% "chiseltest" % chiselTestVersion,
251+
"org.scalatest" %% "scalatest" % "3.2.+" % "test",
252+
"junit" % "junit" % "4.13" % "test",
253+
"org.scalacheck" %% "scalacheck" % "1.14.3" % "test",
254+
))
255+
.settings(commonSettings)
256+
246257
lazy val gemmini = freshProject("gemmini", file("generators/gemmini"))
247258
.dependsOn(rocketchip)
248259
.settings(libraryDependencies ++= rocketLibDeps.value)

Diff for: common.mk

+26-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ HELP_COMPILATION_VARIABLES += \
1616
" EXTRA_SIM_LDFLAGS = additional LDFLAGS for building simulators" \
1717
" EXTRA_SIM_SOURCES = additional simulation sources needed for simulator" \
1818
" EXTRA_SIM_REQS = additional make requirements to build the simulator" \
19+
" EXTRA_SIM_OUT_NAME = additional suffix appended to the simulation .out log filename" \
20+
" EXTRA_SIM_PREPROC_DEFINES = additional Verilog preprocessor defines passed to the simulator" \
1921
" ENABLE_YOSYS_FLOW = if set, add compilation flags to enable the vlsi flow for yosys(tutorial flow)" \
2022
" EXTRA_CHISEL_OPTIONS = additional options to pass to the Chisel compiler" \
2123
" MFC_BASE_LOWERING_OPTIONS = override lowering options to pass to the MLIR FIRRTL compiler" \
@@ -26,6 +28,7 @@ EXTRA_SIM_CXXFLAGS ?=
2628
EXTRA_SIM_LDFLAGS ?=
2729
EXTRA_SIM_SOURCES ?=
2830
EXTRA_SIM_REQS ?=
31+
EXTRA_SIM_OUT_NAME ?=
2932

3033
ifneq ($(ASPECTS), )
3134
comma = ,
@@ -67,6 +70,7 @@ include $(base_dir)/generators/ibex/ibex.mk
6770
include $(base_dir)/generators/ara/ara.mk
6871
include $(base_dir)/generators/tracegen/tracegen.mk
6972
include $(base_dir)/generators/nvdla/nvdla.mk
73+
include $(base_dir)/generators/radiance/radiance.mk
7074
include $(base_dir)/tools/torture.mk
7175

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

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

@@ -305,15 +311,15 @@ get_loadarch_flag = +loadarch=$(subst mem.elf,loadarch,$(1))
305311
endif
306312

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

312318
.PHONY: %.run %.run.debug %.run.fast
313319

314320
# run normal binary with hardware-logged insn dissassembly
315321
run-binary: check-binary $(BINARY).run
316-
run-binaries: check-binaries $(addsuffix .run,$(BINARIES))
322+
run-binaries: check-binaries $(addsuffix .run,$(wildcard $(BINARIES)))
317323

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

328334
# run simulator as fast as possible (no insn disassembly)
329335
run-binary-fast: check-binary $(BINARY).run.fast
330-
run-binaries-fast: check-binaries $(addsuffix .run.fast,$(BINARIES))
336+
run-binaries-fast: check-binaries $(addsuffix .run.fast,$(wildcard $(BINARIES)))
331337

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

341347
# run simulator with as much debug info as possible
342348
run-binary-debug: check-binary $(BINARY).run.debug
343-
run-binaries-debug: check-binaries $(addsuffix .run.debug,$(BINARIES))
349+
run-binary-debug-bg: check-binary $(BINARY).run.debug.bg
350+
run-binaries-debug: check-binaries $(addsuffix .run.debug,$(wildcard $(BINARIES)))
351+
run-binaries-debug-bg: check-binaries $(addsuffix .run.debug.bg,$(wildcard $(BINARIES)))
344352

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

367+
%.run.debug.bg: %.check-exists $(SIM_DEBUG_PREREQ) | $(output_dir)
368+
if [ "$*" != "none" ]; then riscv64-unknown-elf-objdump -D -S $* > $(call get_sim_out_name,$*).dump ; fi
369+
(set -o pipefail && $(NUMA_PREFIX) $(sim_debug) \
370+
$(PERMISSIVE_ON) \
371+
$(call get_common_sim_flags,$*) \
372+
$(VERBOSE_FLAGS) \
373+
$(call get_waveform_flag,$(call get_sim_out_name,$*)) \
374+
$(PERMISSIVE_OFF) \
375+
$* \
376+
$(BINARY_ARGS) \
377+
</dev/null 2> >(spike-dasm > $(call get_sim_out_name,$*).out) >$(call get_sim_out_name,$*).log \
378+
& echo "PID=$$!")
379+
359380
run-fast: run-asm-tests-fast run-bmark-tests-fast
360381

361382
#########################################################################################

Diff for: generators/chipyard/src/main/scala/DigitalTop.scala

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class DigitalTop(implicit p: Parameters) extends ChipyardSystem
3232
with sifive.blocks.devices.gpio.HasPeripheryGPIO // Enables optionally adding the sifive GPIOs
3333
with sifive.blocks.devices.spi.HasPeripherySPIFlash // Enables optionally adding the sifive SPI flash controller
3434
with sifive.blocks.devices.spi.HasPeripherySPI // Enables optionally adding the sifive SPI port
35+
with radiance.memory.CanHaveMemtraceCore // Enables memtrace core
36+
with radiance.memory.CanHaveRadianceROMs // Enables radiance argument ROMs
3537
with icenet.CanHavePeripheryIceNIC // Enables optionally adding the IceNIC for FireSim
3638
with chipyard.example.CanHavePeripheryInitZero // Enables optionally adding the initzero example widget
3739
with chipyard.example.CanHavePeripheryGCD // Enables optionally adding the GCD example widget
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package chipyard
2+
3+
import org.chipsalliance.cde.config.{Config}
4+
import freechips.rocketchip.prci.AsynchronousCrossing
5+
6+
class MemtraceCoreConfig extends Config(
7+
// Memtrace
8+
new radiance.subsystem.WithMemtraceCore("vecadd.core1.thread4.trace",
9+
traceHasSource = false) ++
10+
// new radiance.subsystem.WithMemtraceCore("nvbit.vecadd.n100000.filter_sm0.lane32.trace",
11+
// traceHasSource = false) ++
12+
new radiance.subsystem.WithCoalescer(nNewSrcIds = 2) ++
13+
new radiance.subsystem.WithSimtConfig(nMemLanes = 4, nSrcIds = 8) ++
14+
// L2
15+
new freechips.rocketchip.subsystem.WithInclusiveCache(nWays=8, capacityKB=512) ++
16+
new freechips.rocketchip.subsystem.WithNBanks(4) ++
17+
new chipyard.config.WithSystemBusWidth(16 * 8) ++
18+
new chipyard.NoCoresConfig
19+
)
20+

0 commit comments

Comments
 (0)