simulation of both the old trace format (PIN and Qemu) and the new VISA trace format now supported

This commit is contained in:
Om Sanjaykumar Patil Patil 2023-11-07 18:35:56 +05:30
parent fca8399d0f
commit 4af6b73406
9 changed files with 69 additions and 14 deletions

View File

@ -4,6 +4,7 @@ public class EmulatorConfig {
public static CommunicationType communicationType;
public static EmulatorType emulatorType;
public static boolean isVISATrace;
public static int maxThreadsForTraceCollection = 1024;
public static boolean storeExecutionTraceInAFile;

View File

@ -31,8 +31,13 @@ public class SystemConfig
Bus, Noc
}
public static int NUM_BENCHMARKS;
public static int NoOfCores;
public static String benchmarknames[]; // Number of benchmarks
public static String numCountThreads[];
public static int maxNumJavaThreads;
public static int numEmuThreadsPerJavaThread;

View File

@ -67,7 +67,7 @@ public class XMLParser
createSharedCacheConfigs();
setSimulationParameters();
setEmulatorParameters();
setBenchmarks();
setSystemParameters();
FrequencyConfig.setupStepSizes();
@ -205,6 +205,7 @@ public class XMLParser
EmulatorConfig.emulatorType = getEmulatorType(getImmediateString("EmulatorType", emulatorElmnt));
EmulatorConfig.communicationType = getCommunicationType(getImmediateString("CommunicationType", emulatorElmnt));
EmulatorConfig.isVISATrace = Boolean.parseBoolean(getImmediateString("isVISATrace", emulatorElmnt));
EmulatorConfig.PinTool = getImmediateString("PinTool", emulatorElmnt);
EmulatorConfig.PinInstrumentor = getImmediateString("PinInstrumentor", emulatorElmnt);
@ -1124,6 +1125,25 @@ public class XMLParser
return ((Node) resultNode.item(0)).getNodeValue();
}
private static void setBenchmarks() // Get the immediate string value of a particular tag name under a particular parent tag
{
NodeList nodeLst = doc.getElementsByTagName("Benchmark");
SystemConfig.NUM_BENCHMARKS=nodeLst.getLength();
SystemConfig.benchmarknames=new String[SystemConfig.NUM_BENCHMARKS];
SystemConfig.numCountThreads=new String[SystemConfig.NUM_BENCHMARKS];
for(int i=0; i< nodeLst.getLength();i++){
Node node = nodeLst.item(i);
System.out.println("");
if (node.getNodeType() == Node.ELEMENT_NODE)
{ Element eElement = (Element) node;
SystemConfig.benchmarknames[i]=eElement.getElementsByTagName("BenchmarkPath").item(0).getTextContent();
SystemConfig.numCountThreads[i]=eElement.getElementsByTagName("Threads").item(0).getTextContent();
}
}
}
private static PortType setPortType(String inputStr)
{
PortType result = null;

View File

@ -31,12 +31,13 @@ TDP = 15W
<!--Currently we support following (emulator,communication) combinations : -->
<!--(pin, sharedMemory), (qemu, sharedMemory), (qemu, network), (none, file)-->
<!--(pin,file) combination can be used to collect execution trace of an application in a compressed file-->
<EmulatorType>pin</EmulatorType> <!--pin,qemu-->
<EmulatorType>none</EmulatorType> <!--pin,qemu-->
<!--NOTE only file interface supports the execution of multiple benchmarks inside tejas-->
<!--if you are reading the packets from a file, the emulator must be set to none-->
<!--multiple benchmarks are specified using arguments to the simulator-->
<CommunicationType>sharedMemory</CommunicationType> <!--file,sharedMemory,network-->
<CommunicationType>file</CommunicationType> <!--file,sharedMemory,network-->
<isVISATrace>false</isVISATrace> <!-- If communication type is file, is it a VISA trace? -->
<!--We can use tejas as an interface to create a compressed (gzip) trace file using the emulator-->
<!--Set this option to true if you want to create a trace file of the benchmark execution-->
@ -84,6 +85,13 @@ TDP = 15W
<endSimMarker>sub</endSimMarker>
<NumCores>2</NumCores>
</Simulation>
<Applications> <!-- Applications (traces) to run -->
<Benchmark>
<BenchmarkPath>/store/Documents/B_Tech/Semester_7/ACA/Tejas-Dh/traces/qemuTrace/7zip</BenchmarkPath> <!-- Path to the benchmark traces -->
<Threads>2</Threads> <!-- Number of threads for the trace -->
</Benchmark>
</Applications>
<!--System Parameters-->
<System>
@ -477,7 +485,7 @@ TDP = 15W
<Interconnect>NOC</Interconnect>
<NOC>
<NocConfigFile>/nfs_home/rajshekar/resources/tejas_configs/config_2core_kabylake_NocConfig.txt</NocConfigFile>
<NocConfigFile>/store/Documents/B_Tech/Semester_7/ACA/Assignments/Assignment_4/NocConfig.txt</NocConfigFile>
<NocSelScheme>STATIC</NocSelScheme>
<NocNumberOfBuffers>4</NocNumberOfBuffers>
<NocPortType>FCFS</NocPortType>

View File

@ -116,7 +116,7 @@ public class RunnableThread implements Encoding, Runnable {
public void run() {
if (EmulatorConfig.emulatorType == EmulatorType.none
&& EmulatorConfig.communicationType == CommunicationType.file) {
&& EmulatorConfig.communicationType == CommunicationType.file && EmulatorConfig.isVISATrace) {
//trace-file based simulation
// for(int core = 0; core < maxCoreAssign; core++)

View File

@ -34,9 +34,9 @@ public class FilePacket extends IpcBase implements Encoding {
ArrayList<Integer> pinpointWeights;
int cur_slice = 0;
String []basenameForBenchmarks;
int count[]=new int[SystemConfig.NUM_BENCHMARKS];
public FilePacket(String []basenameForBenchmarks) {
/*
this.maxApplicationThreads = SystemConfig.maxNumJavaThreads*SystemConfig.numEmuThreadsPerJavaThread;
this.basenameForBenchmarks = basenameForBenchmarks;
@ -60,10 +60,14 @@ public class FilePacket extends IpcBase implements Encoding {
misc.Error.showErrorAndExit(e.getMessage());
}
}
for(int i=0;i< SystemConfig.NUM_BENCHMARKS;i++){
count[i]=Integer.parseInt(SystemConfig.numCountThreads[i]);
}
int numTotalThreads = 0;
for (int benchmark=0; benchmark<basenameForBenchmarks.length; benchmark++) {
for (int tid=0; ;tid++) {
for (int tid=0;tid<count[benchmark];tid++) {
String inputFileName;
if(SimulationConfig.pinpointsSimulation == false)
{
@ -96,7 +100,6 @@ public class FilePacket extends IpcBase implements Encoding {
}
}
}
*/
}
public void initIpc() {
@ -104,7 +107,7 @@ public class FilePacket extends IpcBase implements Encoding {
}
public int fetchManyPackets(int tidApp, CircularPacketQueue fromEmulator) {
/*
if(tidApp>=maxApplicationThreads) {
misc.Error.showErrorAndExit("FilePacket cannot handle tid = " + tidApp);
}
@ -206,8 +209,6 @@ public class FilePacket extends IpcBase implements Encoding {
}
return maxSize;
*/
return 0;
}
public void errorCheck(int tidApp, long totalReads) {

View File

@ -857,7 +857,7 @@ public class InstructionClassTable {
//unhandled x86 instruction type
if(instructionClass == null && operation.compareTo("ud2") != 0)
System.out.println(operation);
System.out.println("[x86 Translator] Unhandled instruction type encountered: " +operation);
if (instructionClass == null)
return InstructionClass.INVALID;

View File

@ -529,8 +529,15 @@ public class ObjParser
assemblyTokens[0] = str;
currentPointer = indexOf(asmBytes, ' ', previousPointer, 64);
assemblyTokens[1] = new String(asmBytes, previousPointer, (currentPointer-previousPointer));
currentPointer++; previousPointer = currentPointer;
if(currentPointer==-1) {
assemblyTokens[1] = new String(asmBytes, previousPointer, len(asmBytes)-previousPointer); // only operation field is present
assemblyTokens[2] = assemblyTokens[3] = assemblyTokens[4] = null;
return assemblyTokens;
}
else {
assemblyTokens[1] = new String(asmBytes, previousPointer, (currentPointer-previousPointer));
currentPointer++; previousPointer = currentPointer;
}
} else {
assemblyTokens[0] = null;
assemblyTokens[1] = str;

View File

@ -92,7 +92,20 @@ public class Main {
} /*else if(EmulatorConfig.emulatorType==EmulatorType.none) {
ObjParser.initializeThreadMicroOpsList(SystemConfig.numEmuThreadsPerJavaThread);
}*/
else{
executableAndArguments = new String[SystemConfig.NUM_BENCHMARKS];
for(int i=0;i<SystemConfig.NUM_BENCHMARKS;i++){
executableAndArguments[i]=SystemConfig.benchmarknames[i];
}
for(int i=2; i < arguments.length; i++) {
executableAndArguments[i-2] = arguments[i];
benchmarkArguments = benchmarkArguments + " " + arguments[i];
}
}
ObjParser.initializeThreadMicroOpsList(SystemConfig.numEmuThreadsPerJavaThread);
ObjParser.initializeDynamicInstructionBuffer(SystemConfig.numEmuThreadsPerJavaThread*SystemConfig.numEmuThreadsPerJavaThread);
ObjParser.initializeControlMicroOps();