Compare commits

13 Commits

Author SHA1 Message Date
87783dc9f6 Track radiance WU architecture updates
Some checks failed
update-circt / update-circt (push) Has been cancelled
2026-05-27 09:08:16 +08:00
Zhongdi LUO
9206c4452f Update submodules and gitmodules configuration
Some checks failed
update-circt / update-circt (push) Has been cancelled
2026-05-26 12:58:22 +00:00
5ce98e1491 Update WU architecture integration 2026-05-25 19:26:23 +08:00
ec349a854f Add Blackwell tensor core support to Chipyard
Some checks failed
update-circt / update-circt (push) Has been cancelled
- Update RadianceConfigs.scala with Blackwell configurations
- Update Verilator Makefile with optimized build flags
- Update submodules: radiance (Blackwell implementation), gemmini (params update)
- Update build flags and gitignore
2026-05-06 14:52:08 +08:00
f8c98496f5 Wire Blackwell radiance config 2026-04-25 10:15:57 +08:00
Hansung Kim
aeb4517074 Fix smem script filename 2025-01-31 01:54:51 -08:00
Hansung Kim
c1f922706e Add flash utilization 2025-01-31 00:49:51 -08:00
Richard Yan
8c228a6a89 sanity script, bump radiance 2025-01-31 00:01:18 -08:00
Hansung Kim
4187738b51 Add missing flash compile and run script 2025-01-30 23:26:23 -08:00
Richard Yan
e95ffe0ca0 Merge branch 'asplos-ae' of https://github.com/hansungk/chipyard into asplos-ae 2025-01-30 22:35:16 -08:00
Richard Yan
f7a7444f1c bump radiance 2025-01-30 22:35:12 -08:00
Hansung Kim
4f3dca2e0c Bump radiance 2025-01-30 21:38:54 -08:00
Richard Yan
8e841f3326 update env script 2025-01-30 21:28:24 -08:00
16 changed files with 141 additions and 26 deletions

4
.gitignore vendored
View File

