Skip to content
Draft
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
35 changes: 32 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,46 @@ jobs:
defaults:
run:
working-directory: /code/lean-mlir/bv-evaluation
permissions:
pull-requests: write
strategy:
matrix:
offset: [0, 1, 2]
stride: [3]
steps:
- name: Symlink .elan (to correct for GHA changing $HOME)
run: '[ -e ~/.elan ] || ln -s /root/.elan ~/.elan'

- name: Run LLVM
continue-on-error: true
run: |
uv run ./compare.py instcombine -j48 \
uv run ./compare.py instcombine -j48 --stride=${{matrix.stride}} --offset=${{matrix.offset}} \
|| (echo "LEANMLIR_STATUS=fail" >> $GITHUB_ENV; exit 1)

- name: Upload logs
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.run_id }}-instcombine-logs-${{matrix.offset}}
retention-days: 1
path: |
/code/lean-mlir/bv-evaluation/results/InstCombine/

report-LLVM:
name: Collect & report LLVM evaluation data
runs-on: ubuntu-latest # Run on GH-provided runner
needs: evaluation-LLVM
container: "ghcr.io/opencompl/lean-mlir-instcombine:${{ github.sha }}"
defaults:
run:
working-directory: /code/lean-mlir/bv-evaluation
permissions:
pull-requests: write
steps:
- name: Download data
uses: actions/download-artifact@v5
with:
path: /code/lean-mlir/bv-evaluation/results/InstCombine/
pattern: ${{ github.run_id }}-instcombine-logs-*
merge-multiple: true

- name: Collect data LLVM
continue-on-error: true
Expand Down
48 changes: 34 additions & 14 deletions bv-evaluation/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def compare(
memout: int,
num_samples,
seed,
stride: int,
offset: int
):
"""Processes benchmarks using a thread pool."""
with concurrent.futures.ThreadPoolExecutor(max_workers=jobs) as executor:
Expand Down Expand Up @@ -237,20 +239,22 @@ def compare(
clear_folder(RESULTS_DIR_INSTCOMBINE)
os.makedirs(RESULTS_DIR_INSTCOMBINE, exist_ok=True)

for file in os.listdir(BENCHMARK_DIR_INSTCOMBINE):
if "_proof" in file and file.endswith(
".lean"
): # Ensure it's a Lean file
for r in range(reps):
file_path = os.path.join(BENCHMARK_DIR_INSTCOMBINE, file)
file_title = os.path.splitext(file)[0]
log_file_path = os.path.join(
RESULTS_DIR_INSTCOMBINE, f"{file_title}_r{str(r)}.txt"
)
future = executor.submit(
run_file, file_path, log_file_path
)
futures[future] = file_path
files = [ file for file in os.listdir(BENCHMARK_DIR_INSTCOMBINE)
if "_proof" in file and file.endswith(".lean") ] # Ensure it's a Lean file
# Filter to just the files meant for this runner (if distributed)
files = files[offset::stride]

for file in files:
for r in range(reps):
file_path = os.path.join(BENCHMARK_DIR_INSTCOMBINE, file)
file_title = os.path.splitext(file)[0]
log_file_path = os.path.join(
RESULTS_DIR_INSTCOMBINE, f"{file_title}_r{str(r)}.txt"
)
future = executor.submit(
run_file, file_path, log_file_path
)
futures[future] = file_path

elif benchmark == "smtlib":
clear_folder(RESULTS_DIR_SMTLIB)
Expand Down Expand Up @@ -331,6 +335,20 @@ def main():
help="Solver for SMT-LIB benchmarks",
)

parser.add_argument(
"--stride",
type=int,
default=1,
help="For distributed runs, the total number of jobs (instcombine benchmark only!)"
)

parser.add_argument(
"--offset",
type=int,
default=0,
help="For distributed runs, the index of the current runner (instcombine benchmark only!)"
)

args = parser.parse_args()
benchmarks_to_run = (
["hackersdelight", "instcombine", "smtlib"]
Expand All @@ -348,6 +366,8 @@ def main():
args.memout,
args.num_samples,
args.seed,
args.stride,
args.offset
)


Expand Down
Loading