Skip to content

Commit

Permalink
modify according to anonymous repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jikechao committed Jul 16, 2021
1 parent 6f0e6a8 commit e9afb63
Show file tree
Hide file tree
Showing 16 changed files with 233 additions and 572 deletions.
Binary file modified INSTALL.pdf
Binary file not shown.
47 changes: 14 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# TVMfuzz [![DOI](https://zenodo.org/badge/369744575.svg)](https://zenodo.org/badge/latestdoi/369744575)
This repository has been archived using Zenodo. Anyone can publicly access the artifact via the link [![DOI](https://zenodo.org/badge/342103158.svg)](https://zenodo.org/badge/latestdoi/342103158).

# TVMfuzz

## introduction

Expand All @@ -17,47 +19,16 @@ After running *run.py*, a new folder named *byproduct* will be created and it co
+ log.txt: records the interrelationship among all involved statements of interest
+ program.py: the generated test program

## dependency and version

TVMfuzz requires Python package ast, astunparse and numpy, also need to install tvm according the instruction [here](https://tvm.apache.org/docs/install/from_source.html) before executing.

By the way, Python version 3.9.1 is required for successful execution.


## Reproducibility

### TVMFuzz

To release reviews from laborious tasks of building experimental environments, we have created a docker image and pushed it to docker hub. The version of TVM installed in our image is 0.7, consistent with the one in our experiments.
You can download the image and reproduce our experiments about TVMfuzz in the following steps:

1) Input the following commands:

docker pull mhypony/dlcstudy_tvmfuzz:latest

docker run -it mhypony/dlcstudy_tvmfuzz:latest /bin/bash
You can download the image and reproduce our experiments about TVMfuzz following the **[INSTALL.pdf](https://github.com/anonymousWork000/DLCstudy/blob/master/INSTALL.pdf)** file.

2) Now you are in our docker container, to eliminate unexpected situations that may corrupt our experiment, you should input the following two commands:

source /etc/profile

source activate

3) Now go to the folder called **DLCstudy** and run **run.py**.

5) Finally, you can check the generated program (**program.py**) in the folder named **byproduct**.

6) You can also download the latest version of TVM and compare the difference between executions under TVM 0.7 and TVM latest. If you are lucky, you may find some bugs that we have never found.

### Plotting
In order to better reproduce the figures in the paper, we provide a drawing scrip (**drawing_script.R**), which can generate all the graphs in our paper. To see the generated graph intuitively, we recommend that you use RStudio to run this script.
First You just need to download the **plotting** folder in this repository to your computer.

Secondly, you need to run the script(`drawing_script.R`) with RStudio, and then all the figures in our paper will be generated one by one.

Notes:
1. The dataset file(**dataset.xlsx**) should be placed in the same directory as the drawing_script.R file.
2. If the running crash with a message "\`path\` does not exist: ‘dataset.xlsx’", you need set the **working directory** to source file location.

# Dataset

Expand Down Expand Up @@ -101,3 +72,13 @@ For each worksheet, the following related information are shown:
- the top root cause of this bug
- sub_causes: short for subcategories of root causes
- the related framework of the Model Loading bugs

## Plotting
In order to better reproduce the figures in the paper, we provide a drawing scrip (**drawing_script.R**), which can generate all the graphs in our paper. To see the generated graph intuitively, we recommend that you use RStudio to run this script.
First You just need to download the **dataset** folder in this repository to your computer.

Secondly, you need to run the script(`drawing_script.R`) with RStudio, and then all the figures in our paper will be generated one by one.

Notes:
1. The dataset file(**dataset.xlsx**) should be placed in the same directory as the **drawing_script.R** file.
2. If the running crash with a message "\`path\` does not exist: ‘dataset.xlsx’", you need set the **working directory** to source file location.
2 changes: 1 addition & 1 deletion STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Our artifact contains all relevant files and codes and is publicly available. It can easily be replicated. Therefore, we apply for the badges "Artifact Available" and "Artifact Evaluated".

