Add Vitis CI

This commit is contained in:
abejgonzalez 2022-06-14 23:38:01 -07:00
parent dcb64c0271
commit c0d346aa8a
14 changed files with 163 additions and 22 deletions

64
.github/scripts/run-linux-poweroff-vitis.py vendored Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env python3
import sys
from fabric.api import *
from ci_variables import ci_workdir
def run_linux_poweroff_vitis():
""" Runs Base Vitis Build """
# assumptions:
# - machine-launch-script requirements are already installed (i.e. conda env is already active)
# - XILINX_VITIS, XILINX_XRT, XILINX_VIVADO are setup (in env / LD_LIBRARY_PATH / path / etc)
# - RISCV toolchain is already installed
# repo should already be checked out
# HACK: take the RISC-V toolchain prebuilt
with prefix(f'source /scratch/abejgonza/chipyard-work/chipyard/env-riscv-tools.sh && cd {ci_workdir}'):
run("./build-setup.sh --skip-toolchain --skip-validate")
with prefix('source sourceme-f1-manager.sh'):
# avoid logging excessive amounts to prevent GH-A masking secrets (which slows down log output)
with prefix('cd sw/firesim-software'):
run("./init-submodules.sh")
# build outputs.yaml (use this workload since firemarshal can guestmount)
with settings(warn_only=True):
rc = run("./marshal -v build test/outputs.yaml &> outputs.full.log").return_code
if rc != 0:
run("cat outputs.full.log")
raise Exception("Building test/outputs.yaml failed to run")
run("./marshal -v install test/outputs.yaml")
def run_w_timeout(workload_path, workload, timeout):
log_tail_length = 100
rc = 0
with settings(warn_only=True):
# avoid logging excessive amounts to prevent GH-A masking secrets (which slows down log output)
# pty=False needed to avoid issues with screen -ls stalling in fabric
rc = run(f"timeout {timeout} {workload_path}/run-workload.sh {workload_path}/config_runtime.yaml {workload_path}/config_hwdb.yaml {workload_path}/config_build_recipes.yaml &> {workload}.log", pty=False).return_code
print(f" Printing last {log_tail_length} lines of log. See {workload}.log for full info.")
run(f"tail -n {log_tail_length} {workload}.log")
# This is a janky solution to the fact the manager does not
# return a non-zero exit code or some sort of result summary.
# The expectation here is that the PR author will manually
# check these output files for correctness until it can be
# done programmatically..
print(f"Printing last {log_tail_length} lines of all output files. See results-workload for more info.")
run(f"""cd deploy/results-workload/ && LAST_DIR=$(ls | tail -n1) && if [ -d "$LAST_DIR" ]; then tail -n{log_tail_length} $LAST_DIR/*/*; fi""")
run(f"firesim terminaterunfarm -q -c {workload_path}/config_runtime.yaml -a {workload_path}/config_hwdb.yaml -r {workload_path}/config_build_recipes.yaml")
if rc != 0:
print(f"Workload {workload} failed.")
sys.exit(rc)
else:
print(f"Workload {workload} successful.")
run_w_timeout(f"{ci_workdir}/.github/scripts/vitis-test", "linux-poweroff-singlenode", "30m")
if __name__ == "__main__":
execute(run_linux_poweroff_vitis, hosts=["localhost"])

View File

@ -0,0 +1,8 @@
vitis-test:
DESIGN: FireSim
TARGET_CONFIG: FireSimRocketConfig
PLATFORM_CONFIG: BaseVitisConfig
deploy_triplet: null
post_build_hook: null
metasim_customruntimeconfig: null
bit_builder_recipe: bit-builder-recipes/vitis.yaml

View File

@ -0,0 +1,4 @@
vitis-test:
xclbin: /scratch/buildbot/prebuilt-xclbins/firesim.xclbin
deploy_triplet_override: FireSim-FireSimRocketConfig-BaseVitisConfig
custom_runtime_config: null

View File

