Welcome to the artifact repository of the NeuRI paper which is accepted by ESEC/FSE 2023.
See links to real-world bug reports.
Important
General test-bed requirements
- OS: A Linux System with Docker Support;
- Hardware: X86/X64 CPU; 16GB RAM; 1TB Storage; Good Network to GitHub and Docker Hub;
Note
Before you start, please make sure you have Docker installed.
To check the installation:
docker --version # Test docker availability
# Docker version 20.10.12, build e91ed5707e
# đź’ˇ Get Docker image from Docker Hub
docker pull ganler/neuri-fse23-ae:latest
# đź’ˇ [Alternative] load image from https://doi.org/10.5281/zenodo.8319975
# 1. Install and "unzip" the package
# 2. Run `docker load --input neuri-image-fse23.tar.gz`
# Run Docker image
docker run -it --name ${USER}-neuri ganler/neuri-fse23-ae:latest
# By using this command, you will "get into" the image like entering a virtual machine.
# The session will be kept under the name "${USER}-neuri"
# So that later on even if you exit the interactive bash, you can come back via:
# `docker start ${USER}-neuri && docker exec -it ${USER}-neuri /bin/bash`
# Inside the image, try to update any timely bug fixes
cd /artifact
git remote set-url origin https://github.com/ise-uiuc/neuri-artifact.git
git pull origin main
The overall process of NeuRI is shown as:
Note Pre-generated rules: For simplicity, we pre-generated the output of instrumentation and rule inference in
./data
directory. To perform instrumentation from scratch, follow instructions here. To perform rule inference, follow the RQ2 section.
We will use ./fuzz.sh
to generate the test-cases.
Note
Command usage of: ./fuzz.sh NSIZE METHOD MODEL BACKEND TIME
Arguments:
NSIZE
: the number of operators in each generated graph.METHOD
: in["neuri", "neuri-i", "neuri-r", "symbolic-cinit"]
.MODEL
: in["tensorflow", "torch"]
.BACKEND
: in["xla", "torchjit"]
.TIME
: fuzzing time in formats like4h
,1m
,30s
.
Outputs:
$(pwd)/gen/${MODEL}-${METHOD}-n${NSIZE}.models
: the generated test-cases (models)
Note
You may parallelize the scripts below if you have multiple cores, at the risk of potential result unstability. Nonetheless the results in the paper are generated without script parallelization.
source ./env_std.sh
./fuzz.sh 5 neuri torch torchjit 4h
./fuzz.sh 5 neuri-i torch torchjit 4h
./fuzz.sh 5 neuri-r torch torchjit 4h
./fuzz.sh 5 symbolic-cinit torch torchjit 4h # NNSmith
./fuzz.sh 1 neuri torch torchjit 4h
./fuzz.sh 9 neuri torch torchjit 4h
./fuzz.sh 13 neuri torch torchjit 4h
source ./env_std.sh
./fuzz.sh 5 neuri tensorflow xla 4h
./fuzz.sh 5 neuri-i tensorflow xla 4h
./fuzz.sh 5 neuri-r tensorflow xla 4h
./fuzz.sh 5 symbolic-cinit tensorflow xla 4h # NNSmith
source ./env_cov.sh
python experiments/evaluate_models.py --root $(pwd)/gen/torch-neuri-n5.models --model_type torch --backend_type torchjit --parallel $(nproc)
python experiments/evaluate_models.py --root $(pwd)/gen/torch-neuri-i-n5.models --model_type torch --backend_type torchjit --parallel $(nproc)
python experiments/evaluate_models.py --root $(pwd)/gen/torch-neuri-r-n5.models --model_type torch --backend_type torchjit --parallel $(nproc)
python experiments/evaluate_models.py --root $(pwd)/gen/torch-symbolic-cinit-n5.models --model_type torch --backend_type torchjit --parallel $(nproc)
python experiments/evaluate_models.py --root $(pwd)/gen/torch-neuri-n1.models --model_type torch --backend_type torchjit --parallel $(nproc)
python experiments/evaluate_models.py --root $(pwd)/gen/torch-neuri-n9.models --model_type torch --backend_type torchjit --parallel $(nproc)
python experiments/evaluate_models.py --root $(pwd)/gen/torch-neuri-n13.models --model_type torch --backend_type torchjit --parallel $(nproc)
# Compute coverage
python experiments/process_profraws.py --root $(pwd)/gen/torch-neuri-n5.models \
--llvm-config-path $(which llvm-config-14) \
--instrumented-libs "$(pwd)/build/pytorch-cov/build/lib/libtorch_cpu.so" "$(pwd)/build/pytorch-cov/build/lib/libtorch.so" \
--batch-size 1000 --parallel $(nproc)
python experiments/process_profraws.py --root $(pwd)/gen/torch-neuri-i-n5.models \
--llvm-config-path $(which llvm-config-14) \
--instrumented-libs "$(pwd)/build/pytorch-cov/build/lib/libtorch_cpu.so" "$(pwd)/build/pytorch-cov/build/lib/libtorch.so" \
--batch-size 1000 --parallel $(nproc)
python experiments/process_profraws.py --root $(pwd)/gen/torch-neuri-r-n5.models \
--llvm-config-path $(which llvm-config-14) \
--instrumented-libs "$(pwd)/build/pytorch-cov/build/lib/libtorch_cpu.so" "$(pwd)/build/pytorch-cov/build/lib/libtorch.so" \
--batch-size 1000 --parallel $(nproc)
python experiments/process_profraws.py --root $(pwd)/gen/torch-symbolic-cinit-n5.models \
--llvm-config-path $(which llvm-config-14) \
--instrumented-libs "$(pwd)/build/pytorch-cov/build/lib/libtorch_cpu.so" "$(pwd)/build/pytorch-cov/build/lib/libtorch.so" \
--batch-size 1000 --parallel $(nproc)
python experiments/process_profraws.py --root $(pwd)/gen/torch-neuri-n1.models \
--llvm-config-path $(which llvm-config-14) \
--instrumented-libs "$(pwd)/build/pytorch-cov/build/lib/libtorch_cpu.so" "$(pwd)/build/pytorch-cov/build/lib/libtorch.so" \
--batch-size 1000 --parallel $(nproc)
python experiments/process_profraws.py --root $(pwd)/gen/torch-neuri-n9.models \
--llvm-config-path $(which llvm-config-14) \
--instrumented-libs "$(pwd)/build/pytorch-cov/build/lib/libtorch_cpu.so" "$(pwd)/build/pytorch-cov/build/lib/libtorch.so" \
--batch-size 1000 --parallel $(nproc)
python experiments/process_profraws.py --root $(pwd)/gen/torch-neuri-n13.models \
--llvm-config-path $(which llvm-config-14) \
--instrumented-libs "$(pwd)/build/pytorch-cov/build/lib/libtorch_cpu.so" "$(pwd)/build/pytorch-cov/build/lib/libtorch.so" \
--batch-size 1000 --parallel $(nproc)
source ./env_cov.sh
python3 experiments/evaluate_tf_models.py --root $(pwd)/gen/tensorflow-neuri-n5.models --parallel $(nproc)
python3 experiments/evaluate_tf_models.py --root $(pwd)/gen/tensorflow-neuri-i-n5.models --parallel $(nproc)
python3 experiments/evaluate_tf_models.py --root $(pwd)/gen/tensorflow-neuri-r-n5.models --parallel $(nproc)
python3 experiments/evaluate_tf_models.py --root $(pwd)/gen/tensorflow-symbolic-cinit-n5.models --parallel $(nproc)
# Compute coverage
python3 experiments/process_lcov.py --root $(pwd)/gen/tensorflow-neuri-n5.models --parallel $(nproc)
python3 experiments/process_lcov.py --root $(pwd)/gen/tensorflow-neuri-i-n5.models --parallel $(nproc)
python3 experiments/process_lcov.py --root $(pwd)/gen/tensorflow-neuri-r-n5.models --parallel $(nproc)
python3 experiments/process_lcov.py --root $(pwd)/gen/tensorflow-symbolic-cinit-n5.models --parallel $(nproc)
# PyTorch
python experiments/genstat.py --root $(pwd)/gen/torch-neuri-n5
python experiments/genstat.py --root $(pwd)/gen/torch-neuri-i-n5
python experiments/genstat.py --root $(pwd)/gen/torch-neuri-r-n5
python experiments/genstat.py --root $(pwd)/gen/torch-symbolic-cinit-n5
# TensorFlow
python experiments/genstat.py --root $(pwd)/gen/tensorflow-neuri-n5
python experiments/genstat.py --root $(pwd)/gen/tensorflow-neuri-i-n5
python experiments/genstat.py --root $(pwd)/gen/tensorflow-neuri-r-n5
python experiments/genstat.py --root $(pwd)/gen/tensorflow-symbolic-cinit-n5
Check the terminal output for the results.
python experiments/viz_merged_cov.py --folders \
$(pwd)/gen/tensorflow-symbolic-cinit-n5.models/coverage \
$(pwd)/gen/tensorflow-neuri-r-n5.models/coverage \
$(pwd)/gen/tensorflow-neuri-i-n5.models/coverage \
$(pwd)/gen/tensorflow-neuri-n5.models/coverage \
--tags '\textsc{NNSmith}' '\textsc{NeuRI}$^r$' '\textsc{NeuRI}$^i$' '\textsc{NeuRI}'
Check images under ./results/branch_cov-time.png
for the results.
python experiments/viz_merged_cov.py --folders \
$(pwd)/gen/torch-symbolic-cinit-n5.models/coverage \
$(pwd)/gen/torch-neuri-r-n5.models/coverage \
$(pwd)/gen/torch-neuri-i-n5.models/coverage \
$(pwd)/gen/torch-neuri-n5.models/coverage \
--tags '\textsc{NNSmith}' '\textsc{NeuRI}$^r$' '\textsc{NeuRI}$^i$' '\textsc{NeuRI}'
Check images under ./results/branch_cov-time.png
for the results.
python experiments/viz_merged_cov.py --folders \
$(pwd)/gen/torch-neuri-n1.models/coverage \
$(pwd)/gen/torch-neuri-n5.models/coverage \
$(pwd)/gen/torch-neuri-n9.models/coverage \
$(pwd)/gen/torch-neuri-n13.models/coverage \
--tags '\#Node 1' '\#Node 5' '\#Node 9' '\#Node 13'
Check images under ./results/branch_cov-time.png
for the results.
source ./env_std.sh
python3 neuri/autoinf/inference/tree.py
python3 neuri/autoinf/inference/augmentation.py
python3 neuri/autoinf/inference/shape_solve.py
python3 neuri/autoinf/inference/predicate_solve.py
python3 neuri/autoinf/inference/nnsmith_reuse.py
python3 neuri/autoinf/inference/rule_validity.py
python3 neuri/autoinf/inference/rosette_solve.py
Rules will be stored in gen/
.
RULE_DIR=$(pwd)/gen ./fuzz.sh 1 neuri-i torch torchjit 4h
RULE_DIR=$(pwd)/gen ./fuzz.sh 1 neuri-i tensorflow xla 4h
python3 table3.py
python3 table4.py
Check the terminal output for the results.
- Command-line usages
- Basic concept of operator rules
- Logging and errors
- Test-as-documentation: detailed internal APIs usages can be learnt through our test-suite at
tests/
- Known issues
- Pre-print:
- NeuRI is being merged into NNSmith