@@ -28,3 +28,7 @@ project/project/
.sbt .sbt
.classpath_cache/ .classpath_cache/
.vscode/ .vscode/
**/*.o
**/*.fir
**/*.d
test_run_dir/

14
.gitmodules vendored
View File

@@ -87,22 +87,22 @@
url = https://github.com/ucb-bar/libgloss-htif.git url = https://github.com/ucb-bar/libgloss-htif.git
[submodule "toolchains/riscv-tools/riscv-isa-sim"] [submodule "toolchains/riscv-tools/riscv-isa-sim"]
path = toolchains/riscv-tools/riscv-isa-sim path = toolchains/riscv-tools/riscv-isa-sim
url = https://github.com/richardyrh/riscv-isa-sim url = https://gh-proxy.org/https://github.com/richardyrh/riscv-isa-sim
[submodule "toolchains/riscv-tools/riscv-openocd"] [submodule "toolchains/riscv-tools/riscv-openocd"]
path = toolchains/riscv-tools/riscv-openocd path = toolchains/riscv-tools/riscv-openocd
url = https://github.com/riscv/riscv-openocd.git url = https://gh-proxy.org/https://github.com/riscv/riscv-openocd.git
[submodule "toolchains/riscv-tools/riscv-pk"] [submodule "toolchains/riscv-tools/riscv-pk"]
path = toolchains/riscv-tools/riscv-pk path = toolchains/riscv-tools/riscv-pk
url = https://github.com/riscv-software-src/riscv-pk.git url = https://gh-proxy.org/https://github.com/riscv-software-src/riscv-pk.git
[submodule "toolchains/riscv-tools/riscv-spike-devices"] [submodule "toolchains/riscv-tools/riscv-spike-devices"]
path = toolchains/riscv-tools/riscv-spike-devices path = toolchains/riscv-tools/riscv-spike-devices
url = https://github.com/ucb-bar/spike-devices.git url = https://gh-proxy.org/https://github.com/ucb-bar/spike-devices.git
[submodule "toolchains/riscv-tools/riscv-tests"] [submodule "toolchains/riscv-tools/riscv-tests"]
path = toolchains/riscv-tools/riscv-tests path = toolchains/riscv-tools/riscv-tests
url = https://github.com/riscv-software-src/riscv-tests.git url = https://gh-proxy.org/https://github.com/riscv-software-src/riscv-tests.git
[submodule "toolchains/riscv-tools/riscv-tools-feedstock"] [submodule "toolchains/riscv-tools/riscv-tools-feedstock"]
path = toolchains/riscv-tools/riscv-tools-feedstock path = toolchains/riscv-tools/riscv-tools-feedstock
url = https://github.com/ucb-bar/riscv-tools-feedstock.git url = https://gh-proxy.org/https://github.com/ucb-bar/riscv-tools-feedstock.git
[submodule "tools/DRAMSim2"] [submodule "tools/DRAMSim2"]
path = tools/DRAMSim2 path = tools/DRAMSim2
url = https://github.com/firesim/DRAMSim2.git url = https://github.com/firesim/DRAMSim2.git
@@ -159,4 +159,4 @@
url = https://github.com/ucb-bar/compress-acc.git url = https://github.com/ucb-bar/compress-acc.git
[submodule "generators/radiance"] [submodule "generators/radiance"]
path = generators/radiance path = generators/radiance
url = https://github.com/ucb-bar/radiance.git url = https://git.nudt.space/wu-arch/radiance.git

View File

@@ -26,6 +26,7 @@ class WithRadBootROM(address: BigInt = 0x10000, size: Int = 0x10000, hang: BigIn
class VirgoConfig extends RadianceClusterConfig class VirgoConfig extends RadianceClusterConfig
class VirgoFP16Config extends RadianceFP16ClusterConfig class VirgoFP16Config extends RadianceFP16ClusterConfig
class VirgoHopperConfig extends Radiance4CFP16ClusterConfig class VirgoHopperConfig extends Radiance4CFP16ClusterConfig
class VirgoBlackwellConfig extends RadianceBlackwellClusterConfig
class VirgoFlashConfig extends RadianceClusterConfig class VirgoFlashConfig extends RadianceClusterConfig
class VirgoSynConfig extends RadianceClusterSynConfig class VirgoSynConfig extends RadianceClusterSynConfig
class VirgoFP16SynConfig extends RadianceFP16ClusterSynConfig class VirgoFP16SynConfig extends RadianceFP16ClusterSynConfig
@@ -85,6 +86,16 @@ class Radiance4CFP16ClusterConfig extends Config(
new radiance.subsystem.WithRadianceCluster(0) ++ new radiance.subsystem.WithRadianceCluster(0) ++
new RadianceBaseConfig) new RadianceBaseConfig)
class RadianceBlackwellClusterConfig extends Config(
new radiance.subsystem.WithRadianceGemmini(location = InCluster(0), dim = 16, accSizeInKB = 32, tileSize = (8, 4, 8), dataType = RadianceGemminiDataType.FP16) ++
new radiance.subsystem.WithRadianceCores(1, location = InCluster(0), tensorCoreFP16 = true, tensorCoreDecoupled = false, tensorCoreBlackwell = true, numTensorWarps = 2, startupAddress = BigInt("80000000", 16), useVxCache = false) ++
new radiance.subsystem.WithRadianceSharedMem(address = x"ff000000", size = 128 << 10, numBanks = 4, numWords = 8) ++
new radiance.subsystem.WithCoalescer(nNewSrcIds = 16) ++
new radiance.subsystem.WithVortexL1Banks(nBanks = 8) ++
new radiance.subsystem.WithRadianceCluster(0) ++
new radiance.subsystem.WithSimtConfig(nWarps = 4, nCoreLanes = 4, nMemLanes = 4, nSrcIds = 32) ++
new RadianceBaseConfig)
class RadianceClusterConfig extends Config( class RadianceClusterConfig extends Config(
// important to keep gemmini tile before RadianceCores to ensure radiance tile id is 0-indexed // important to keep gemmini tile before RadianceCores to ensure radiance tile id is 0-indexed
new radiance.subsystem.WithRadianceGemmini(location = InCluster(0), dim = 8, accSizeInKB = 16, tileSize = 8) ++ new radiance.subsystem.WithRadianceGemmini(location = InCluster(0), dim = 8, accSizeInKB = 16, tileSize = 8) ++

View File

@@ -1,7 +1,7 @@
#---------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------
# common gcc configuration/optimization # common gcc configuration/optimization
#---------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------
SIM_OPT_CXXFLAGS := -O3 SIM_OPT_CXXFLAGS := -O0
LRISCV=-lriscv LRISCV=-lriscv
export USE_CHISEL6=1 export USE_CHISEL6=1

View File

@@ -16,4 +16,6 @@ make CONFIG=VirgoFP16Config debug
echo -e "\nCompiling hopper & virgo designs" echo -e "\nCompiling hopper & virgo designs"
make CONFIG=VirgoHopperConfig make CONFIG=VirgoHopperConfig
make CONFIG=VirgoHopperConfig debug make CONFIG=VirgoHopperConfig debug
echo -e "\nCompiling flash designs"
make CONFIG=VirgoFlashConfig
echo -e "\nCompilation completed" echo -e "\nCompilation completed"

View File

@@ -1,6 +1,4 @@
#!/bin/bash
echo "!!!!!!!!!!!!!!!1!!!!!!!!!!!" ENV_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "need to update kernels path" export KERNELS_PATH="$(realpath ${ENV_SCRIPT_DIR}/../../../../virgo-kernels/kernels)"
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!"
export KERNELS_PATH="/scratch/yrh/vxsw/kernels"

View File

@@ -156,7 +156,7 @@ def main():
print(translated_line, end='') print(translated_line, end='')
sys.stdout.flush() sys.stdout.flush()
print("\033[s", end='') print("\033[2J\033[s", end='')
print("\033[" + str(lineno) + "H\033[2K\033[1m" + run_label, "DONE", "\033[0m", end='') print("\033[" + str(lineno) + "H\033[2K\033[1m" + run_label, "DONE", "\033[0m", end='')
print("\033[u", end='', flush=True) print("\033[u", end='', flush=True)

View File

@@ -38,6 +38,8 @@ check_exists "simv-chipyard.harness-VirgoHopperConfig-debug"
check_exists "$KERNELS_PATH/sgemm_tcore/kernel.radiance.gemm.tcore.volta.dim256.elf" check_exists "$KERNELS_PATH/sgemm_tcore/kernel.radiance.gemm.tcore.volta.dim256.elf"
check_exists "$KERNELS_PATH/sgemm_tcore/kernel.radiance.gemm.tcore.hopper.dim512.elf" check_exists "$KERNELS_PATH/sgemm_tcore/kernel.radiance.gemm.tcore.hopper.dim512.elf"
check_exists "$KERNELS_PATH/sgemm_gemmini_dma/kernel.radiance.gemm.virgo.hopper.dim1024.elf" check_exists "$KERNELS_PATH/sgemm_gemmini_dma/kernel.radiance.gemm.virgo.hopper.dim1024.elf"
check_exists "$KERNELS_PATH/flash_attention/kernel.radiance.flash.ampere.seqlen1024.headdim64.elf"
check_exists "$KERNELS_PATH/flash_attention/kernel.radiance.flash.virgo.seqlen1024.headdim64.elf"
echo "Simulations will be started in parallel in 5 seconds. Please do not Ctrl+C as it kills all subprocesses." echo "Simulations will be started in parallel in 5 seconds. Please do not Ctrl+C as it kills all subprocesses."
@@ -54,6 +56,9 @@ for dim in "${dims[@]}"; do
suffix="" suffix=""
done done
start_run VirgoFlashConfig flash_attention/kernel.radiance.flash.ampere.seqlen1024.headdim64.elf "flash ampere" ""
start_run VirgoFlashConfig flash_attention/kernel.radiance.flash.virgo.seqlen1024.headdim64.elf "flash virgo " ""
wait wait
echo "All simulations have finished!" echo "All simulations have finished!"

43
sims/vcs/scripts/sanity.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
set -e
echoerr() { echo "$@" 1>&2; }
CURRENT_DIR="${PWD##*/}"
if [[ "$CURRENT_DIR" != "vcs" ]]; then
echoerr "Error: This script must be run from chipyard/sims/vcs."
exit 1
fi
source ./scripts/env.sh > /dev/null
check_exists() {
if ! [ -f "$1" ]; then
echo "Error: looked for file $1 that does not exist."
exit 1
fi
}
echo "Checking if all kernels have been compiled.."
dims=(256 512 1024)
for dim in "${dims[@]}"; do
check_exists "$KERNELS_PATH/sgemm_tcore/kernel.radiance.gemm.tcore.volta.dim${dim}.elf"
check_exists "$KERNELS_PATH/sgemm_tcore/kernel.radiance.gemm.tcore.ampere.dim${dim}.elf"
check_exists "$KERNELS_PATH/sgemm_tcore/kernel.radiance.gemm.tcore.hopper.dim${dim}.elf"
check_exists "$KERNELS_PATH/sgemm_gemmini_dma/kernel.radiance.gemm.virgo.hopper.dim${dim}.elf"
done
check_exists "$KERNELS_PATH/flash_attention/kernel.radiance.flash.ampere.seqlen1024.headdim64.elf"
check_exists "$KERNELS_PATH/flash_attention/kernel.radiance.flash.virgo.seqlen1024.headdim64.elf"
echo "Checking if all simulation binaries have been compiled.."
check_exists "simv-chipyard.harness-VirgoFP16Config"
check_exists "simv-chipyard.harness-VirgoFP16Config-debug"
check_exists "simv-chipyard.harness-VirgoHopperConfig"
check_exists "simv-chipyard.harness-VirgoHopperConfig-debug"
check_exists "simv-chipyard.harness-VirgoFlashConfig"
echo "Sanity check passed!"