@ -0,0 +1,52 @@
run_farm:
base_recipe: run-farm-recipes/externally_provisioned.yaml
recipe_arg_overrides:
default_platform: VitisInstanceDeployManager
default_simulation_dir: /scratch/buildbot
run_farm_hosts_to_use:
- localhost: four_fpgas_spec
run_farm_host_specs:
- four_fpgas_spec:
num_fpgas: 4
num_metasims: 0
use_for_switch_only: false
metasimulation:
metasimulation_enabled: false
metasimulation_host_simulator: verilator
metasimulation_only_plusargs: "+fesvr-step-size=128 +dramsim +max-cycles=100000000"
metasimulation_only_vcs_plusargs: "+vcs+initreg+0 +vcs+initmem+0"
target_config:
topology: no_net_config
no_net_num_nodes: 1
link_latency: 6405
switching_latency: 10
net_bandwidth: 200
profile_interval: -1
default_hw_config: vitis-test
plusarg_passthrough: ""
tracing:
enable: no
output_format: 0
selector: 1
start: 0
end: -1
autocounter:
read_rate: 0
workload:
workload_name: outputs.json
terminate_on_completion: no
suffix_tag: null
host_debug:
zero_out_dram: no
disable_synth_asserts: no
synth_print:
start: 0
end: -1
cycle_prefix: yes

9
.github/scripts/vitis-test/run-workload.sh vendored Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
trap "exit" INT
set -e
set -o pipefail
firesim launchrunfarm -c $1 -a $2 -r $3
firesim infrasetup -c $1 -a $2 -r $3
firesim runworkload -c $1 -a $2 -r $3

View File

@ -222,6 +222,17 @@ jobs:
- name: Run linux-poweroff test w/ externally provisioned (AWS EC2) run farm
run: .github/scripts/run-linux-poweroff-externally-provisioned.py
run-basic-linux-poweroff-vitis:
if: contains(github.event.pull_request.labels.*.name, 'ci:fpga-deploy')
name: run-basic-linux-poweroff-vitis
runs-on: local-fpga
env:
TERM: xterm-256-color
steps:
- uses: actions/checkout@v2
- name: Run simple linux poweroff test w/ vitis
run: .github/scripts/run-linux-poweroff-vitis.py
documentation-check:
name: documentation-check
needs: change-filters

View File

@ -507,9 +507,9 @@ class VitisBitBuilder(BitBuilder):
results_build_dir = """{}/""".format(local_results_dir)
hwdb_entry = hwdb_entry_name + ":\n"
hwdb_entry += " xclbin: " + xclbin_path + "\n"
hwdb_entry += " deploy_triplet_override: null\n"
hwdb_entry += " custom_runtime_config: null\n"
hwdb_entry += " xclbin: " + xclbin_path + "\n"
hwdb_entry += f" deploy_triplet_override: {self.build_config.get_chisel_triplet()}\n"
hwdb_entry += " custom_runtime_config: null\n"
message_title = "FireSim FPGA Build Completed"
message_body = "Your bitstream has been created!\nAdd\n\n" + hwdb_entry + "\nto your config_hwdb.ini to use this hardware configuration."

View File

@ -342,7 +342,10 @@ class FireSimServerNode(FireSimNode):
run(f"sudo mount -o loop {img} {mnt}")
else:
run(f"""screen -S guestmount-wait -dm bash -c "guestmount --pid-file {tmp_dir}/guestmount.pid -a {img} -m /dev/sda {mnt}; while true; do sleep 1; done;" """, pty=False)
run(f"""while [ ! "$(ls -A {mnt})" ]; do echo "Waiting for mount to finish"; sleep 1; done""")
try:
run(f"""while [ ! "$(ls -A {mnt})" ]; do echo "Waiting for mount to finish"; sleep 1; done""", timeout=60*10)
except CommandTimeout:
umount(mnt, tmp_dir)
def umount(mnt: str, tmp_dir: str) -> None:
if has_sudo():

View File

@ -61,10 +61,3 @@ prj/ -- root of generated vivado project
This project can be re-opened interactively using
cd $BUILD/vivado/vpl/
vivado -source openprj.tcl
# For Abe
- I put one built bitstream under /scratch/biancolin/xclbins. You should be able to rebuild the default driver
by typing `make vitis` under sim/.
- Scripts to reflash FPGAs second stage shells and reset can be found under scripts/

View File

@ -279,7 +279,7 @@ set -o pipefail
expect \
dtc \
verilator==4.034 \
screen \
screen \
)
# python packages

