Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions Code/YOURCODEHERE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ std::string generateCacheLatencyParams(string halfBackedConfig) {
L2_lat_dm = log2(L2Size);

//border detection
/*
if(L1dSize<2 || L1dSize>64)
return "0 0 0";

if(L1iSize<2 || L1iSize>64)
return "0 0 0";

if(L2Size<32 || L2Size>1024)
return "0 0 0";

*/
if (token[4] ==1) {

L1d_lat_dm +=1;
Expand Down Expand Up @@ -138,7 +137,6 @@ std::string generateCacheLatencyParams(string halfBackedConfig) {
cout<<L1d_lat_dm<<endl;
cout<< L1i_lat_dm<<endl;
cout<<L2_lat_dm<<endl;

*/
// This is a dumb implementation.
//latencySettings = "1 1 1";
Expand All @@ -153,6 +151,19 @@ std::string generateCacheLatencyParams(string halfBackedConfig) {
L1d_lat_dm = L1d_lat_dm -1;
L1i_lat_dm = L1i_lat_dm -1;
L2_lat_dm = L2_lat_dm-5;

//
//this is for invalid setting
//
if (L1d_lat_dm==-1){
L1d_lat_dm =0;
}
if (L1i_lat_dm ==-1){
L1i_lat_dm=0;
}
if (L2_lat_dm ==-1){
L2_lat_dm=0;
}
// cout<<L1d_lat_dm<<endl;
// cout<<L1i_lat_dm<<endl;
// cout<<L2_lat_dm<<endl;
Expand Down Expand Up @@ -207,7 +218,7 @@ int validateConfiguration(std::string configuration) {
// } else {
// return 0;
// }
// cout << width << " " << L1iblockSize << endl;
// cout << width << " " << L1iblockSize << " " << L1dblockSize << " " <<L1iSize << " "<< L1dSize << " "<<L2Size << endl;
if(width <= L1dblockSize){
valid++;
// cout << "valid 1 ";
Expand All @@ -226,17 +237,22 @@ int validateConfiguration(std::string configuration) {
}
if(L2Size >= 32 && L2Size <= 1024){
valid++;
// cout << "valid 5 " <<endl;
// cout << "valid 5 " ;
}

if (L2Size >= 2 * (L1iSize+L1dSize)){
valid++;
// cout << "valid 6 " <<endl;
// cout << "valid 6 " ;
}

if(L1dSize >= 2 && L1dSize <= 64){
valid++;
// cout << "valid 7 " << endl;
}

//valid return 1 invalid return 0

if (valid != 6){
if (valid != 7){

return 0;
}
Expand Down Expand Up @@ -406,14 +422,14 @@ std::string generateNextConfigurationProposal(std::string currentconfiguration,
currentDimIndex = 0;
currentlyExploringDim = EXPLORE[currentDimIndex];
firstBest = true;
nextconfiguration = bestConfig;
currentconfiguration = bestConfig;
// cout << "first best set true" << endl;
}
}
cout << nextconfiguration <<endl;
// cout << nextconfiguration <<endl;
// cout << !validateConfiguration(nextconfiguration) <<" " <<GLOB_seen_configurations[nextconfiguration] <<endl;
}

return nextconfiguration;
}


}