Simnet is a machine learning based hardware simulator to predict the latency of instructions.
1. Python
2. Pytorch
3. CUDA (for GPU support)
4. Libtorch
dp:
contains scripts for data pre-processing and running the simulator.
ml: contains scripts for machine learning training & testing
sim: contains scripts for building the simulator.
data: link to the data folder
Each folder contains the instruction.
SimNet requires instruction traces from gem5 for training and simulation. The modified gem5 can be downloaded using
git clone -b simnet https://github.com/lingda-li/gem5.git
It generates a full instruction trace and a store queue trace when simulating a program execution.
The first step is to train a model which can predict latency of a given instruction.
Follow the instructions in section 1 (Preprocessing training data) dp
folder to prepare the training data.
- Generate a.qq:
./dp/buildQ a.txt a.sq.txt
- Deduplicate qq file:
python dp/1_unique.py a.qq
- Make npy file:
python dp/2_Q-to-mmap.py --total-rows=<entry num> a.qqu
Follow the instructions inside the ml
folder for training the model. The trained module would be used by simulator.
Follow the instruction in sim
folder to build the simulator.
For running the simulator, we nedd to first process the instruction trace from gem5 to the simulator format. Follow the instructions in section 2 (Building simulator input) dp
folder for processing input for simulator.
Place all the required files and simulator
file build in step 2 in the same directory.
Note: Use the model converted to the libtorch version.
./simulator_qq <trace> <aux trace> <lat module> <class module> <variances (optional)>
or
./simulator_qq <trace> <aux trace> <lat module> <variances (optional)>
Change log: 050820: Init the repo. 051420: Fix the simulator bug that didn't generate context instruction relationship at runtime. 082820, v1.0: a stable version that works with datasets from O3CPU output that includes instruction, register, data access, instruction access, and page table walking information.