Merge remote-tracking branch 'origin/main' into fix-trigger-system-common-case-perf

This commit is contained in:
Sagar Karandikar 2023-05-11 09:48:35 -07:00
commit da63aae5de
15 changed files with 302 additions and 24 deletions

View File

@ -1,4 +1,4 @@
<!--
<!--
First, please ensure that the title of your PR is sufficient to include in the next changelog.
Refer to https://github.com/firesim/firesim/releases for examples and feel free to ask reviewers for help.
@ -21,7 +21,7 @@ Provide a brief description of the PR immediately below this comment, if the tit
#### UI / API Impact
<!-- Roughly, how would this affect the current API or user-facing interfaces? (extend, deprecate, remove, or break) -->
<!-- Of note: manager config.ini interface, targetutils & bridge scala API, platform config behavior -->
<!-- Of note: manager config_*.yaml interface, targetutils & bridge scala API, platform config behavior -->
#### Verilog / AGFI Compatibility

View File

@ -47,6 +47,7 @@ class CIEnvironment(TypedDict):
AWS_ACCESS_KEY_ID: str
AWS_SECRET_ACCESS_KEY: str
AWS_DEFAULT_REGION: str
AWS_BUCKET_NAME: str
AZURE_CLIENT_ID: str
AZURE_CLIENT_SECRET: str
AZURE_TENANT_ID: str
@ -84,6 +85,7 @@ ci_env: CIEnvironment = {
'AWS_ACCESS_KEY_ID': get_ci_value('AWS_ACCESS_KEY_ID'),
'AWS_SECRET_ACCESS_KEY': get_ci_value('AWS_SECRET_ACCESS_KEY'),
'AWS_DEFAULT_REGION': get_ci_value('AWS_DEFAULT_REGION'),
'AWS_BUCKET_NAME': get_ci_value('AWS_BUCKET_NAME'),
'AZURE_CLIENT_ID': get_ci_value('AZURE_CLIENT_ID'),
'AZURE_CLIENT_SECRET': get_ci_value('AZURE_CLIENT_SECRET'),
'AZURE_TENANT_ID': get_ci_value('AZURE_TENANT_ID'),

83
.github/scripts/run-agfi-buildbitstream.py vendored Executable file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env python3
import sys
import os
from pathlib import Path
from fabric.api import prefix, settings, run, execute # type: ignore
from common import manager_fsim_dir, set_fabric_firesim_pem
from ci_variables import ci_env
def run_agfi_buildbitstream():
""" Runs AGFI buildbitstream"""
with prefix(f'cd {manager_fsim_dir} && source sourceme-f1-manager.sh'):
rc = 0
# unique tag based on the ci workflow and filename is needed to ensure
# run farm is unique to each linux-poweroff test
with prefix(f"export FIRESIM_BUILDFARM_PREFIX={ci_env['GITHUB_RUN_ID']}-{Path(__file__).stem}"):
with settings(warn_only=True):
# pty=False needed to avoid issues with screen -ls stalling in fabric
rc = run("timeout 10h firesim buildbitstream --forceterminate", pty=False).return_code
if rc != 0:
print("Buildbitstream failed")
sys.exit(rc)
else:
# parse the output yamls, replace the sample hwdb's agfi line only
sample_hwdb_filename = f"{manager_fsim_dir}/deploy/sample-backup-configs/sample_config_hwdb.yaml"
hwdb_entry_dir = f"{manager_fsim_dir}/deploy/built-hwdb-entries"
built_hwdb_entries = [x for x in os.listdir(hwdb_entry_dir) if os.path.isfile(os.path.join(hwdb_entry_dir, x))]
for hwdb in built_hwdb_entries:
sample_hwdb_lines = open(sample_hwdb_filename).read().split('\n')
with open(sample_hwdb_filename, "w") as sample_hwdb_file:
match_agfi = False
for line in sample_hwdb_lines:
if hwdb in line.strip().split(' ')[0].replace(':', ''):
# hwdb entry matches key name
match_agfi = True
sample_hwdb_file.write(line + '\n')
elif match_agfi == True and ("agfi:" in line.strip().split(' ')[0]):
# only replace this agfi
match_agfi = False
new_agfi_line = open(f"{hwdb_entry_dir}/{hwdb}").read().split("\n")[1]
print(f"Replacing {line.strip()} with {new_agfi_line}")
# print out the agfi line
sample_hwdb_file.write(new_agfi_line + '\n')
else:
# if no match print other lines
sample_hwdb_file.write(line + '\n')
if match_agfi == True:
sys.exit("::ERROR:: Unable to find matching AGFI key for HWDB entry")
print(f"Printing {sample_hwdb_filename}...")
run(f"cat {sample_hwdb_filename}")
# share agfis
sample_build_filename = f"{manager_fsim_dir}/deploy/sample-backup-configs/sample_config_build.yaml"
sample_build_lines = open(sample_build_filename).read().split('\n')
with open(sample_build_filename, "w") as sample_build_file:
for line in sample_build_lines:
if "somebodysname:" in line:
sample_build_file.write("#" + line + "\n")
elif "public:" in line:
# get rid of the comment
sample_build_file.write(line.replace('#', '') + "\n")
else:
sample_build_file.write(line + "\n")
print(f"Printing {sample_build_filename}...")
run(f"cat {sample_build_filename}")
run(f"firesim shareagfi -a {sample_hwdb_filename} -b {sample_build_filename}")
if __name__ == "__main__":
set_fabric_firesim_pem()
execute(run_agfi_buildbitstream, hosts=["localhost"])

126
.github/scripts/run-xclbin-buildbitstream.py vendored Executable file
View File

@ -0,0 +1,126 @@
#!/usr/bin/env python3
import sys
from pathlib import Path
from fabric.api import prefix, run, settings, execute # type: ignore
import os
from botocore.exceptions import ClientError
import boto3
from ci_variables import ci_env
# taken from: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-uploading-files.html
def upload_file(file_name, bucket, object_name=None):
"""Upload a file to an S3 bucket
:param file_name: File to upload
:param bucket: Bucket to upload to
:param object_name: S3 object name. If not specified then file_name is used
:return: True if file was uploaded, else False
"""
# If S3 object_name was not specified, use file_name
if object_name is None:
object_name = os.path.basename(file_name)
# Upload the file
s3_client = boto3.client('s3')
try:
response = s3_client.upload_file(file_name, bucket, object_name)
except ClientError as e:
print(e)
return False
return True
def run_xclbin_buildbitstream():
""" Runs Xclbin buildbitstream"""
# assumptions:
# - machine-launch-script requirements are already installed
# - XILINX_VITIS, XILINX_XRT, XILINX_VIVADO are setup (in env / LD_LIBRARY_PATH / path / etc)
# repo should already be checked out
manager_fsim_dir = ci_env['GITHUB_WORKSPACE']
with prefix(f"cd {manager_fsim_dir}"):
run("./build-setup.sh --skip-validate")
with prefix('source sourceme-f1-manager.sh --skip-ssh-setup'):
# modify config_build.yaml
build_yaml = f"{manager_fsim_dir}/deploy/config_build.yaml"
build_yaml_lines = open(build_yaml).read().split("\n")
with open(build_yaml, "w") as byf:
for line in build_yaml_lines:
if "- firesim" in line:
# comment out AWS specific lines
byf.write("# " + line + '\n')
elif "- vitis_firesim" in line:
# remove comment on vitis line
byf.write(line.replace("# ", '') + '\n')
else:
byf.write(line + '\n')
run(f"Printing {build_yaml}...")
run(f"cat {build_yaml}")
rc = 0
with settings(warn_only=True):
# pty=False needed to avoid issues with screen -ls stalling in fabric
rc = run("timeout 10h firesim buildbitstream --forceterminate", pty=False).return_code
if rc != 0:
print("Buildbitstream failed")
sys.exit(rc)
else:
hwdb_entry_dir = f"{manager_fsim_dir}/deploy/built-hwdb-entries"
built_hwdb_entries = [x for x in os.listdir(hwdb_entry_dir) if os.path.isfile(os.path.join(hwdb_entry_dir, x))]
hwdb_to_link = {}
for hwdb in built_hwdb_entries:
with open(f"{hwdb_entry_dir}/{hwdb}") as hwdbef:
lines = hwdbef.readlines()
for line in lines:
if "xclbin:" in line:
file_path = Path(line.strip().split(' ')[1]) # 2nd element
file_name = f"{hwdb}_{ci_env['GITHUB_SHA'][0:6]}.xclbin"
if not upload_file(file_path, ci_env['AWS_BUCKET_NAME'], file_name):
print(f"Unable to upload the xclbin for {hwdb}")
else:
link = f"https://{ci_env['AWS_BUCKET_NAME']}.s3.{ci_env['AWS_DEFAULT_REGION']}.amazonaws.com/{file_name}"
print(f"Uploaded xclbin for {hwdb} to {link}")
hwdb_to_link[hwdb] = f"https://{ci_env['AWS_BUCKET_NAME']}.s3.{ci_env['AWS_DEFAULT_REGION']}.amazonaws.com/{file_name}"
# parse the output yamls, replace the sample hwdb's xclbin line only
sample_hwdb_filename = f"{manager_fsim_dir}/deploy/sample-backup-configs/sample_config_hwdb.yaml"
for hwdb in built_hwdb_entries:
sample_hwdb_lines = open(sample_hwdb_filename).read().split('\n')
with open(sample_hwdb_filename, "w") as sample_hwdb_file:
match_xclbin = False
for line in sample_hwdb_lines:
if hwdb in line.strip().split(' ')[0].replace(':', ''):
# hwdb entry matches key name
match_xclbin = True
sample_hwdb_file.write(line + '\n')
elif match_xclbin == True and ("xclbin:" in line.strip().split(' ')[0]):
# only replace this xclbin
match_xclbin = False
new_xclbin_line = f" xclbin: {hwdb_to_link[hwdb]}"
print(f"Replacing {line.strip()} with {new_xclbin_line}")
# print out the xclbin line
sample_hwdb_file.write(new_xclbin_line + '\n')
else:
# if no match print other lines
sample_hwdb_file.write(line + '\n')
if match_xclbin == True:
sys.exit("::ERROR:: Unable to find matching xclbin key for HWDB entry")
print(f"Printing {sample_hwdb_filename}...")
run(f"cat {sample_hwdb_filename}")
if __name__ == "__main__":
execute(run_xclbin_buildbitstream, hosts=["localhost"])

View File

@ -13,6 +13,7 @@ env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_BUCKET_NAME: firesim-ci-vitis-xclbins
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
@ -380,6 +381,53 @@ jobs:
- name: Run simple linux poweroff test w/ vitis
run: .github/scripts/run-linux-poweroff-vitis.py
run-agfi-buildbitstream:
if: contains(github.event.pull_request.labels.*.name, 'ci:buildbitstream-deploy')
name: run-agfi-buildbitstream
needs: [build-f1-driver] # delay until known working scala compile
runs-on: aws-${{ github.run_id }}
env:
TERM: xterm-256-color
steps:
- uses: actions/checkout@v3
- name: Run buildbitstream command and update sample AGFIs
run: .github/scripts/run-agfi-buildbitstream.py
- uses: peter-evans/create-pull-request@v4
with:
# must align with `manager_fsim_dir/MANAGER_FIRESIM_LOCATION`
cwd: '/home/centos/firesim'
add-paths: |
'deploy/sample-backup-configs/sample_config_hwdb.yaml'
commit-message: "Update AGFI(s)"
branch-suffix: short-commit-hash
title: "Update AGFI(s) for ${{ env.GITHUB_REF_NAME }}"
# TODO: Re-enable and just post bitstreams into a GH repo
#run-xclbin-buildbitstream:
# if: contains(github.event.pull_request.labels.*.name, 'ci:buildbitstream-deploy')
# name: run-xclbin-buildbitstream
# runs-on: local-fpga
# env:
# TERM: xterm-256-color
# steps:
# # This forces a fresh clone of the repo during the `checkout` step
# # to resolve stale submodule URLs. See https://github.com/ucb-bar/chipyard/pull/1156.
# - name: Delete old checkout
# run: |
# rm -rf ${{ github.workspace }}/* || true
# rm -rf ${{ github.workspace }}/.* || true
# - uses: actions/checkout@v3
# - uses: ./.github/actions/repo-setup-aws
# - name: Run buildbitstream command and update sample xclbins
# run: .github/scripts/run-xclbin-buildbitstream.py
# - uses: peter-evans/create-pull-request@v4
# with:
# add-paths: |
# 'deploy/sample-backup-configs/sample_config_hwdb.yaml'
# commit-message: "Update xclbin(s)"
# branch-suffix: short-commit-hash
# title: "Update xclbin(s) for ${{ env.GITHUB_REF_NAME }}"
run-vitis-check-docs-generated-components:
name: run-vitis-check-docs-generated-components
runs-on: local-fpga

View File

@ -235,7 +235,7 @@ class F1BitBuilder(BitBuilder):
# 'cl_dir' holds the eventual directory in which vivado will run.
cl_dir = self.cl_dir_setup(self.build_config.get_chisel_quintuplet(), build_farm.get_build_host(self.build_config).dest_build_dir)
vivado_result = 0
vivado_rc = 0
# copy script to the cl_dir and execute
rsync_cap = rsync_project(
@ -251,7 +251,13 @@ class F1BitBuilder(BitBuilder):
build_strategy = self.build_config.get_strategy().name
with InfoStreamLogger('stdout'), settings(warn_only=True):
vivado_result = run(f"{cl_dir}/build-bitstream.sh --cl_dir {cl_dir} --frequency {fpga_frequency} --strategy {build_strategy}").return_code
vivado_result = run(f"{cl_dir}/build-bitstream.sh --cl_dir {cl_dir} --frequency {fpga_frequency} --strategy {build_strategy}")
vivado_rc = vivado_result.return_code
if vivado_result != 0:
rootLogger.info("Printing error output:")
for line in vivado_result.splitlines()[-100:]:
rootLogger.info(line)
# put build results in the result-build area
@ -263,7 +269,7 @@ class F1BitBuilder(BitBuilder):
rootLogger.debug(rsync_cap)
rootLogger.debug(rsync_cap.stderr)
if vivado_result != 0:
if vivado_rc != 0:
on_build_failure()
return False
@ -459,7 +465,7 @@ class VitisBitBuilder(BitBuilder):
# 'cl_dir' holds the eventual directory in which vivado will run.
cl_dir = self.cl_dir_setup(self.build_config.get_chisel_quintuplet(), build_farm.get_build_host(self.build_config).dest_build_dir)
vitis_result = 0
vitis_rc = 0
# copy script to the cl_dir and execute
rsync_cap = rsync_project(
local_dir=f"{local_deploy_dir}/../platforms/vitis/build-bitstream.sh",
@ -473,7 +479,13 @@ class VitisBitBuilder(BitBuilder):
build_strategy = self.build_config.get_strategy().name
with InfoStreamLogger('stdout'), settings(warn_only=True):
vitis_result = run(f"{cl_dir}/build-bitstream.sh --build_dir {cl_dir} --device {self.device} --frequency {fpga_frequency} --strategy {build_strategy}").return_code
vitis_result = run(f"{cl_dir}/build-bitstream.sh --build_dir {cl_dir} --device {self.device} --frequency {fpga_frequency} --strategy {build_strategy}")
vitis_rc = vitis_result.return_code
if vitis_rc != 0:
rootLogger.info("Printing error output:")
for line in vitis_result.splitlines()[-100:]:
rootLogger.info(line)
# put build results in the result-build area
@ -485,7 +497,7 @@ class VitisBitBuilder(BitBuilder):
rootLogger.debug(rsync_cap)
rootLogger.debug(rsync_cap.stderr)
if vitis_result != 0:
if vitis_rc != 0:
on_build_failure()
return False
@ -612,7 +624,7 @@ class XilinxAlveoBitBuilder(BitBuilder):
# 'cl_dir' holds the eventual directory in which vivado will run.
cl_dir = self.cl_dir_setup(self.build_config.get_chisel_quintuplet(), build_farm.get_build_host(self.build_config).dest_build_dir)
alveo_result = 0
alveo_rc = 0
# copy script to the cl_dir and execute
rsync_cap = rsync_project(
local_dir=f"{local_deploy_dir}/../platforms/{self.build_config.PLATFORM}/build-bitstream.sh",
@ -626,7 +638,13 @@ class XilinxAlveoBitBuilder(BitBuilder):
build_strategy = self.build_config.get_strategy().name
with InfoStreamLogger('stdout'), settings(warn_only=True):
alveo_result = run(f"{cl_dir}/build-bitstream.sh --cl_dir {cl_dir} --frequency {fpga_frequency} --strategy {build_strategy} --board {self.BOARD_NAME}").return_code
alveo_result = run(f"{cl_dir}/build-bitstream.sh --cl_dir {cl_dir} --frequency {fpga_frequency} --strategy {build_strategy} --board {self.BOARD_NAME}")
alveo_rc = alveo_result.return_code
if alveo_rc != 0:
rootLogger.info("Printing error output:")
for line in alveo_result.splitlines()[-100:]:
rootLogger.info(line)
# put build results in the result-build area
@ -638,7 +656,7 @@ class XilinxAlveoBitBuilder(BitBuilder):
rootLogger.debug(rsync_cap)
rootLogger.debug(rsync_cap.stderr)
if alveo_result != 0:
if alveo_rc != 0:
on_build_failure()
return False

View File

@ -47,6 +47,9 @@ builds_to_run:
# - alveo_u250_firesim_rocket_singlecore_no_nic
# - alveo_u280_firesim_rocket_singlecore_no_nic
# Configs for vitis
# - vitis_firesim_rocket_singlecore_no_nic
agfis_to_share:
- firesim_rocket_quadcore_nic_l2_llc4mb_ddr3
- firesim_rocket_quadcore_no_nic_l2_llc4mb_ddr3

View File

@ -82,7 +82,7 @@ This configures the manager to run Verilator-hosted metasimulations (without
waveform generation) for the target specified in ``config_runtime.yaml``. When
in metasimulation mode, the ``default_hw_config`` that you specify in
``target_config`` references an entry in ``config_build_recipes.yaml`` instead
of an entry in ``config_hwdb.ini``.
of an entry in ``config_hwdb.yaml``.
As is the case when the manager runs FPGA-accelerated simulations, the number
of metasimulations that are run is determined by the parameters in the

View File

@ -25,7 +25,7 @@ To view a list of AGFI's that you have built and what you have access to, you ca
source sourceme-f1-manager.sh
aws ec2 describe-fpga-images --fpga-image-ids # List all AGFI images
You can also view a specific AGFI image by giving the AGFI ID (found in ``deploy/config_hwdb.ini``) through the following command:
You can also view a specific AGFI image by giving the AGFI ID (found in ``deploy/config_hwdb.yaml``) through the following command:
.. code-block:: bash

View File

@ -11,8 +11,6 @@ instances of ``br-base.json`` with ``fedora-base.json``).
To boot Fedora on FireSim, we provide a pre-written FireSim workload JSON
:gh-file-ref:`deploy/workloads/fedora-uniform.json`, that points to the generated
Fedora images. Simply change the ``workload_name`` option in your
``config_runtime.ini`` to ``fedora-uniform.json`` and then follow the standard
``config_runtime.yaml`` to ``fedora-uniform.json`` and then follow the standard
FireSim procedure for booting a workload (e.g. :ref:`single-node-sim` or
:ref:`cluster-sim`).

View File

@ -193,7 +193,7 @@ field to a job and supply a path relative to the workload's directory.
Once you specify the ``.json`` for this workload (and assuming you have built
the corresponding rootfses with :ref:`firemarshal`, you can run it with the
manager by setting ``workload_name: ping-latency.json`` in ``config_runtime.ini``.
manager by setting ``workload_name: ping-latency.json`` in ``config_runtime.yaml``.
The manager will automatically look for the generated rootfses (based on
workload and job names that it reads from the JSON) and distribute work
appropriately.

View File

@ -203,7 +203,7 @@ You'll notice a Makefile in the ``workloads/`` directory -- it contains many
similar commands for all of the workloads included with FireSim.
Once you generate the rootfses for this workload, you can run it with the manager
by setting ``workload_name: ping-latency.json`` in ``config_runtime.ini``. The manager
by setting ``workload_name: ping-latency.json`` in ``config_runtime.yaml``. The manager
will automatically look for the generated rootfses (based on workload and job names
that it reads from the json) and distribute work appropriately.

View File

@ -34,11 +34,11 @@ with your own bucket name, e.g.:
Build Recipes
---------------
In the ``deploy/config_build.ini`` file, you will notice that the ``builds_to_run``
In the ``deploy/config_build.yaml`` file, you will notice that the ``builds_to_run``
section currently contains several lines, which
indicates to the build system that you want to run all of these builds in
parallel, with the parameters listed in the relevant section of the
``deploy/config_build_recipes.ini`` file. Here you can set parameters of the simulated
``deploy/config_build_recipes.yaml`` file. Here you can set parameters of the simulated
system, and also select the type of instance on which the Vivado build will be
deployed. From our experimentation, there are diminishing returns using
anything above a ``z1d.2xlarge``, so we default to that. If you do wish to use a
@ -48,13 +48,13 @@ of 32 GiB for large designs.
To start out, let's build a simple design, ``firesim_rocket_quadcore_no_nic_l2_llc4mb_ddr3``.
This is a design that has four cores, no nic, and uses the 4MB LLC + DDR3 memory model.
To do so, comment out all of the other build entries in ``deploy/config_build.ini``, besides the one we want. So, you should
To do so, comment out all of the other build entries in ``deploy/config_build.yaml``, besides the one we want. So, you should
end up with something like this (a line beginning with a ``#`` is a comment):
.. code-block:: yaml
builds_to_run:
# this section references builds defined in config_build_recipes.ini
# this section references builds defined in config_build_recipes.yaml
# if you add a build here, it will be built when you run buildbitstream
- firesim_rocket_quadcore_no_nic_l2_llc4mb_ddr3

@ -1 +1 @@
Subproject commit 195e39d74cea546a886d2d9baf252ed77b674329
Subproject commit 37832cdbc5d0b8f7f53dce6830ab887cb0bc6023

View File

@ -114,7 +114,7 @@ tracerv_t::tracerv_t(simif_t &sim,
}
write_header(tracefile);
// This must be kept consistent with config_runtime.ini's output_format.
// This must be kept consistent with config_runtime.yaml's output_format.
// That file's comments are the single source of truth for this.
if (outputfmtselect == 0) {
this->human_readable = true;