Add buildbitstream CI
This commit is contained in:
parent
0b692dc019
commit
5f01fc5ef0
|
@ -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'),
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
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
|
||||
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))]
|
||||
|
||||
sample_hwdb_postfix = "deploy/sample-backup-configs/sample_config_hwdb.ini"
|
||||
sample_hwdb_filename = f"{manager_fsim_dir}/{sample_hwdb_postfix}"
|
||||
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
|
||||
# print out the agfi line
|
||||
sample_hwdb_file.write(open(f"{hwdb_entry_dir}/{hwdb}").read().split("\n")[1] + '\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")
|
||||
|
||||
run(f"cat {sample_hwdb_filename}")
|
||||
|
||||
# share agfis
|
||||
sample_build_filename = f"{manager_fsim_dir}/deploy/sample-backup-configs/sample_config_build.ini"
|
||||
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")
|
||||
|
||||
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"])
|
|
@ -36,7 +36,7 @@ def run_linux_poweroff_vitis():
|
|||
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
|
||||
rc = run(f"timeout {timeout} {workload_path}/run-workload.sh {workload_path}/config_runtime.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")
|
||||
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
#!/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"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))]
|
||||
|
||||
# TODO: setup aws credentials
|
||||
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:
|
||||
print(f"Uploaded xclbin for {hwdb}")
|
||||
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_postfix = "deploy/sample-backup-configs/sample_config_hwdb.ini"
|
||||
sample_hwdb_filename = f"{manager_fsim_dir}/{sample_hwdb_postfix}"
|
||||
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
|
||||
# print out the xclbin line
|
||||
sample_hwdb_file.write(f" xclbin: {hwdb_to_link[hwdb]}" + '\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")
|
||||
|
||||
if __name__ == "__main__":
|
||||
execute(run_xclbin_buildbitstream, hosts=["localhost"])
|
|
@ -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,57 @@ 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.ini'
|
||||
commit-message: "Update AGFI(s)"
|
||||
branch-suffix: short-commit-hash
|
||||
title: "Update AGFI(s) for ${{ env.GITHUB_REF_NAME }}"
|
||||
|
||||
run-xclbin-buildbitstream:
|
||||
if: contains(github.event.pull_request.labels.*.name, 'ci:buildbitstream-deploy')
|
||||
name: run-xclbin-buildbitstream
|
||||
needs: [build-f1-driver] # delay until known working scala compile
|
||||
runs-on: aws-${{ github.run_id }}
|
||||
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: conda-incubator/setup-miniconda@v2
|
||||
with:
|
||||
environment-file: conda-reqs/ci-shared.yaml
|
||||
miniforge-version: latest
|
||||
- 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.ini'
|
||||
commit-message: "Update xclbin(s)"
|
||||
branch-suffix: short-commit-hash
|
||||
title: "Update xclbin(s) for ${{ env.GITHUB_REF_NAME }}"
|
||||
|
||||
documentation-check:
|
||||
name: documentation-check
|
||||
needs: change-filters
|
||||
|
|
|
@ -37,6 +37,9 @@ builds_to_run:
|
|||
# - firesim_rocket_singlecore_sha3_no_nic_l2_llc4mb_ddr3
|
||||
# - firesim_rocket_singlecore_sha3_no_nic_l2_llc4mb_ddr3_printf
|
||||
|
||||
# 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
|
||||
|
|
|
@ -201,3 +201,15 @@ firesim_rocket_singlecore_sha3_no_nic_l2_llc4mb_ddr3_printf:
|
|||
metasim_customruntimeconfig: null
|
||||
bit_builder_recipe: bit-builder-recipes/f1.yaml
|
||||
|
||||
# Vitis-only Config
|
||||
vitis_firesim_rocket_singlecore_no_nic:
|
||||
DESIGN: FireSim
|
||||
TARGET_CONFIG: FireSimRocketConfig
|
||||
PLATFORM_CONFIG: BaseVitisConfig
|
||||
deploy_triplet: null
|
||||
platform_config_args:
|
||||
fpga_frequency: 140
|
||||
build_strategy: TIMING
|
||||
post_build_hook: null
|
||||
metasim_customruntimeconfig: null
|
||||
bit_builder_recipe: bit-builder-recipes/vitis.yaml
|
||||
|
|
|
@ -15,19 +15,28 @@ firesim_boom_singlecore_nic_l2_llc4mb_ddr3:
|
|||
deploy_triplet_override: null
|
||||
custom_runtime_config: null
|
||||
# DOCREF END: Example HWDB Entry
|
||||
|
||||
firesim_boom_singlecore_no_nic_l2_llc4mb_ddr3:
|
||||
agfi: agfi-0b155e871724da4ec
|
||||
deploy_triplet_override: null
|
||||
custom_runtime_config: null
|
||||
|
||||
firesim_rocket_quadcore_nic_l2_llc4mb_ddr3:
|
||||
agfi: agfi-05f131d5c193fb6eb
|
||||
deploy_triplet_override: null
|
||||
custom_runtime_config: null
|
||||
|
||||
firesim_rocket_quadcore_no_nic_l2_llc4mb_ddr3:
|
||||
agfi: agfi-0907c26232a024151
|
||||
deploy_triplet_override: null
|
||||
custom_runtime_config: null
|
||||
|
||||
firesim_supernode_rocket_singlecore_nic_l2_lbp:
|
||||
agfi: agfi-07711bd02627fe114
|
||||
deploy_triplet_override: null
|
||||
custom_runtime_config: null
|
||||
|
||||
vitis_firesim_rocket_singlecore_no_nic:
|
||||
xclbin: https://firesim-ci-vitis-xclbins.s3.us-west-2.amazonaws.com/firesim_rocket_singlecore_no_nic_d148b73.xclbin
|
||||
deploy_triplet_override: FireSim-FireSimRocketConfig-BaseVitisConfig
|
||||
custom_runtime_config: null
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
vitis_test:
|
||||
DESIGN: FireSim
|
||||
TARGET_CONFIG: FireSimRocketConfig
|
||||
PLATFORM_CONFIG: BaseVitisConfig
|
||||
deploy_triplet: null
|
||||
platform_config_args:
|
||||
fpga_frequency: 140
|
||||
build_strategy: TIMING
|
||||
post_build_hook: null
|
||||
metasim_customruntimeconfig: null
|
||||
bit_builder_recipe: bit-builder-recipes/vitis.yaml
|
|
@ -1,4 +0,0 @@
|
|||
vitis_test:
|
||||
xclbin: https://firesim-ci-vitis-xclbins.s3.us-west-2.amazonaws.com/firesim_rocket_singlecore_no_nic_d148b73.xclbin
|
||||
deploy_triplet_override: FireSim-FireSimRocketConfig-BaseVitisConfig
|
||||
custom_runtime_config: null
|
|
@ -4,6 +4,6 @@ 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
|
||||
firesim launchrunfarm -c $1
|
||||
firesim infrasetup -c $1
|
||||
firesim runworkload -c $1
|
||||
|
|
Loading…
Reference in New Issue