|
| 1 | +name: Accuracy - PolyBench |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'benchmarks/polybench/**' |
| 8 | + - 'benchmarks/polybench_test.go' |
| 9 | + - 'benchmarks/timing_harness.go' |
| 10 | + - 'timing/**' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: accuracy-polybench-${{ github.ref }} |
| 15 | + cancel-in-progress: false |
| 16 | + |
| 17 | +jobs: |
| 18 | + polybench-group-1: |
| 19 | + name: PolyBench Group 1 (ATAX, BiCG, Jacobi1D) |
| 20 | + runs-on: macos-14 |
| 21 | + timeout-minutes: 30 |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - uses: actions/setup-go@v5 |
| 25 | + with: |
| 26 | + go-version: '1.25' |
| 27 | + |
| 28 | + - name: Verify ELFs |
| 29 | + run: | |
| 30 | + ls -la benchmarks/polybench/atax_m2sim.elf |
| 31 | + ls -la benchmarks/polybench/bicg_m2sim.elf |
| 32 | + ls -la benchmarks/polybench/jacobi-1d_m2sim.elf |
| 33 | +
|
| 34 | + - name: Run tests |
| 35 | + run: | |
| 36 | + for TEST in TestPolybenchATAX TestPolybenchBiCG TestPolybenchJacobi1D; do |
| 37 | + echo "--- $TEST ---" |
| 38 | + go test -v -run "^${TEST}$" -count=1 -timeout 8m ./benchmarks/ 2>&1 | tee -a group1_output.txt || true |
| 39 | + done |
| 40 | +
|
| 41 | + - name: Upload results |
| 42 | + if: always() |
| 43 | + uses: actions/upload-artifact@v4 |
| 44 | + with: |
| 45 | + name: polybench-group-1 |
| 46 | + path: group1_output.txt |
| 47 | + retention-days: 30 |
| 48 | + |
| 49 | + polybench-group-2: |
| 50 | + name: PolyBench Group 2 (MVT, GEMM) |
| 51 | + runs-on: macos-14 |
| 52 | + timeout-minutes: 30 |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + - uses: actions/setup-go@v5 |
| 56 | + with: |
| 57 | + go-version: '1.25' |
| 58 | + |
| 59 | + - name: Verify ELFs |
| 60 | + run: | |
| 61 | + ls -la benchmarks/polybench/mvt_m2sim.elf |
| 62 | + ls -la benchmarks/polybench/gemm_m2sim.elf |
| 63 | +
|
| 64 | + - name: Run tests |
| 65 | + run: | |
| 66 | + for TEST in TestPolybenchMVT TestPolybenchGEMM; do |
| 67 | + echo "--- $TEST ---" |
| 68 | + go test -v -run "^${TEST}$" -count=1 -timeout 8m ./benchmarks/ 2>&1 | tee -a group2_output.txt || true |
| 69 | + done |
| 70 | +
|
| 71 | + - name: Upload results |
| 72 | + if: always() |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: polybench-group-2 |
| 76 | + path: group2_output.txt |
| 77 | + retention-days: 30 |
| 78 | + |
| 79 | + polybench-group-3: |
| 80 | + name: PolyBench Group 3 (2MM, 3MM) |
| 81 | + runs-on: macos-14 |
| 82 | + timeout-minutes: 30 |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + - uses: actions/setup-go@v5 |
| 86 | + with: |
| 87 | + go-version: '1.25' |
| 88 | + |
| 89 | + - name: Verify ELFs |
| 90 | + run: | |
| 91 | + ls -la benchmarks/polybench/2mm_m2sim.elf |
| 92 | + ls -la benchmarks/polybench/3mm_m2sim.elf |
| 93 | +
|
| 94 | + - name: Run tests |
| 95 | + run: | |
| 96 | + for TEST in TestPolybench2MM TestPolybench3MM; do |
| 97 | + echo "--- $TEST ---" |
| 98 | + go test -v -run "^${TEST}$" -count=1 -timeout 8m ./benchmarks/ 2>&1 | tee -a group3_output.txt || true |
| 99 | + done |
| 100 | +
|
| 101 | + - name: Upload results |
| 102 | + if: always() |
| 103 | + uses: actions/upload-artifact@v4 |
| 104 | + with: |
| 105 | + name: polybench-group-3 |
| 106 | + path: group3_output.txt |
| 107 | + retention-days: 30 |
| 108 | + |
| 109 | + consolidate: |
| 110 | + name: Consolidate PolyBench Results |
| 111 | + runs-on: ubuntu-latest |
| 112 | + needs: [polybench-group-1, polybench-group-2, polybench-group-3] |
| 113 | + if: always() |
| 114 | + steps: |
| 115 | + - uses: actions/checkout@v4 |
| 116 | + |
| 117 | + - name: Download results |
| 118 | + uses: actions/download-artifact@v4 |
| 119 | + with: |
| 120 | + path: group-results |
| 121 | + |
| 122 | + - name: Extract CPI results |
| 123 | + run: | |
| 124 | + cat group-results/polybench-group-1/group1_output.txt > combined.txt 2>/dev/null || true |
| 125 | + cat group-results/polybench-group-2/group2_output.txt >> combined.txt 2>/dev/null || true |
| 126 | + cat group-results/polybench-group-3/group3_output.txt >> combined.txt 2>/dev/null || true |
| 127 | +
|
| 128 | + python3 - <<'PYEOF' |
| 129 | + import json, re |
| 130 | +
|
| 131 | + results = {} |
| 132 | + with open("combined.txt") as f: |
| 133 | + for line in f: |
| 134 | + if "CPI=" not in line: |
| 135 | + continue |
| 136 | + match = re.search(r'(polybench_\w+):\s+cycles=(\d+),\s+insts=(\d+),\s+CPI=([\d.]+)', line) |
| 137 | + if match: |
| 138 | + name = match.group(1).replace("polybench_", "") |
| 139 | + if name == "jacobi1d": |
| 140 | + name = "jacobi-1d" |
| 141 | + results[name] = { |
| 142 | + "cycles": int(match.group(2)), |
| 143 | + "instructions": int(match.group(3)), |
| 144 | + "cpi": float(match.group(4)), |
| 145 | + } |
| 146 | +
|
| 147 | + output = {"benchmarks_run": len(results), "results": results} |
| 148 | + with open("polybench_results.json", "w") as f: |
| 149 | + json.dump(output, f, indent=2) |
| 150 | + print(json.dumps(output, indent=2)) |
| 151 | + PYEOF |
| 152 | +
|
| 153 | + - name: Post summary |
| 154 | + if: always() |
| 155 | + run: | |
| 156 | + echo "## PolyBench Accuracy Results" >> $GITHUB_STEP_SUMMARY |
| 157 | + if [ -f polybench_results.json ]; then |
| 158 | + python3 -c " |
| 159 | + import json |
| 160 | + d = json.load(open('polybench_results.json')) |
| 161 | + print(f'**Benchmarks measured:** {d[\"benchmarks_run\"]}/7') |
| 162 | + if d['results']: |
| 163 | + print() |
| 164 | + print('| Benchmark | CPI |') |
| 165 | + print('|-----------|-----|') |
| 166 | + for name, r in sorted(d['results'].items()): |
| 167 | + print(f'| {name} | {r[\"cpi\"]:.3f} |') |
| 168 | + " >> $GITHUB_STEP_SUMMARY |
| 169 | + fi |
| 170 | +
|
| 171 | + - name: Upload consolidated results |
| 172 | + uses: actions/upload-artifact@v4 |
| 173 | + with: |
| 174 | + name: polybench-consolidated |
| 175 | + path: polybench_results.json |
| 176 | + retention-days: 90 |
0 commit comments