View File

@ -26,8 +26,8 @@ TARGET_PROJECT ?= firesim
# that submodules firesim or source sim/Makefrag directly
TARGET_PROJECT_MAKEFRAG ?= $(firesim_base_dir)/src/main/makefrag/$(TARGET_PROJECT)/Makefrag
# The host-platform type (currently only f1 supported)
PLATFORM ?= vitis
# The host-platform type (currently only f1, vitis supported)
PLATFORM ?= f1
ifdef FIRESIM_STANDALONE

View File

@ -17,7 +17,7 @@ class AXI42NastiIdentityModule(params: AXI4BundleParameters)(implicit p: Paramet
AXI4NastiAssigner.toNasti(io.nasti, io.axi4)
}
class Nasti2AXI4IdentityModule(params: AXI4BundleParameters)(implicit p: Parameters)
class Nasti2AXI4IdentityModule(params: AXI4BundleParameters)(implicit p: Parameters)
extends RawModule with InlineInstance {
val io = IO(new Bundle {
val axi4 = new AXI4Bundle(params)
@ -38,7 +38,7 @@ class Nasti2AXI4Monitor(params: AXI4BundleParameters)(implicit p: Parameters)
/**
* THe Nasti -> AXI4 implies here that all methods of this object accept
* NastiIO as their primary argument. NB: the Nasti bundle may be mastered or be mastered
* NastiIO as their primary argument. NB: the Nasti bundle may be mastered or be mastered
* by the resulting AXI4.
*
*/
@ -47,7 +47,7 @@ object Nasti2AXI4 {
def toMonitor(nastiIO: NastiIO)(implicit p: Parameters): AXI4Bundle = {
val axi4Params = AXI4BundleParameters(nastiIO.ar.bits.addr.getWidth,
nastiIO.r.bits.data.getWidth,
nastiIO.ar.bits.id .getWidth)
nastiIO.ar.bits.id.getWidth)
val conv = Module(new Nasti2AXI4Monitor(axi4Params))
conv.io.nasti := nastiIO
conv.io.axi4
@ -56,7 +56,7 @@ object Nasti2AXI4 {
/**
* THe AXI4 -> Nasti implies here that all methods of this object accept
* AXI4 as their primary argument.
* AXI4 as their primary argument.
*
*/
object AXI42Nasti {

View File

@ -8,13 +8,12 @@ DESIGN ?= FireSim
# These guide chisel elaboration of the target design specified above.
# See src/main/scala/SimConfigs.scala
TARGET_CONFIG_PACKAGE ?= firesim.firesim
#TARGET_CONFIG ?= FireSimNoMemPortConfig
TARGET_CONFIG ?= FireSimRocketConfig
# These guide chisel elaboration of simulation components by MIDAS, including models and widgets.
# See src/main/scala/SimConfigs.scala
PLATFORM_CONFIG_PACKAGE ?= firesim.firesim
PLATFORM_CONFIG ?= BaseVitisConfig
PLATFORM_CONFIG ?= BaseF1Config
name_tuple := $(DESIGN)-$(TARGET_CONFIG)-$(PLATFORM_CONFIG)
GENERATED_DIR := $(firesim_base_dir)/generated-src/$(PLATFORM)/$(name_tuple)

View File

@ -197,8 +197,6 @@ $(vitis): export LDFLAGS := $(LDFLAGS) $(common_ld_flags) -Wl,-rpath='$$$$ORIGIN
$(vitis): $(header) $(DRIVER_CC) $(DRIVER_H) $(midas_cc) $(midas_h)
mkdir -p $(OUTPUT_DIR)/build
cp $(header) $(OUTPUT_DIR)/build/
# The manager expects to find the default conf in output/ by this name
cp -f $(GENERATED_DIR)/$(CONF_NAME) $(OUTPUT_DIR)/runtime.conf
$(MAKE) -C $(simif_dir) vitis PLATFORM=vitis DRIVER_NAME=$(DESIGN) GEN_FILE_BASENAME=$(BASE_FILE_NAME) \
GEN_DIR=$(OUTPUT_DIR)/build OUT_DIR=$(OUTPUT_DIR) DRIVER="$(DRIVER_CC)" \
TOP_DIR=$(chipyard_dir)