A public GitHub repository is used to store the artifacts, which contain all required materials. In addition, we use Zenodo to archiving our GitHub repository releases. The DOI of our artifact is [![DOI](https://zenodo.org/badge/369744575.svg)](https://zenodo.org/badge/latestdoi/369744575). Therefore, we believe that the artifact deserves the "Artifact Available " badge.
A public GitHub repository is used to store the artifacts, which contain all required materials. In addition, we use Zenodo to archiving our GitHub repository releases. The DOI of our artifact is [![DOI](https://zenodo.org/badge/342103158.svg)](https://zenodo.org/badge/latestdoi/342103158). Therefore, we believe that the artifact deserves the "Artifact Available " badge.

Our artifact has two components: the labeled dataset in our empirical study and our bug detection tool TVMFuzz. The dataset provides the basic support for our paper. It contains the basic information of the 603 bugs studied by us and the extra information that was manually labeled by us. To reproduce the figures based on the dataset in our paper, a drawing script is provided. TVMFuzz is a tool designed by us to fuzz the TVM. To facilitate the reproduction process, we also provide a docker file. The detailed installation guide, usage method, and result analysis are all included in the INSTALL file. In addition, the artifact is open sourced with Apache-2.0 License.
Through the artifacts, other authors can easily replicate our paper. Therefore, we believe that the artifact deserves the "Artifact Evaluated " badge.
36 changes: 1 addition & 35 deletions TVMfuzz/ASTutils.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
'''
Copyright 2021 The Authors: Qingchao Shen, Haoyang Ma, Junjie Chen, Yongqiang Tian, Shing-Chi Cheung, Xiang Che
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''


import ast
from TVMfuzz.elements import *
import random
Expand All @@ -26,9 +9,6 @@

'''nestplus components'''
def getAllElementsFromAttrCallSubsName(value):

# import astunparse
# print(Green(astunparse.unparse(value)))

rcur = []
while True:
Expand Down Expand Up @@ -534,9 +514,6 @@ def recognizeLambda(value, indent, surround):
for arg in value.args.args:
param.add_arg(pVar(arg.arg))
param.add_body(recognizeMultiAssignment(value.body, indent=indent, surround=surround))
# import astunparse
# print(Blue(astunparse.unparse(value)))
# param.add_value(value)
return param

def recognizeBinOp(value, indent, surround):
Expand Down Expand Up @@ -597,9 +574,7 @@ def recognizeMultiAssignment(value,

return recognizeConst(value, indent)

elif isinstance(value, ast.Call):
# import astunparse
# print(Blue(astunparse.unparse(value)))
elif isinstance(value, ast.Call):
return recognizeCall(value,
indent,
outsideFunction,
Expand Down Expand Up @@ -674,7 +649,6 @@ def recognizeMultiAssignment(value,
return recognizeLambda(value, indent, surround)

else:
# pass
raise Exception(Cyan('We never handle this ast Type: ' + str(type(value))))

'''end'''
Expand Down Expand Up @@ -714,8 +688,6 @@ def interpreter(ln, rn, surround=None, indent=0):
'''

if not isinstance(rn, pFunc):

# rn.add_surround(surround)
if rn.Type == 'variable':
rn.add_indent(indent)

Expand All @@ -726,7 +698,6 @@ def interpreter(ln, rn, surround=None, indent=0):
else:
varobjects.append(ln)
rn.add_surround(surround)
# print(Green(str(rn)))
dealWithStatement(param=rn, varobjects=varobjects)

else:
Expand Down Expand Up @@ -788,16 +759,11 @@ def assignNodeReadyForInterpreter(lenleft,
Target at the situation where rightnames includes one function and varnames is longer
than rightnames
'''
# if rparams[i].Type != 'function':
# raise Exception(
# 'Middle function with more than one returned value! ' + rparams[i].Type)
ln, rn = lparams[i:], rparams[i]
else:
ln, rn = lparams[i], rparams[i]
if isinstance(ln, list):
for i in ln:
# if isinstance(i, pTuple):
# print(Magenta(str(i)))
varnamesRead.add(i.name)
else:
if isinstance(ln, pVar):
Expand Down
15 changes: 0 additions & 15 deletions TVMfuzz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
'''
Copyright 2021 The Authors: Qingchao Shen, Haoyang Ma, Junjie Chen, Yongqiang Tian, Shing-Chi Cheung, Xiang Che
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
17 changes: 0 additions & 17 deletions TVMfuzz/analyzeSyntax.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
'''
Copyright 2021 The Authors: Qingchao Shen, Haoyang Ma, Junjie Chen, Yongqiang Tian, Shing-Chi Cheung, Xiang Che
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''


from TVMfuzz.utils import varNameGenerator
from TVMfuzz.colors import *
from TVMfuzz.syntax import *
Expand Down
17 changes: 0 additions & 17 deletions TVMfuzz/colors.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
'''
Copyright 2021 The Authors: Qingchao Shen, Haoyang Ma, Junjie Chen, Yongqiang Tian, Shing-Chi Cheung, Xiang Che
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''




def Red(string):
Expand Down
22 changes: 0 additions & 22 deletions TVMfuzz/elements.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
'''
Copyright 2021 The Authors: Qingchao Shen, Haoyang Ma, Junjie Chen, Yongqiang Tian, Shing-Chi Cheung, Xiang Che
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''


'''ASTutils.py'''
varnamesRead = set()
Expand All @@ -22,26 +6,22 @@
'''generation.py'''

funcPool = {}
# funcNumber = {}
varPool = set()
withPool = set()
clsPool = {}
subsPool = {}
lazy = []
restAdjuncts = []
# recordedFunc = []

'''analyzeSyntax'''
importSet = set()
funcNameTopFunc = {}
# funcNames = set()
constants = set()
records = {}

id = 0

varTofuncst = {}
# funcDef = set()

varTowith = {}

Expand All @@ -68,8 +48,6 @@
'''getAST'''

helperFuncDef = {}
# helperStatDef = {}
# FuncDef_parent = set()
helperStatDef_global = []
helperStatDef_local = {}
funcDefParents = {}
Expand Down
Loading

0 comments on commit e9afb63

Please sign in to comment.