2022-04-19 10:56:42 +02:00
|
|
|
# RTSA-lab01-CacheAnalysis
|
|
|
|
|
|
|
|
In this lab session you will learn how to implement a LRU cache in abstract representation.
|
|
|
|
The Goal is to implement an LRU must Join in include/AbstractState.h
|
|
|
|
The Project can build, tested and Evaluated with the Helper Script.
|
|
|
|
|
2022-04-19 11:13:19 +02:00
|
|
|
## Disclaimer
|
2022-04-19 10:56:42 +02:00
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
This is the first time we provide this exercise.
|
2022-04-19 10:56:42 +02:00
|
|
|
Should you encounter something you think is a Bug, please let me know, during lab sessions.
|
|
|
|
|
|
|
|
Also keep track of the Repository as I may add more features to the script.
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
We recommend using docker and VS Code for setup.
|
|
|
|
If this is not your preferred Setup, take a look in the Docker file for the dependencies.
|
|
|
|
|
|
|
|
Also we do not support the usage of Windows, Linux is free of charge so get a copy.
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
### Setting Docker up
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
1.) install docker and VS Code on your Distribution.
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
<https://docs.docker.com/get-docker/>
|
2022-04-19 10:56:42 +02:00
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
<https://code.visualstudio.com/>
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
For this setup you cannot use the OSS version of VS code or the version from Snap, as the remote development extensions will not work.
|
|
|
|
|
|
|
|
2.) We recommend you install the following extensions in vs code
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
clangd,
|
|
|
|
CodeLLDB,
|
|
|
|
Docker and
|
2022-04-19 10:56:42 +02:00
|
|
|
Remote Development
|
|
|
|
|
|
|
|
3.) Use the helper script to build and run a Container
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
./helper.sh docker
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
This will build a docker image and run a Docker container with the current directory mounted.
|
|
|
|
|
|
|
|
4.) Attach VS Code to the container, in the Docker Tab, and start developing
|
|
|
|
|
|
|
|
## Debugging
|
|
|
|
|
|
|
|
When you are using VS Code you can simply use the Debugging Tab, we prepared a debug script for you.
|
2022-04-19 11:13:19 +02:00
|
|
|
You can also set the following variables in the CacheAnalysisPass/CacheAnalysisPass.cpp file, for more output:
|
|
|
|
|
|
|
|
```cpp
|
|
|
|
// Development Options
|
|
|
|
bool PrintAddresses = false;
|
|
|
|
bool PrintEdges = false;
|
|
|
|
bool PrintEdgesPost = false;
|
|
|
|
bool DumpToDot = false;
|
|
|
|
bool DumpNodes = false;
|
|
|
|
```
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
## Use the Helper script
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
### Initial Setup
|
2022-04-19 10:56:42 +02:00
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
./helper.sh all
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
To get a list of what the helper script can do simply type
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
./helper.sh
|
|
|
|
|
|
|
|
### Run
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
Run the pass on a single test.
|
|
|
|
fft1 is recommended during development.
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
./helper.sh run fft1
|
|
|
|
|
|
|
|
### Eval
|
2022-04-19 10:56:42 +02:00
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
Runs the Pass on a set of tests and also prints the expected results.
|
2022-04-19 10:56:42 +02:00
|
|
|
This will be used to measure correctness of you implementation.
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
./helper.sh eval
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
## Use the Terminal (Obsolete if script is used)
|
|
|
|
|
|
|
|
This section is not needed, fi you are using the script but for the sake of completeness it is provided anyways.
|
|
|
|
|
|
|
|
Initial Setup:
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake -DLT_LLVM_INSTALL_DIR=$LLVM_DIR ../CacheAnalysisPass/
|
|
|
|
make
|
|
|
|
cd ..
|
2022-04-19 10:56:42 +02:00
|
|
|
|
|
|
|
Run:
|
|
|
|
|
2022-04-20 09:55:54 +02:00
|
|
|
opt -load-pass-plugin build/libCacheAnalysisPass.so -passes=lru-misses test/crc.ll
|