-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mx performance script #567
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1d7117d
add mx performance script
goodlyrottenapple 8a1c5d3
Merge branch 'main' into sam/performance-mx
goodlyrottenapple bde9dfc
add bug-report option
goodlyrottenapple 863c812
Merge branch 'main' into sam/performance-mx
goodlyrottenapple 87aa323
Merge branch 'main' into sam/performance-mx
goodlyrottenapple 20650ab
Merge branch 'main' into sam/performance-mx
goodlyrottenapple ab702c6
fix plugin
goodlyrottenapple File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
# Disable the Python keyring, otherwise poetry sometimes asks for password. See | ||
# https://github.com/pypa/pip/issues/7883 | ||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring | ||
|
||
MX_VERSION=${MX_VERSION:-'master'} | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" | ||
|
||
MASTER_COMMIT="$(git rev-parse origin/main)" | ||
MASTER_COMMIT_SHORT="$(git rev-parse --short origin/main)" | ||
|
||
FEATURE_BRANCH_NAME=${FEATURE_BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"} | ||
FEATURE_BRANCH_NAME="${FEATURE_BRANCH_NAME//\//-}" | ||
|
||
PYTEST_PARALLEL=${PYTEST_PARALLEL:-3} | ||
|
||
if [[ $FEATURE_BRANCH_NAME == "master" ]]; then | ||
FEATURE_BRANCH_NAME="feature" | ||
fi | ||
|
||
# Create a temporary directory and store its name in a variable. | ||
TEMPD=$(mktemp -d) | ||
|
||
# Exit if the temp directory wasn't created successfully. | ||
if [ ! -e "$TEMPD" ]; then | ||
>&2 echo "Failed to create temp directory" | ||
exit 1 | ||
fi | ||
|
||
# Make sure the temp directory gets removed and kore-rpc-booster gets killed on script exit. | ||
trap "exit 1" HUP INT PIPE QUIT TERM | ||
trap 'rm -rf "$TEMPD" && killall kore-rpc-booster || echo "No zombie processes found"' EXIT | ||
|
||
feature_shell() { | ||
GC_DONT_GC=1 nix develop . --extra-experimental-features 'nix-command flakes' --override-input k-framework/booster-backend $SCRIPT_DIR/../ --command bash -c "$1" | ||
} | ||
|
||
master_shell() { | ||
GC_DONT_GC=1 nix develop . --extra-experimental-features 'nix-command flakes' --override-input k-framework/booster-backend github:runtimeverification/hs-backend-booster/$MASTER_COMMIT --command bash -c "$1" | ||
} | ||
|
||
cd $TEMPD | ||
git clone --depth 1 --branch $MX_VERSION https://github.com/runtimeverification/mx-backend.git | ||
cd mx-backend | ||
|
||
if [[ $MX_VERSION == "master" ]]; then | ||
MX_VERSION=$(git name-rev --tags --name-only $(git rev-parse HEAD)) | ||
else | ||
MX_VERSION="${MX_VERSION//\//-}" | ||
fi | ||
|
||
git submodule update --init --recursive --depth 1 kmxwasm/k-src/mx-semantics/ | ||
|
||
BUG_REPORT='' | ||
POSITIONAL_ARGS=() | ||
|
||
while [[ $# -gt 0 ]]; do | ||
case $1 in | ||
--bug-report) | ||
mkdir -p $SCRIPT_DIR/bug-reports/mx-$MX_VERSION-$FEATURE_BRANCH_NAME | ||
BUG_REPORT="--bug-report --bug-report-dir $SCRIPT_DIR/bug-reports/mx-$MX_VERSION-$FEATURE_BRANCH_NAME" | ||
shift # past argument | ||
;; | ||
-*|--*) | ||
echo "Unknown option $1" | ||
exit 1 | ||
;; | ||
*) | ||
POSITIONAL_ARGS+=("$1") # save positional arg | ||
shift # past argument | ||
;; | ||
esac | ||
done | ||
|
||
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters | ||
|
||
|
||
feature_shell "poetry -C kmxwasm install && make -C kmxwasm kbuild-haskell" | ||
|
||
|
||
mkdir -p $SCRIPT_DIR/logs | ||
|
||
feature_shell "make -C kmxwasm test-booster TEST_ARGS='$BUG_REPORT' && make -C kmxwasm test-integration TEST_ARGS='$BUG_REPORT' | tee $SCRIPT_DIR/logs/mx-$MX_VERSION-$FEATURE_BRANCH_NAME.log" | ||
killall kore-rpc-booster || echo "No zombie processes found" | ||
|
||
if [ -z "$BUG_REPORT" ]; then | ||
if [ ! -e "$SCRIPT_DIR/logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT.log" ]; then | ||
master_shell "make -C kmxwasm test-booster && make -C kmxwasm test-integration | tee $SCRIPT_DIR/logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT.log" | ||
killall kore-rpc-booster || echo "No zombie processes found" | ||
fi | ||
|
||
cd $SCRIPT_DIR | ||
python3 compare.py logs/mx-$MX_VERSION-$FEATURE_BRANCH_NAME.log logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT.log > logs/mx-$MX_VERSION-master-$MASTER_COMMIT_SHORT-$FEATURE_BRANCH_NAME-compare | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to execute the same command in
master_shell
?Also, will the LLVM backend shared library be built by
make -C kmxwasm kbuild-haskell
? @virgil-serbanuta @bbyalcinkaya could you have a look at this PR and make sure the script does what you'd expect?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, master shell is used to compare our feature branch change to the current version of booster in mx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these steps are copied from the CI run in the mx repo:
https://github.com/runtimeverification/mx-backend/blob/872626e6a658bdbdc7914e5c1c01d19cffc3f11c/.github/workflows/test.yml#L96-L118
so hopefully should do the same thing....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would guess that the
poetry install
andmake kbuild-haskell
are independent of the booster version, so we wouldn't have to repeat that command (we don't at the moment).Better to have this confirmed by @virgil-serbanuta or @bbyalcinkaya , though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The kasmer tool builds the semantics at start (for the Haskell backend, for the LLVM backend, and, if
--booster
is passed to the tool, it also builds the llvm library). Tests do something similar.make -C kmxwasm kbuild-haskell
should not be needed unless you need to run things outside our tool (or, perhaps, you just want to check that it compiles).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, we will probably add the option to use an already-built semantics soon, we can try to do that sooner if you need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.