View File

@@ -0,0 +1,42 @@
#!/bin/bash
set -e
echoerr() { echo "$@" 1>&2; }
CURRENT_DIR="${PWD##*/}"
if [[ "$CURRENT_DIR" != "vcs" ]]; then
echoerr "Error: This script must be run from chipyard/sims/vcs."
exit 1
fi
source ./scripts/env.sh > /dev/null
rm -f /tmp/markers.log
runtime() {
log_path="output/chipyard.harness.TestHarness.$1/kernel.radiance.$2.log"
check_exists "${log_path}"
if [ -z "$(tail -n10 ${log_path} | rg 'finish called')" ]; then
echo "$3,0"
echoerr "$3 run is not complete"
return
fi
rg "(e0d0a013|be90a013)" ${log_path} > /tmp/markers.log
echo -n "$3,"
cycles=$(python3 ./scripts/runtime_fast.py /tmp/markers.log)
echo "$cycles"
util=$(echo "scale=2; 64 * 64 * 64 * 100 / $cycles" | bc)
echoerr "$3 cycles: $cycles, hw utilization: ${util}%"
rm -f /tmp/markers.log
}
check_exists() {
if ! [ -f "$1" ]; then
echoerr "Error: looked for file $1 that does not exist."
exit 1
fi
}
echo ",cycles"
runtime VirgoFlashConfig flash.virgo.seqlen1024.headdim64 "virgo"
runtime VirgoFlashConfig flash.ampere.seqlen1024.headdim64 "ampere"

