Skip to content

Commit

Permalink
[ci] fix CI script to use latest nix structure
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin authored and sequencer committed Oct 14, 2024
1 parent 0fb34e3 commit b021ea1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 39 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/pd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Test elaborate"
run: |
configArray=( $(ls configgen/generated | sed 's/\.json$//') )
configArray=( $(ls .github/designs) )
ipArray=( "t1emu" "t1rocketemu" )
for cfg in "${configArray[@]}"; do
echo "Building .#t1.${cfg}.ip.rtl"
if ! nix build ".#t1.${cfg}.ip.rtl" -L; then
failed_rtl_configs+=("${cfg}.ip")
fi
if ! nix run ".#ci-helper" -- runOMTests --config ${cfg}; then
failed_om+=("${cfg}")
fi
for ip in "${ipArray[@]}"; do
echo "Building .#t1.${cfg}.${ip}.rtl"
if ! nix build ".#t1.${cfg}.${ip}.rtl" -L; then
failed_rtl_configs+=("${cfg}.${ip}")
fi
if ! nix run ".#ci-helper" -- runOMTests --config ${cfg}; then
failed_om+=("${cfg}")
fi
done
done
if [ -n "${failed_rtl_configs[*]}" ]; then
echo -e "## Failed RTL\n" >> "$GITHUB_STEP_SUMMARY"
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/t1rocket.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: VCS Test (T1 w/ Rocket)
name: T1 Rocket VCS Emulator Test
on:
pull_request:
types:
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- id: "get-all-configs"
run: echo "out=$(nix run .#ci-helper -- generateTestPlan --testType t1rocket)" > $GITHUB_OUTPUT
run: echo "out=$(nix run .#ci-helper -- generateTestPlan)" > $GITHUB_OUTPUT

build-emulators:
name: "Build VCS Emulators w/ Rocket"
Expand All @@ -42,10 +42,10 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Build vcs emulator"
run: |
nix build '.#t1.${{ matrix.config }}.ip.vcs-emu' --impure --no-link --cores 64
nix build '.#t1.${{ matrix.config }}.t1rocketemu.vcs-emu' --impure --no-link
- name: "Build all testcases"
run: |
nix build ".#t1.${{ matrix.config }}.ip.cases._all" --max-jobs auto --no-link --cores 64
nix build ".#t1.${{ matrix.config }}.t1rocketemu.cases._all" --max-jobs auto --no-link --cores 64
gen-matrix:
name: "Prepare for running testcases"
Expand All @@ -66,7 +66,7 @@ jobs:
name: "Generate test matrix"
run: |
echo -n matrix= >> "$GITHUB_OUTPUT"
nix run ".#ci-helper" -- generateCiMatrix --caseDir t1rocket-cases --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT"
nix run ".#ci-helper" -- generateCiMatrix --runnersAmount "$RUNNERS" >> "$GITHUB_OUTPUT"
run-testcases:
name: "Run VCS w/ Rocket"
Expand All @@ -81,7 +81,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Run testcases"
run: |
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs"
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" --testIp "t1rocketemu"
report:
name: "Report VCS (w/ Rocket) CI result"
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/trace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Build vcs emulator"
run: |
nix build '.#t1.${{ matrix.config }}.ip.vcs-emu-trace' --impure --no-link --cores 64
nix build '.#t1.${{ matrix.config }}.t1emu.vcs-emu-trace' --impure --no-link --cores 64
nix build '.#t1.${{ matrix.config }}.t1rocketemu.vcs-emu-trace' --impure --no-link --cores 64
8 changes: 4 additions & 4 deletions .github/workflows/vcs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: VCS Test
name: T1 VCS Emulator Test
on:
pull_request:
types:
Expand Down Expand Up @@ -42,10 +42,10 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Build vcs emulator"
run: |
nix build '.#t1.${{ matrix.config }}.ip.vcs-emu' --impure --no-link --cores 64
nix build '.#t1.${{ matrix.config }}.t1emu.vcs-emu' --impure --no-link
- name: "Build all testcases"
run: |
nix build ".#t1.${{ matrix.config }}.ip.cases._all" --max-jobs auto --no-link --cores 64
nix build ".#t1.${{ matrix.config }}.t1emu.cases._all" --max-jobs auto --no-link --cores 64
gen-matrix:
name: "Prepare for running testcases"
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Run testcases"
run: |
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs"
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "vcs" --testIp "t1emu"
report:
name: "Report VCS CI result"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/verilator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Build verilator emulator"
run: |
nix build '.#t1.${{ matrix.config }}.ip.verilator-emu' -L --no-link --cores 64
nix build '.#t1.${{ matrix.config }}.t1emu.verilator-emu' -L --no-link --cores 64
- name: "Build all testcases"
run: |
# Build testcases with vlen 1024 and vlen 4096
nix build ".#t1.${{ matrix.config }}.ip.cases._all" --max-jobs auto -L --no-link --cores 64
nix build ".#t1.${{ matrix.config }}.t1emu.cases._all" --max-jobs auto -L --no-link --cores 64
# In the future, we may choose Verdi for trace, and left verilator trace only for performance evaluation
build-verilator-trace-emulators:
Expand All @@ -49,7 +49,7 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Build verilator emulator with trace"
run: nix build '.#t1.${{ matrix.config }}.ip.verilator-emu-trace' -L --no-link --cores 64
run: nix build '.#t1.${{ matrix.config }}.t1emu.verilator-emu-trace' -L --no-link --cores 64

