Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
459 changes: 356 additions & 103 deletions .github/workflows/xdp-xrt-build.yml

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions ci/csr/config.defaults.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Defaults for XDP VE2 CSR board testing on XCO.
# Override any value via environment before calling the ci/csr scripts.

: "${CSR_ROOT:=/wrk/csr/snigupta/xdp_ci}"
: "${CSR_SPEC:=/proj/testcases/xtc/HEAD/auto/ymls/config/VAI_6_3_GEN2_REGRESSION.yml}"
: "${CSR_DAY:=sunday}"
: "${CSR_SUITE:=VE2_XDP}"
: "${CSR_TESTMODE:=hw}"
: "${CSR_TQL_REPO:=/proj/testcases/xtc/HEAD/auto/tql/vaiml/}"
: "${CSR_TA:=/proj/xbuilds/HEAD_INT_flexml_verified_vitis/installs}"
: "${CSR_CREATE_SPRITE_RUN:=/proj/testcases/xtc/HEAD/auto/scripts/createSpriteRun/createSpriteRun.sh}"

# VE2_XDP is commented out in VAI_6_2 runs.yml; it is active under eachday in 6.3.
: "${CSR_SUPER_SUITE:=VAI_6_3_GEN2_REGRESSION}"

: "${VE2_RPM_DEPLOY_SUBDIR:=cortexa72_cortexa53}"
: "${VE2_RPM_GLOB:=xrt*.rpm}"
: "${VE2_DNF_PACKAGES:=xrt-20261*.rpm xrt-dbg*.rpm xrt-src*.rpm}"

: "${JENKINS_URL:=http://acasops:8080}"
: "${JENKINS_JOB:=csr_submit_job}"
: "${JENKINS_BOARD_SELECT:=VE2}"
: "${JENKINS_COMPILE_JOBS_ONLY:=False}"
: "${JENKINS_LNX_TA:=DEFAULT}"

: "${CSR_WAIT_TIMEOUT_SEC:=14400}"
: "${XDP_CSR_SUBMIT_MODE:=local}"

# Trial phase: run one XDP design instead of the full VE2_XDP suite (~15 tests).
# Set empty to run all tests in the merged TQL.
: "${XDP_CSR_SINGLE_TEST:=ResNet18_MLTimeline}"

# Local RDI trial: native FlexML compile avoids docker.sock on farm hosts.
# Set to 1 for production docker compile (suite default).
: "${XDP_CSR_USE_DOCKER:=0}"
74 changes: 74 additions & 0 deletions ci/csr/generate_csr_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash
# Generate CSR sprite files for a VE2_XDP hw run.
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=config.defaults.sh
source "${SCRIPT_DIR}/config.defaults.sh"

usage() {
cat <<'EOF'
Usage: generate_csr_run.sh --sprite-dir DIR

Creates CSR merged TQL and launch scripts under --sprite-dir.
EOF
}

SPRITE_DIR=""

while [ "$#" -gt 0 ]; do
case "$1" in
--sprite-dir)
SPRITE_DIR="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done

if [ -z "${SPRITE_DIR}" ]; then
echo "Missing required --sprite-dir" >&2
usage >&2
exit 1
fi

mkdir -p "${SPRITE_DIR}/results"
chmod a+w "${SPRITE_DIR}" "${SPRITE_DIR}/results"
chmod a+w "$(dirname "${SPRITE_DIR}")" 2>/dev/null || true

# createSpriteRunLaunch sets up RDI/XTC. Do not source g_profile here: under bash
# nounset it fails when LD_LIBRARY_PATH is unset (common in GHA runner env).
umask 022

cd "${SPRITE_DIR}"

"${CSR_CREATE_SPRITE_RUN}" \
--day "${CSR_DAY}" \
--spec "${CSR_SPEC}" \
--results "${SPRITE_DIR}/results" \
--flexml \
--tql-repo "${CSR_TQL_REPO}" \
--xtc-no-lut \
--testsuites "${CSR_SUITE}" \
--testmode "${CSR_TESTMODE}" \
--ta "${CSR_TA}"

RDI_SCRIPT="${SPRITE_DIR}/${CSR_SUPER_SUITE}_${CSR_DAY}_rdi.sh"
if [ ! -s "${RDI_SCRIPT}" ]; then
echo "CSR generation did not produce a non-empty RDI script: ${RDI_SCRIPT}" >&2
ls -la "${SPRITE_DIR}" >&2 || true
exit 1
fi