View File

@@ -91,6 +91,7 @@ RUNTIME_PROFILING_VFLAGS := $(if $(filter $(VERILATOR_PROFILE),all),\
VERILATOR_THREADS ?= 1 VERILATOR_THREADS ?= 1
RUNTIME_THREADS := --threads $(VERILATOR_THREADS) --threads-dpi all RUNTIME_THREADS := --threads $(VERILATOR_THREADS) --threads-dpi all
VERILATOR_MAKE_JOBS ?= 4
USE_FST ?= 0 USE_FST ?= 0
TRACING_OPTS := $(if $(filter $(USE_FST),0),\ TRACING_OPTS := $(if $(filter $(USE_FST),0),\
@@ -103,12 +104,17 @@ get_waveform_flag = +vcdfile=$(1).$(if $(filter $(USE_FST),0),vcd,fst)
#---------------------------------------------------------------------------------------- #----------------------------------------------------------------------------------------
# we initially had --noassert for performance, but several modules use # we initially had --noassert for performance, but several modules use
# assertions, including dramsim, so we enable --assert by default # assertions, including dramsim, so we enable --assert by default
VERILATOR_OUTPUT_SPLIT ?= 2000
VERILATOR_OUTPUT_SPLIT_CFUNCS ?= 20
VERILATOR_OUTPUT_GROUPS ?= 0
VERILATOR_OPT_FLAGS ?= \ VERILATOR_OPT_FLAGS ?= \
-O3 \ -O0 \
--x-assign fast \ --x-assign fast \
--x-initial fast \ --x-initial fast \
--output-split 10000 \ --output-split $(VERILATOR_OUTPUT_SPLIT) \
--output-split-cfuncs 100 --output-split-cfuncs $(VERILATOR_OUTPUT_SPLIT_CFUNCS) \
-DPRINTF_COND_=1
# default flags added for external IP (cva6/NVDLA) # default flags added for external IP (cva6/NVDLA)
VERILOG_IP_VERILATOR_FLAGS := \ VERILOG_IP_VERILATOR_FLAGS := \
@@ -164,6 +170,8 @@ VERILATOR_NONCC_OPTS = \
VERILATOR_CXXFLAGS = \ VERILATOR_CXXFLAGS = \
$(SIM_CXXFLAGS) \ $(SIM_CXXFLAGS) \
$(RUNTIME_PROFILING_CFLAGS) \ $(RUNTIME_PROFILING_CFLAGS) \
-O0 \
-fno-inline \
-DVERILATOR -DVERILATOR
VERILATOR_LDFLAGS = $(SIM_LDFLAGS) VERILATOR_LDFLAGS = $(SIM_LDFLAGS)
@@ -193,25 +201,23 @@ model_mk_debug = $(model_dir_debug)/V$(TB).mk
# build makefile fragment that builds the verilator sim rules # build makefile fragment that builds the verilator sim rules
######################################################################################### #########################################################################################
$(model_mk): $(sim_common_files) $(EXTRA_SIM_REQS) $(model_mk): $(sim_common_files) $(EXTRA_SIM_REQS)
rm -rf $(model_dir)
mkdir -p $(model_dir) mkdir -p $(model_dir)
$(VERILATOR) -j 36 $(VERILATOR_OPTS) $(EXTRA_SIM_SOURCES) -o $(sim) -Mdir $(model_dir) $(VERILATOR) -j $(VERILATOR_MAKE_JOBS) $(VERILATOR_OPTS) $(EXTRA_SIM_SOURCES) -o $(sim) -Mdir $(model_dir)
touch $@ touch $@
$(model_mk_debug): $(sim_common_files) $(EXTRA_SIM_REQS) $(model_mk_debug): $(sim_common_files) $(EXTRA_SIM_REQS)
rm -rf $(model_dir_debug)
mkdir -p $(model_dir_debug) mkdir -p $(model_dir_debug)
$(VERILATOR) -j 36 $(VERILATOR_OPTS) +define+DEBUG $(EXTRA_SIM_SOURCES) -o $(sim_debug) $(TRACING_OPTS) -Mdir $(model_dir_debug) $(VERILATOR) -j $(VERILATOR_MAKE_JOBS) $(VERILATOR_OPTS) +define+DEBUG $(EXTRA_SIM_SOURCES) -o $(sim_debug) $(TRACING_OPTS) -Mdir $(model_dir_debug)
touch $@ touch $@
######################################################################################### #########################################################################################
# invoke make to make verilator sim rules # invoke make to make verilator sim rules
######################################################################################### #########################################################################################
$(sim): $(model_mk) $(dramsim_lib) $(sim): $(model_mk) $(dramsim_lib)
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(model_dir) -f V$(TB).mk $(MAKE) -j $(VERILATOR_MAKE_JOBS) VM_PARALLEL_BUILDS=1 OPT_FAST=-O0 OPT_SLOW=-O0 OPT_GLOBAL=-O0 -C $(model_dir) -f V$(TB).mk
$(sim_debug): $(model_mk_debug) $(dramsim_lib) $(sim_debug): $(model_mk_debug) $(dramsim_lib)
$(MAKE) VM_PARALLEL_BUILDS=1 -C $(model_dir_debug) -f V$(TB).mk $(MAKE) -j $(VERILATOR_MAKE_JOBS) VM_PARALLEL_BUILDS=1 OPT_FAST=-O0 OPT_SLOW=-O0 OPT_GLOBAL=-O0 -C $(model_dir_debug) -f V$(TB).mk
######################################################################################### #########################################################################################
# create a verilator vpd rule # create a verilator vpd rule

View File

@@ -285,6 +285,10 @@ get_out_name = $(subst $() $(),_,$(notdir $(basename $(1))))
LOADMEM ?= LOADMEM ?=
LOADARCH ?= LOADARCH ?=
ifeq ($(CONFIG),VirgoBlackwellConfig)
override LOADMEM = 1
endif
ifneq ($(LOADARCH),) ifneq ($(LOADARCH),)
override BINARY = $(addsuffix /mem.elf,$(LOADARCH)) override BINARY = $(addsuffix /mem.elf,$(LOADARCH))
override BINARIES = $(addsuffix /mem.elf,$(LOADARCH)) override BINARIES = $(addsuffix /mem.elf,$(LOADARCH))