gen-matrix:
name: "Prepare for running testcases"
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Run testcases"
run: |
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}"
nix run ".#ci-helper" -- runTests --jobs "${{ matrix.jobs }}" --testType "verilator" --testIp "t1emu"
report:
name: "Report CI result"
Expand Down
2 changes: 1 addition & 1 deletion difftest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
assert let
available = [ "dpi_t1emu" "dpi_t1rocketemu" "offline_t1emu" "offline_t1rocketemu" ];
in
lib.assertMsg (lib.elem moduleType available) "emuType is not in ${lib.concatStringsSep ", " available}";
lib.assertMsg (lib.elem moduleType available) "moduleType is not in ${lib.concatStringsSep ", " available}";
# if emuType is empty, then moduleType must be offline-*, or user should give valid emuType
assert lib.assertMsg ((emuType == "" && lib.hasPrefix "offline" moduleType) || (lib.elem emuType [ "verilator" "vcs" ])) "emuType is either 'vcs' nor 'verilator'";

Expand Down
25 changes: 10 additions & 15 deletions script/ci/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ object Main:
@main
def generateCiMatrix(
runnersAmount: Int,
caseDir: String = "cases",
caseDir: String = "designs",
testPlanFile: String = "default.json"
) = {
val testPlans =
Expand All @@ -145,7 +145,8 @@ object Main:
@main
def runTests(
jobs: String,
testType: String = "verilator"
testIp: String,
testType: String
): Unit =
if jobs == "" then
Logger.info("No test found, exiting")
Expand All @@ -162,8 +163,8 @@ object Main:

val testAttr = testType.toLowerCase() match
case "verilator" =>
s".#t1.$config.ip.run.$caseName.verilator-emu"
case "vcs" => s".#t1.$config.ip.run.$caseName.vcs-emu"
s".#t1.$config.$testIp.run.$caseName.verilator-emu"
case "vcs" => s".#t1.$config.$testIp.run.$caseName.vcs-emu"
case _ => Logger.fatal(s"Invalid test type ${testType}")
val testResultPath =
try
Expand Down Expand Up @@ -308,17 +309,11 @@ object Main:
end postCI

@main
def generateTestPlan(testType: String = "") =
val casePath = testType match
case "t1rocket" => os.pwd / ".github" / "t1rocket-cases"
case _ => os.pwd / ".github" / "cases"

val allCases = os.walk(casePath).filter(_.last == "default.json")
val testPlans = allCases.map: caseFilePath =>
caseFilePath.segments
.dropWhile(!Seq("cases", "t1rocket-cases").contains(_))
.drop(1)
.next
def generateTestPlan() =
val testPlans = os
.walk(os.pwd / ".github" / "designs")
.filter(_.last == "default.json")
.map(path => path.segments.toSeq.reverse.drop(1).head)

println(ujson.write(Map("config" -> testPlans)))
end generateTestPlan
Expand Down

0 comments on commit b021ea1

Please sign in to comment.