Skip to content

Commit be2c7e9

Browse files
committed
Updated run-proofs.sh to reuse llvm-kompile
Multiple start-symbols per filee mean time can be saved on kompilation. Increases overall performance by approx 3x.
1 parent 659f410 commit be2c7e9

1 file changed

Lines changed: 45 additions & 48 deletions

File tree

kmir-proofs/0011-floats-ints/run-proofs.sh

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,58 @@ DIR=$(realpath "$(dirname "$0")")
1313
cd "$DIR"
1414

1515
PROOF_DIR=proofs
16-
FAILED_PROOFS=""
17-
18-
# Mapping of FILENAME -> START_SYMBOLS
19-
declare -A FILE_SYMBOLS
20-
FILE_SYMBOLS=(
21-
[unchecked_add]="unchecked_add_u8 unchecked_add_u16 unchecked_add_u32 unchecked_add_u64 unchecked_add_u128 unchecked_add_i8 unchecked_add_i16 unchecked_add_i32 unchecked_add_i64 unchecked_add_i128"
22-
[unchecked_sub]="unchecked_sub_u8 unchecked_sub_u16 unchecked_sub_u32 unchecked_sub_u64 unchecked_sub_u128 unchecked_sub_i8 unchecked_sub_i16 unchecked_sub_i32 unchecked_sub_i64 unchecked_sub_i128"
23-
[unchecked_mul]="unchecked_mul_u8 unchecked_mul_u16 unchecked_mul_u32 unchecked_mul_u64 unchecked_mul_u128 unchecked_mul_i8 unchecked_mul_i16 unchecked_mul_i32 unchecked_mul_i64 unchecked_mul_i128"
24-
[unchecked_shl]="unchecked_shl_u8 unchecked_shl_u16 unchecked_shl_u32 unchecked_shl_u64 unchecked_shl_u128 unchecked_shl_i8 unchecked_shl_i16 unchecked_shl_i32 unchecked_shl_i64 unchecked_shl_i128"
25-
[unchecked_shr]="unchecked_shr_u8 unchecked_shr_u16 unchecked_shr_u32 unchecked_shr_u64 unchecked_shr_u128 unchecked_shr_i8 unchecked_shr_i16 unchecked_shr_i32 unchecked_shr_i64 unchecked_shr_i128"
26-
[unchecked_neg]="unchecked_neg_i8 unchecked_neg_i16 unchecked_neg_i32 unchecked_neg_i64 unchecked_neg_i128"
27-
[wrapping_shl]="wrapping_shl_u8 wrapping_shl_u16 wrapping_shl_u32 wrapping_shl_u64 wrapping_shl_u128 wrapping_shl_i8 wrapping_shl_i16 wrapping_shl_i32 wrapping_shl_i64 wrapping_shl_i128"
28-
[wrapping_shr]="wrapping_shr_u8 wrapping_shr_u16 wrapping_shr_u32 wrapping_shr_u64 wrapping_shr_u128 wrapping_shr_i8 wrapping_shr_i16 wrapping_shr_i32 wrapping_shr_i64 wrapping_shr_i128"
29-
[widening_mul]="widening_mul_u8 widening_mul_u16 widening_mul_u32 widening_mul_u64"
30-
[carrying_mul]="carrying_mul_u8 carrying_mul_u16 carrying_mul_u32 carrying_mul_u64"
31-
)
32-
33-
for file in "${!FILE_SYMBOLS[@]}"; do
34-
rs_file="${file}.rs"
35-
if [ ! -f "$rs_file" ]; then
36-
echo "ERROR: $rs_file not found"
37-
FAILED_PROOFS="${FAILED_PROOFS} ${file}(missing)"
38-
continue
39-
fi
40-
41-
symbols="${FILE_SYMBOLS[$file]}"
42-
echo "========================================="
43-
echo "File: $rs_file"
44-
echo "========================================="
45-
46-
for sym in $symbols; do
47-
proof_id="${file}.${sym}"
48-
echo "-----------------------------------------"
49-
echo "Proving: ${proof_id}"
50-
echo "-----------------------------------------"
51-
52-
if ! kmir prove --start-symbol "$sym" --terminate-on-thunk --proof-dir "$PROOF_DIR" --reload "$rs_file"; then
53-
FAILED_PROOFS="${FAILED_PROOFS} ${proof_id}"
54-
fi
55-
56-
kmir show --proof-dir "$PROOF_DIR" "${proof_id}" || true
57-
done
58-
done
16+
rm -rf "$PROOF_DIR"
17+
18+
FAILED_FILES=""
19+
20+
kmir prove unchecked_add.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
21+
--start-symbol unchecked_add_u8,unchecked_add_u16,unchecked_add_u32,unchecked_add_u64,unchecked_add_u128,unchecked_add_i8,unchecked_add_i16,unchecked_add_i32,unchecked_add_i64,unchecked_add_i128 \
22+
|| FAILED_FILES="$FAILED_FILES unchecked_add"
23+
24+
kmir prove unchecked_sub.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
25+
--start-symbol unchecked_sub_u8,unchecked_sub_u16,unchecked_sub_u32,unchecked_sub_u64,unchecked_sub_u128,unchecked_sub_i8,unchecked_sub_i16,unchecked_sub_i32,unchecked_sub_i64,unchecked_sub_i128 \
26+
|| FAILED_FILES="$FAILED_FILES unchecked_sub"
27+
28+
kmir prove unchecked_mul.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
29+
--start-symbol unchecked_mul_u8,unchecked_mul_u16,unchecked_mul_u32,unchecked_mul_u64,unchecked_mul_u128,unchecked_mul_i8,unchecked_mul_i16,unchecked_mul_i32,unchecked_mul_i64,unchecked_mul_i128 \
30+
|| FAILED_FILES="$FAILED_FILES unchecked_mul"
31+
32+
kmir prove unchecked_shl.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
33+
--start-symbol unchecked_shl_u8,unchecked_shl_u16,unchecked_shl_u32,unchecked_shl_u64,unchecked_shl_u128,unchecked_shl_i8,unchecked_shl_i16,unchecked_shl_i32,unchecked_shl_i64,unchecked_shl_i128 \
34+
|| FAILED_FILES="$FAILED_FILES unchecked_shl"
35+
36+
kmir prove unchecked_shr.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
37+
--start-symbol unchecked_shr_u8,unchecked_shr_u16,unchecked_shr_u32,unchecked_shr_u64,unchecked_shr_u128,unchecked_shr_i8,unchecked_shr_i16,unchecked_shr_i32,unchecked_shr_i64,unchecked_shr_i128 \
38+
|| FAILED_FILES="$FAILED_FILES unchecked_shr"
39+
40+
kmir prove unchecked_neg.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
41+
--start-symbol unchecked_neg_i8,unchecked_neg_i16,unchecked_neg_i32,unchecked_neg_i64,unchecked_neg_i128 \
42+
|| FAILED_FILES="$FAILED_FILES unchecked_neg"
43+
44+
kmir prove wrapping_shl.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
45+
--start-symbol wrapping_shl_u8,wrapping_shl_u16,wrapping_shl_u32,wrapping_shl_u64,wrapping_shl_u128,wrapping_shl_i8,wrapping_shl_i16,wrapping_shl_i32,wrapping_shl_i64,wrapping_shl_i128 \
46+
|| FAILED_FILES="$FAILED_FILES wrapping_shl"
47+
48+
kmir prove wrapping_shr.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
49+
--start-symbol wrapping_shr_u8,wrapping_shr_u16,wrapping_shr_u32,wrapping_shr_u64,wrapping_shr_u128,wrapping_shr_i8,wrapping_shr_i16,wrapping_shr_i32,wrapping_shr_i64,wrapping_shr_i128 \
50+
|| FAILED_FILES="$FAILED_FILES wrapping_shr"
51+
52+
kmir prove widening_mul.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
53+
--start-symbol widening_mul_u8,widening_mul_u16,widening_mul_u32,widening_mul_u64 \
54+
|| FAILED_FILES="$FAILED_FILES widening_mul"
55+
56+
kmir prove carrying_mul.rs --terminate-on-thunk --proof-dir "$PROOF_DIR" \
57+
--start-symbol carrying_mul_u8,carrying_mul_u16,carrying_mul_u32,carrying_mul_u64 \
58+
|| FAILED_FILES="$FAILED_FILES carrying_mul"
5959

6060
echo ""
6161
echo "========================================="
6262
echo "SUMMARY"
6363
echo "========================================="
6464

65-
if [ -n "$FAILED_PROOFS" ]; then
65+
if [ -n "$FAILED_FILES" ]; then
6666
echo ""
67-
echo "FAILED:"
68-
for f in $FAILED_PROOFS; do
69-
echo " - $f"
70-
done
67+
echo "FAILED:$FAILED_FILES"
7168
echo ""
7269
echo -e "\033[31m=========================================\033[0m"
7370
echo -e "\033[31mSOME PROOFS FAILED\033[0m"

0 commit comments

Comments
 (0)