A fuzzer for tensor-level intermediate representation(TIR) expressions in TVM created by David Pankratz for Secure Software Engineering Winter 2019 at the University of Alberta.
TIR is user-facing as it can be used in tasks such as implementing custom neural network operators or implementing existing operators using custom hardware instructions. TIR and its infrastructure is also used by TVM in the process of lowering from the Relay IR level to machine instruction level. Thus, fixing bugs in TIR is significant in improving the usability and correctness of TVM as a whole.
This section describes the layout of this repository:
- bugs contains bugs that were discovered by the TVMFuzz and fixed in TVM
- docs contains documentation of the design of TVMFuzz
- docker contains dockerfile and local build instructions
- settings contains the settings for TVMFuzz
- src contains the python source for TVMFuzz
- quicktests contains example of quicktest script for mismatches investigation
To invoke the fuzzer simply run python3 tvmfuzz.py
. This will generate a random GenerationNode
tree which is capable of producing TVM and ground-truth programs.
To generate multiple instances use the --R N
argument such as python3 tvmfuzz.py --R 1000
to generate 1000 instances.
See this article for more information about the output of the fuzzer.
- Follow the
automatic installation script
instructions for LLVM here. For example LLVM 8 - Follow TVM installation guide
- In the
config.cmake
file changeset(USE_LLVM OFF)
toset(USE_LLVM /usr/bin/llvm-config-8)
- Clone this repository
- Run
pip3 install --user termcolor
- Test the installation by running
python3 tvmfuzz.py
If this is not amenable then a dockerfile and VM image are available.
To create locally:
cd docker/
make build
docker run -it tvmfuzz
Then the Installation can be tested via python3 tvmfuzz.py
To use remote image:
docker pull dpankratz/tvmfuzz
docker run -it dpankratz/tvmfuzz
Due to TVM periodically having breaking changes, TVMFuzz also includes a Ubuntu VM image that contains compatible versions of TVMFuzz, TVM, and LLVM.
To use this option:
- install virtualbox
- import VM
cd tvmfuzz/src/
python3 tvmfuzz.py