Joining until state converges. Added Eval Again.
This commit is contained in:
parent
5e6e0e6c90
commit
693ee07008
|
@ -7,5 +7,6 @@ build/
|
||||||
.gnupg
|
.gnupg
|
||||||
.bash_history
|
.bash_history
|
||||||
.cache/
|
.cache/
|
||||||
|
*.solution
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
llvm/
|
llvm/
|
|
@ -232,6 +232,7 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
if(LoopUnrolling)
|
if(LoopUnrolling)
|
||||||
AC.unrollLoops();
|
AC.unrollLoops();
|
||||||
AC.fillAbstractCache(EntryAddress);
|
AC.fillAbstractCache(EntryAddress);
|
||||||
|
//AC.fillPath(EntryAddress);
|
||||||
if (DumpNodes)
|
if (DumpNodes)
|
||||||
AC.dumpNodes();
|
AC.dumpNodes();
|
||||||
if (PrintEdgesPost)
|
if (PrintEdgesPost)
|
||||||
|
@ -239,7 +240,7 @@ struct CacheAnalysisPass : PassInfoMixin<CacheAnalysisPass> {
|
||||||
if (DumpToDot)
|
if (DumpToDot)
|
||||||
AC.dumpDotFile();
|
AC.dumpDotFile();
|
||||||
outs() << "MustHits: " << AC.collectHits() << "\n";
|
outs() << "MustHits: " << AC.collectHits() << "\n";
|
||||||
outs() << "MayMisses: " << AC.collectMisses() << "\n";
|
//outs() << "MayMisses: " << AC.collectMisses() << "\n";
|
||||||
return PreservedAnalyses::all();
|
return PreservedAnalyses::all();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
27
helper.sh
27
helper.sh
|
@ -111,38 +111,29 @@ case $1 in
|
||||||
docker run -i -d -v "$(pwd)"/.:/root:rw --name RTSAlab01 rtsalab01cacheanalysis
|
docker run -i -d -v "$(pwd)"/.:/root:rw --name RTSAlab01 rtsalab01cacheanalysis
|
||||||
;;
|
;;
|
||||||
evaluation | eval)
|
evaluation | eval)
|
||||||
echo "Currently not available!"
|
|
||||||
echo "But please continue to implement the must join,"
|
|
||||||
echo "to the best of your abilities and check for updates!"
|
|
||||||
run "fft1"
|
run "fft1"
|
||||||
echo "==== Correct fft1 ===="
|
echo "==== Correct fft1 ===="
|
||||||
echo "MustHits: 16"
|
echo "MustHits: 21"
|
||||||
echo "MayMisses: 280"
|
|
||||||
echo
|
echo
|
||||||
run "cnt"
|
run "cnt"
|
||||||
echo "==== Correct cnt ===="
|
echo "==== Correct cnt ===="
|
||||||
echo "MustHits: x"
|
echo "MustHits: 4"
|
||||||
echo "MayMisses: xx"
|
|
||||||
echo
|
|
||||||
run "crc"
|
|
||||||
echo "==== Correct crc ===="
|
|
||||||
echo "MustHits: x"
|
|
||||||
echo "MayMisses: xx"
|
|
||||||
echo
|
echo
|
||||||
run "duff"
|
run "duff"
|
||||||
echo "==== Correct duff ===="
|
echo "==== Correct duff ===="
|
||||||
echo "MustHits: x"
|
echo "MustHits: 3"
|
||||||
echo "MayMisses: xx"
|
|
||||||
echo
|
echo
|
||||||
run "insertsort"
|
run "insertsort"
|
||||||
echo "==== Correct insertsort ===="
|
echo "==== Correct insertsort ===="
|
||||||
echo "MustHits: x"
|
echo "MustHits: 2"
|
||||||
echo "MayMisses: xx"
|
|
||||||
echo
|
echo
|
||||||
run "matmult"
|
run "matmult"
|
||||||
echo "==== Correct matmult ===="
|
echo "==== Correct matmult ===="
|
||||||
echo "MustHits: x"
|
echo "MustHits: 9"
|
||||||
echo "MayMisses: x"
|
echo
|
||||||
|
run "crc"
|
||||||
|
echo "==== Correct crc ===="
|
||||||
|
echo "MustHits: 6"
|
||||||
echo
|
echo
|
||||||
;;
|
;;
|
||||||
a | all)
|
a | all)
|
||||||
|
|
|
@ -47,9 +47,9 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add an Edge to the AbstractStateGraph
|
* @brief Add an Edge to the AbstractStateGraph
|
||||||
*
|
*
|
||||||
* @param Pre
|
* @param Pre
|
||||||
* @param Suc
|
* @param Suc
|
||||||
*/
|
*/
|
||||||
void removeEdge(unsigned int Pre, unsigned int Suc) {
|
void removeEdge(unsigned int Pre, unsigned int Suc) {
|
||||||
Edges[Pre].remove(Suc);
|
Edges[Pre].remove(Suc);
|
||||||
|
@ -59,9 +59,9 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add an Empty node @NodeAddr
|
* @brief Add an Empty node @NodeAddr
|
||||||
*
|
*
|
||||||
* @param NodeAddr
|
* @param NodeAddr
|
||||||
* @return unsigned int
|
* @return unsigned int
|
||||||
*/
|
*/
|
||||||
unsigned int addEmptyNode(unsigned int NodeAddr) {
|
unsigned int addEmptyNode(unsigned int NodeAddr) {
|
||||||
int I = Nodes.size();
|
int I = Nodes.size();
|
||||||
|
@ -71,11 +71,11 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns True if a path From -> To exists.
|
* @brief Returns True if a path From -> To exists.
|
||||||
*
|
*
|
||||||
* @param From
|
* @param From
|
||||||
* @param To
|
* @param To
|
||||||
* @return true
|
* @return true
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool findPath(unsigned int From, unsigned int To) {
|
bool findPath(unsigned int From, unsigned int To) {
|
||||||
std::map<unsigned int, bool> Visited;
|
std::map<unsigned int, bool> Visited;
|
||||||
|
@ -97,9 +97,9 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Removes all Nested loops from the handed LoopBody
|
* @brief Removes all Nested loops from the handed LoopBody
|
||||||
*
|
*
|
||||||
* @param LoopBodyIn
|
* @param LoopBodyIn
|
||||||
* @param OrigNodeToUnrolledNode
|
* @param OrigNodeToUnrolledNode
|
||||||
*/
|
*/
|
||||||
void removeNestedLoops(
|
void removeNestedLoops(
|
||||||
std::list<unsigned int> LoopBodyIn,
|
std::list<unsigned int> LoopBodyIn,
|
||||||
|
@ -338,11 +338,16 @@ public: // everything is public, because IDGAF
|
||||||
Nodes[NodeNr].Computed = true;
|
Nodes[NodeNr].Computed = true;
|
||||||
for (unsigned int SuccNr : Nodes[NodeNr].Successors) {
|
for (unsigned int SuccNr : Nodes[NodeNr].Successors) {
|
||||||
Nodes[SuccNr];
|
Nodes[SuccNr];
|
||||||
|
// first Run
|
||||||
if (Nodes[SuccNr].Computed) {
|
if (Nodes[SuccNr].Computed) {
|
||||||
// Join don't call
|
// Join don't call
|
||||||
// TODO fix Join
|
AbstractState Before(Nodes[SuccNr]);
|
||||||
Nodes[SuccNr].mustJoin(Nodes[NodeNr]); // maybe fill
|
Nodes[SuccNr].mustJoin(AbstractState(NodeNr, Address(NodeNr)));
|
||||||
Nodes[SuccNr].mustJoin(AbstractState(NodeNr));
|
|
||||||
|
// Continue Joining until State converges
|
||||||
|
if (!(Before == Nodes[SuccNr])) {
|
||||||
|
fillAbstractCache(NodeNr);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Update and fill Succ
|
// Update and fill Succ
|
||||||
Nodes[SuccNr].fill(Nodes[NodeNr], NodeNr);
|
Nodes[SuccNr].fill(Nodes[NodeNr], NodeNr);
|
||||||
|
@ -354,8 +359,8 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return number of measured Hits
|
* @brief Return number of measured Hits
|
||||||
*
|
*
|
||||||
* @return unsigned int
|
* @return unsigned int
|
||||||
*/
|
*/
|
||||||
unsigned int collectHits() {
|
unsigned int collectHits() {
|
||||||
unsigned int Hits = 0;
|
unsigned int Hits = 0;
|
||||||
|
@ -371,8 +376,8 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return number of measured Misses
|
* @brief Return number of measured Misses
|
||||||
*
|
*
|
||||||
* @return unsigned int
|
* @return unsigned int
|
||||||
*/
|
*/
|
||||||
unsigned int collectMisses() {
|
unsigned int collectMisses() {
|
||||||
unsigned int Misses = 0;
|
unsigned int Misses = 0;
|
||||||
|
@ -388,7 +393,7 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints all Edges to Console
|
* @brief Prints all Edges to Console
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void dumpEdges() {
|
void dumpEdges() {
|
||||||
llvm::outs() << "Dumping Edges:\n";
|
llvm::outs() << "Dumping Edges:\n";
|
||||||
|
@ -409,7 +414,7 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Dumps the Graph to a out.dot file
|
* @brief Dumps the Graph to a out.dot file
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void dumpDotFile() {
|
void dumpDotFile() {
|
||||||
bool PrintOld = true;
|
bool PrintOld = true;
|
||||||
|
@ -437,7 +442,7 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Prints all nodes to Console
|
* @brief Prints all nodes to Console
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void dumpNodes() {
|
void dumpNodes() {
|
||||||
for (auto const &E : Edges) {
|
for (auto const &E : Edges) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef ABSSTATE_H
|
#ifndef ABSSTATE_H
|
||||||
#define ABSSTATE_H
|
#define ABSSTATE_H
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -71,6 +72,21 @@ public: // everything is public, because IDGAF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractState(AbstractState const &Copy, Address Update) {
|
||||||
|
Addr = Copy.Addr;
|
||||||
|
Unrolled = Copy.Unrolled;
|
||||||
|
for (auto S : Copy.Sets) {
|
||||||
|
unsigned int SetNr = S.first;
|
||||||
|
for (auto E : S.second.Associativity) {
|
||||||
|
unsigned int Age = E.first;
|
||||||
|
for (auto B : E.second.Blocks) {
|
||||||
|
Sets[SetNr].Associativity[Age].Blocks.push_back(B);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->update(Update);
|
||||||
|
}
|
||||||
|
|
||||||
AbstractState() {}
|
AbstractState() {}
|
||||||
|
|
||||||
AbstractState(unsigned int AddressIn) {
|
AbstractState(unsigned int AddressIn) {
|
||||||
|
@ -89,6 +105,30 @@ public: // everything is public, because IDGAF
|
||||||
|
|
||||||
void setUnrolled(unsigned int In) { Unrolled = In; }
|
void setUnrolled(unsigned int In) { Unrolled = In; }
|
||||||
|
|
||||||
|
bool operator==(AbstractState In) {
|
||||||
|
for (int Index; Index < 16; Index++) {
|
||||||
|
for (int Age; Age < 4; Age++) {
|
||||||
|
for (auto E1 : Sets[Index].Associativity[Age].Blocks) {
|
||||||
|
// find E1 in In States Set and Age.
|
||||||
|
if (std::find(In.Sets[Index].Associativity[Age].Blocks.begin(),
|
||||||
|
In.Sets[Index].Associativity[Age].Blocks.end(),
|
||||||
|
E1) == In.Sets[Index].Associativity[Age].Blocks.end()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto E2 : In.Sets[Index].Associativity[Age].Blocks) {
|
||||||
|
// find E2 in This Set and Age.
|
||||||
|
if (std::find(Sets[Index].Associativity[Age].Blocks.begin(),
|
||||||
|
Sets[Index].Associativity[Age].Blocks.end(),
|
||||||
|
E2) == Sets[Index].Associativity[Age].Blocks.end()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Executes an Must LRU Join on the AbstractCacheState
|
* @brief Executes an Must LRU Join on the AbstractCacheState
|
||||||
*
|
*
|
||||||
|
@ -127,31 +167,32 @@ public: // everything is public, because IDGAF
|
||||||
// This loopages all entries by one. 3 <-2, 2<-1, 1<-0
|
// This loopages all entries by one. 3 <-2, 2<-1, 1<-0
|
||||||
for (int I = 3; I > 0; I--) {
|
for (int I = 3; I > 0; I--) {
|
||||||
Sets[Addr.Index].Associativity[I] = Sets[Addr.Index].Associativity[I - 1];
|
Sets[Addr.Index].Associativity[I] = Sets[Addr.Index].Associativity[I - 1];
|
||||||
|
Sets[Addr.Index].Associativity[I].Blocks.remove(Addr.Tag);
|
||||||
}
|
}
|
||||||
// entry at age 0 is updated with current address.
|
// entry at age 0 is updated with current address.
|
||||||
Sets[Addr.Index].Associativity[0].Blocks = {Addr.Tag};
|
Sets[Addr.Index].Associativity[0].Blocks = {Addr.Tag};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* @brief Updates the AbstractState with given AbstractState
|
// * @brief Updates the AbstractState with given AbstractState
|
||||||
*
|
// *
|
||||||
* @param UpdateState, State that gets merged into State with Age+1.
|
// * @param UpdateState, State that gets merged into State with Age+1.
|
||||||
*/
|
// */
|
||||||
void update(AbstractState UpdateState) {
|
// void update(AbstractState UpdateState) {
|
||||||
for (auto S : UpdateState.Sets) {
|
// for (auto S : UpdateState.Sets) {
|
||||||
unsigned int Index = S.first;
|
// unsigned int Index = S.first;
|
||||||
for (auto E : S.second.Associativity) {
|
// for (auto E : S.second.Associativity) {
|
||||||
unsigned int Age = E.first;
|
// unsigned int Age = E.first;
|
||||||
// If updated age is greater 4 The Tag is no longer in Cache.
|
// // If updated age is greater 4 The Tag is no longer in Cache.
|
||||||
// Due to associativity of 4 per set.
|
// // Due to associativity of 4 per set.
|
||||||
if (Age >= 4)
|
// if (Age >= 4)
|
||||||
break;
|
// break;
|
||||||
for (auto B : E.second.Blocks) {
|
// for (auto B : E.second.Blocks) {
|
||||||
Sets[Index].Associativity[Age].Blocks.push_back(B);
|
// Sets[Index].Associativity[Age].Blocks.push_back(B);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fills the AbstractState PreState and updates with PreAddress.
|
* @brief Fills the AbstractState PreState and updates with PreAddress.
|
||||||
|
|
|
@ -145,49 +145,30 @@ case $1 in
|
||||||
docker run -i -d -v "$(pwd)"/.:/root:rw --name RTSAlab01 rtsalab01cacheanalysis
|
docker run -i -d -v "$(pwd)"/.:/root:rw --name RTSAlab01 rtsalab01cacheanalysis
|
||||||
;;
|
;;
|
||||||
evaluation | eval)
|
evaluation | eval)
|
||||||
echo "Currently not available!"
|
run "fft1"
|
||||||
echo "But please continue to implement the must join,"
|
echo "==== Correct fft1 ===="
|
||||||
echo "to the best of your abilities and check for updates!"
|
echo "MustHits: 21"
|
||||||
# run "fft1"
|
echo
|
||||||
# echo "==== Correct fft1 ===="
|
run "cnt"
|
||||||
# echo "MustHits: 16"
|
echo "==== Correct cnt ===="
|
||||||
# echo "MayMisses: 280"
|
echo "MustHits: 4"
|
||||||
# echo
|
echo
|
||||||
# run "bsort100"
|
run "duff"
|
||||||
# echo "==== Correct bsort100 ===="
|
echo "==== Correct duff ===="
|
||||||
# echo "MustHits: 1"
|
echo "MustHits: 3"
|
||||||
# echo "MayMisses: 41"
|
echo
|
||||||
# echo
|
run "insertsort"
|
||||||
# run "lms"
|
echo "==== Correct insertsort ===="
|
||||||
# echo "==== Correct lms ===="
|
echo "MustHits: 2"
|
||||||
# echo "MustHits: 5"
|
echo
|
||||||
# echo "MayMisses: 288"
|
run "matmult"
|
||||||
# echo
|
echo "==== Correct matmult ===="
|
||||||
# run "minver"
|
echo "MustHits: 9"
|
||||||
# echo "==== Correct minver ===="
|
echo
|
||||||
# echo "MustHits: 6"
|
run "crc"
|
||||||
# echo "MayMisses: 224"
|
echo "==== Correct crc ===="
|
||||||
# echo
|
echo "MustHits: 6"
|
||||||
# run "qsort-exam"
|
echo
|
||||||
# echo "==== Correct qsort-exam ===="
|
|
||||||
# echo "MustHits: 2"
|
|
||||||
# echo "MayMisses: 152"
|
|
||||||
# echo
|
|
||||||
# run "recursion"
|
|
||||||
# echo "==== Correct recursion ===="
|
|
||||||
# echo "MustHits: 8"
|
|
||||||
# echo "MayMisses: 8"
|
|
||||||
# echo
|
|
||||||
# run "select"
|
|
||||||
# echo "==== Correct select ===="
|
|
||||||
# echo "MustHits: 4"
|
|
||||||
# echo "MayMisses: 108"
|
|
||||||
# echo
|
|
||||||
# run "whet"
|
|
||||||
# echo "==== Correct whet ===="
|
|
||||||
# echo "MustHits: 5"
|
|
||||||
# echo "MayMisses: 265"
|
|
||||||
# echo
|
|
||||||
;;
|
;;
|
||||||
a | all)
|
a | all)
|
||||||
clean
|
clean
|
||||||
|
|
Loading…
Reference in New Issue