chmod -R a+w "${SPRITE_DIR}" 2>/dev/null || true
echo "Generated CSR run in ${SPRITE_DIR}"
ls -1 "${SPRITE_DIR}"/*"${CSR_SUITE}"*.tql
echo "Launch script: ${RDI_SCRIPT}"
97 changes: 97 additions & 0 deletions ci/csr/limit_merged_tql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash
# Limit merged CSR TQL to a single testcase directory (trial/smoke runs).
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=config.defaults.sh
source "${SCRIPT_DIR}/config.defaults.sh"

usage() {
cat <<'EOF'
Usage: limit_merged_tql.sh --sprite-dir DIR [--test NAME]

Environment:
XDP_CSR_SINGLE_TEST Test subdirectory name under XDP_Suites/test_repo
(default: ResNet18_MLTimeline). Set empty to run all tests.
EOF
}

SPRITE_DIR=""
SINGLE_TEST="${XDP_CSR_SINGLE_TEST:-ResNet18_MLTimeline}"

while [ "$#" -gt 0 ]; do
case "$1" in
--sprite-dir)
SPRITE_DIR="$2"
shift 2
;;
--test)
SINGLE_TEST="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done

if [ -z "${SPRITE_DIR}" ]; then
echo "Missing required --sprite-dir" >&2
exit 1
fi

if [ -z "${SINGLE_TEST}" ]; then
echo "XDP_CSR_SINGLE_TEST unset; running full suite TQL unchanged"
exit 0
fi

shopt -s nullglob
TQL_FILES=( "${SPRITE_DIR}"/*"${CSR_SUITE}"*.tql )
shopt -u nullglob

if [ "${#TQL_FILES[@]}" -eq 0 ]; then
echo "No merged TQL for suite ${CSR_SUITE} under ${SPRITE_DIR}" >&2
exit 1
fi

TQL_FILE="${TQL_FILES[0]}"

python3 - <<'PY' "${TQL_FILE}" "${SINGLE_TEST}"
import re
import sys

tql_path, single_test = sys.argv[1:3]
text = open(tql_path, encoding="utf-8").read()

# Split trailing GLOBAL APPLY blocks (e.g. XRT RPM patch) from query blocks.
global_idx = text.find("\nGLOBAL APPLY")
if global_idx == -1:
body, tail = text, ""
else:
body, tail = text[:global_idx], text[global_idx:]

# Each testcase query starts at a line beginning with FROM.
parts = re.split(r"(?m)^(?=FROM )", body)
header = parts[0] if parts and not parts[0].lstrip().startswith("FROM ") else ""
queries = [p for p in parts if p.lstrip().startswith("FROM ")]

kept = [q for q in queries if single_test in q.splitlines()[0]]
if not kept:
available = [q.splitlines()[0].strip() for q in queries]
raise SystemExit(
f"No FROM block matches test '{single_test}'.\n"
f"Available FROM lines:\n " + "\n ".join(available)
)

new_body = header + "".join(kept)
open(tql_path, "w", encoding="utf-8").write(new_body + tail)
print(f"Limited {tql_path} to 1 test: {single_test}")
print(f" kept FROM: {kept[0].splitlines()[0].strip()}")
print(f" removed {len(queries) - len(kept)} other FROM block(s)")
PY
87 changes: 87 additions & 0 deletions ci/csr/patch_merged_tql.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/bash
# Patch CSR merged TQL to copy custom XRT RPMs and install them on the board.
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=config.defaults.sh
source "${SCRIPT_DIR}/config.defaults.sh"

usage() {
cat <<'EOF'
Usage: patch_merged_tql.sh --sprite-dir DIR --rpm-dir DIR [--suite SUITE]

Appends a GLOBAL APPLY block to the merged VE2_XDP TQL in the sprite directory.
EOF
}

SPRITE_DIR=""
RPM_DIR=""
SUITE="${CSR_SUITE}"

while [ "$#" -gt 0 ]; do
case "$1" in
--sprite-dir)
SPRITE_DIR="$2"
shift 2
;;
--rpm-dir)
RPM_DIR="$2"
shift 2
;;
--suite)
SUITE="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done

if [ -z "${SPRITE_DIR}" ] || [ -z "${RPM_DIR}" ]; then
echo "Missing required --sprite-dir and/or --rpm-dir" >&2
usage >&2
exit 1
fi

if [ ! -d "${RPM_DIR}" ] || [ -z "$(find "${RPM_DIR}" -maxdepth 1 -name '*.rpm' -print -quit)" ]; then
echo "RPM directory is empty or missing: ${RPM_DIR}" >&2
exit 1
fi

shopt -s nullglob
TQL_FILES=( "${SPRITE_DIR}"/*"${SUITE}"*.tql )
shopt -u nullglob

if [ "${#TQL_FILES[@]}" -eq 0 ]; then
echo "No merged TQL matching suite ${SUITE} under ${SPRITE_DIR}" >&2
ls -la "${SPRITE_DIR}" >&2 || true
exit 1
fi

TQL_FILE="${TQL_FILES[0]}"
RPM_BASENAME="$(basename "${RPM_DIR}")"
MARKER="# XDP CI: install custom XRT RPMs on Telluride before board run"

if grep -qF "${MARKER}" "${TQL_FILE}"; then
echo "TQL already patched: ${TQL_FILE}"
exit 0
fi

cat >> "${TQL_FILE}" <<EOF

${MARKER}
GLOBAL APPLY * MODIFY
copy += ['${RPM_DIR}'],
tasks.board.pre_exec = 'cd ${RPM_BASENAME} && dnf --disablerepo="*" -y install ${VE2_DNF_PACKAGES}';
EOF

echo "Patched ${TQL_FILE}"
echo " copy += ['${RPM_DIR}']"
echo " tasks.board.pre_exec = cd ${RPM_BASENAME} && dnf ... ${VE2_DNF_PACKAGES}"
83 changes: 83 additions & 0 deletions ci/csr/patch_merged_tql_no_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash
# Patch merged TQL to compile vaiml natively (no Docker) for local RDI trial runs.
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=config.defaults.sh
source "${SCRIPT_DIR}/config.defaults.sh"

usage() {
cat <<'EOF'
Usage: patch_merged_tql_no_docker.sh --sprite-dir DIR [--suite SUITE]

Appends a GLOBAL APPLY block that sets user.use_docker = 0 and drops the
(vai_docker) constraint from tasks.vaiml.select_resource.

Set XDP_CSR_USE_DOCKER=1 to skip this patch (production docker compile path).
EOF
}

SPRITE_DIR=""
SUITE="${CSR_SUITE}"

while [ "$#" -gt 0 ]; do
case "$1" in
--sprite-dir)
SPRITE_DIR="$2"
shift 2
;;
--suite)
SUITE="$2"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done

if [ -z "${SPRITE_DIR}" ]; then
echo "Missing required --sprite-dir" >&2
usage >&2
exit 1
fi

if [ "${XDP_CSR_USE_DOCKER:-0}" = "1" ]; then
echo "XDP_CSR_USE_DOCKER=1; keeping suite default docker compile (no patch)"
exit 0
fi

shopt -s nullglob
TQL_FILES=( "${SPRITE_DIR}"/*"${SUITE}"*.tql )
shopt -u nullglob

if [ "${#TQL_FILES[@]}" -eq 0 ]; then
echo "No merged TQL matching suite ${SUITE} under ${SPRITE_DIR}" >&2
exit 1
fi

TQL_FILE="${TQL_FILES[0]}"
MARKER="# XDP CI: native vaiml compile (user.use_docker = 0)"

if grep -qF "${MARKER}" "${TQL_FILE}"; then
echo "TQL already patched for no-docker compile: ${TQL_FILE}"
exit 0
fi

cat >> "${TQL_FILE}" <<'EOF'

# XDP CI: native vaiml compile (user.use_docker = 0)
GLOBAL APPLY * MODIFY
user.use_docker = 0,
tasks.vaiml.select_resource = "(ostype == ubuntu2204 || ostype == ubuntu22044 || ostype == ubuntu24041)";
EOF

echo "Patched ${TQL_FILE} for native vaiml compile"
echo " user.use_docker = 0"
echo " tasks.vaiml.select_resource = (ubuntu hosts, no vai_docker tag)"
Loading
Loading