diff --git a/src/emulator/pin/causalityTool.cpp b/src/emulator/pin/causalityTool.cpp index 72d9b58..6c707dd 100755 --- a/src/emulator/pin/causalityTool.cpp +++ b/src/emulator/pin/causalityTool.cpp @@ -505,7 +505,7 @@ VOID BarrierInit(ADDRINT first_arg, ADDRINT val, UINT32 encode, THREADID tid) { } } /*** This function is called on every instruction ***/ -VOID printip(THREADID tid, VOID *ip, char *asmString) { +VOID printip(THREADID tid, VOID *ip, char *asmString, bool predicateInsnNotExecuted) { if(outOfROIPhase) { @@ -612,8 +612,17 @@ VOID printip(THREADID tid, VOID *ip, char *asmString) { uint64_t nip = MASK & (uint64_t) ip; if(traceMethod==SharedMemory) { - while (tst->analysisFn(tid, nip, INSTRUCTION, 1) == -1) { - PIN_Yield(); + if(predicateInsnNotExecuted) + { + while (tst->analysisFn(tid, nip, PREDICATE_INSN_NOT_EXECUTED, 1) == -1) { + PIN_Yield(); + } + } + else + { + while (tst->analysisFn(tid, nip, INSTRUCTION, 1) == -1) { + PIN_Yield(); + } } } else if(traceMethod==File) { while (tst->analysisFnAssembly(tid, nip, ASSEMBLY, asmString) == -1) { @@ -674,7 +683,7 @@ VOID Instruction(INS ins, VOID *v) { asmChar = (char *)asmString->c_str(); } - INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)printip, IARG_THREAD_ID, IARG_INST_PTR, IARG_PTR, asmChar, IARG_END); + INS_InsertCall(ins, IPOINT_BEFORE, (AFUNPTR)printip, IARG_THREAD_ID, IARG_INST_PTR, IARG_PTR, asmChar, IARG_EXECUTING, IARG_END); UINT32 memOperands = INS_MemoryOperandCount(ins); diff --git a/src/emulator/pin/encoding.h b/src/emulator/pin/encoding.h index e5bfa6a..c135bc3 100755 --- a/src/emulator/pin/encoding.h +++ b/src/emulator/pin/encoding.h @@ -31,5 +31,7 @@ #define PARENT_SPAWN 35 #define CHILD_START 36 +#define PREDICATE_INSN_NOT_EXECUTED 37 + const char* findType(int type); diff --git a/src/simulator/config/config.xml b/src/simulator/config/config.xml index a3e0ddf..ffa48bb 100755 --- a/src/simulator/config/config.xml +++ b/src/simulator/config/config.xml @@ -19,9 +19,11 @@ Contributors: Moksh Upadhyay, Abhishek Sagar, Prathmesh Kallurkar ***************************************************************************** -based on Intel® Core™ i7-7820X X-series Processor -TDP = 112W -52.5 mm x 45 mm +based on Intel® Core™ i5-7200U (Kabylake) Processor +https://en.wikichip.org/wiki/intel/core_i5/i5-7200u +https://www.agner.org/optimize/instruction_tables.pdf +TDP = 15W +42 mm * 24 mm /--> @@ -45,13 +47,14 @@ TDP = 112W - /home/prathmesh/tejasupdate/Tejas-dram/test/helloworld_trace + /home/rajshekar/tmp/gcc_trace /home/rajshekar/softwares/pin-97554/ - /home/rajshekar/projects/nvms/workspace/Tejas/src/emulator/pin/obj-pin/causalityTool.so + /home/rajshekar/projects/tejas/workspace/Tejas/src/emulator/pin/obj-pin/causalityTool.so TODO/home/prathmesh/workspace/qemu/x86_64-linux-user/qemu-x86_64 /home/prathmesh/tmp/testQemu.o - /home/rajshekar/projects/nvms/workspace/Tejas/src/emulator/pin/obj-comm - /home/rajshekar/projects/nvms/workspace/Tejas/src/simulator/main/killAllDescendents.sh + /home/rajshekar/resources/tejas_configs/ + /home/rajshekar_resources/tejas_configs/getBenchmarkPID.sh + /home/rajshekar/resources/tejas_configs/killAllDescendents.sh @@ -71,23 +74,23 @@ TDP = 112W false true false - true - /home/rajshekar/benchmarks/cpu2006/PinPoints/perlbench.ref.t.sorted - 0 - true - 1000000000 + false + /mnt/srishtistr0/scratch/rajshekar/tejas/PinPoints_working_directory/soplex.test.Data/t.sorted + 00000000 + false + 2000000 false - XXX_startInstrumentation - XXX_endInstrumentation - 8 + add + sub + 2 SIMPLE - 100 - 2100 + 132 + 2400 FCFS 1 1 @@ -104,8 +107,8 @@ TDP = 112W - 0-7 - 4200 + 0-1 + 2500 outOfOrder @@ -130,27 +133,38 @@ TDP = 112W - 128 + 128 1 - 10 - UL - -1 - -1 + -1 + UL + -1 + -1 0.00546275 0.06792852941 - 64 + 64 1 - 10 - UL - -1 - -1 + -1 + UL + -1 + -1 0.00546275 0.06792852941 + + 1536 + 9 + 17 + UL + -1 + -1 + 0.00546275 + 0.06792852941 + + 6 0.0598 @@ -188,7 +202,7 @@ TDP = 112W - 4 + 6 224 0.0058 0.0304 @@ -197,17 +211,17 @@ TDP = 112W 180 - 32 + 64 0.0108 0.0572 - - 144 - 32 + + 168 + 64 0.0075 0.0207 - + @@ -228,7 +242,7 @@ TDP = 112W 1 - 3 + 4 1 1 0.0271 @@ -237,8 +251,8 @@ TDP = 112W 1 - 21 - 12 + 50 + 50 0 0.0271 0.6514 @@ -264,8 +278,8 @@ TDP = 112W 1 - 24 - 12 + 14 + 4 0 0.0271 0.6514 @@ -273,7 +287,7 @@ TDP = 112W 3 - 3 + 1 1 0 1 @@ -284,7 +298,7 @@ TDP = 112W 2 - 3 + 5 1 0 1 @@ -294,7 +308,7 @@ TDP = 112W 0 - 3 + 1 1 0 1 @@ -305,7 +319,7 @@ TDP = 112W 0 - 3 + 5 1 0 1 @@ -315,24 +329,59 @@ TDP = 112W 2 - 4 - 4 - 4 - 4 - 4 - 4 - 3 - 3 - 3 - 3 - 3 - 3 + 4 + 1 0 1 0.0271 0.6514 + + 1 + 4 + 1 + 0 + 0.0271 + 0.6514 + + + + 1 + 9 + 5 + 0 + 0.0271 + 0.6514 + + + + 1 + 3 + 1 + 1 + 0.0271 + 0.6514 + + + + 1 + 1 + 1 + 5 + 0.0271 + 0.6514 + + + + 1 + 3 + 1 + 5 + 0.0271 + 0.6514 + + 2 1 @@ -343,16 +392,6 @@ TDP = 112W 0.6514 - - 2 - 1 - 1 - 2 - 3 - 0.0271 - 0.6514 - - 2 1 @@ -363,14 +402,15 @@ TDP = 112W 0.6514 - - 1 + + 2 1 1 - 4 + 2 + 3 0.0271 0.6514 - + 1 @@ -381,50 +421,14 @@ TDP = 112W 0.6514 - + 1 - 24 - 12 - 0 + 1 + 1 + 4 0.0271 0.6514 - - - - 1 - 24 - 12 - 0 - 0.0271 - 0.6514 - - - - 1 - 24 - 12 - 1 - 0.0271 - 0.6514 - - - - 1 - 24 - 12 - 5 - 0.0271 - 0.6514 - - - - 1 - 24 - 12 - 5 - 0.0271 - 0.6514 - + 0.0239 @@ -460,24 +464,24 @@ TDP = 112W - + - BUS + NOC - /home/rajshekar/projects/nvms/configurations/config_1052_8core_skylake_NocConfig.txt + /home/rajshekar/resources/tejas_configs/config_2core_kabylake_NocConfig.txt STATIC 4 FCFS 4 1 1 - 2000 + 2400 TORUS SIMPLE - 4 + 2 RR_ARBITER 90 ELECTRICAL @@ -539,7 +543,8 @@ TDP = 112W - 4200 + -1 + 4000 WB 64 8 @@ -547,306 +552,372 @@ TDP = 112W 3 3 UL - 0 - 0 - 1 - 1 - 1 - None - None - 1 - 16 - 0 - NONE - NONE - S - 0.1092 - 0.33964264705 - 0.33964264705 - Unified - + 0 + 0 + 1 + 1 + 1 + None + None + 1 + 16 + 0 + NONE + NONE + S + 0.1092 + 0.33964264705 + 0.33964264705 + Unified + - - 4200 - WB - 64 - 8 - 32768 - 4 - 4 - FCFS - 0 - 0 - 4 - 1 - 1 - None - None - 1 - 16 - 0 - NONE - NONE - S - 0.1092 - 0.33964264705 - 0.33964264705 - Instruction - + + -1 + 2500 + WB + 64 + 8 + 32768 + 4 + 4 + FCFS + 0 + 0 + 4 + 1 + 1 + None + Power4 + 1 + 16 + 0 + NONE + NONE + S + 0.1092 + 0.33964264705 + 0.33964264705 + Instruction + - - 4200 - WT - 64 - 8 - 32768 - 4 - 4 - UL - 0 - 0 - 2 - 1 - 1 - None - None - 1 - 16 - 0 - NONE - NONE - S - 0.1092 - 0.33964264705 - 0.33964264705 - Data - + + -1 + 2500 + WT + 64 + 8 + 32768 + 4 + 4 + FCFS + 1 + 1 + 0 + 1 + 2 + None + Power4 + 1 + 16 + 0 + NONE + NONE + S + 0.1092 + 0.33964264705 + 0.33964264705 + Data + - - WB - 64 - 8 - 262144 - 12 - 12 - FCFS - 0 - 0 - 1 - 1 - 1 - None - None - 1 - 256 - 0 - NONE - NONE - S - 0.1592 - 0.43964264705 - 0.43964264705 - Unified - + + -1 + WB + 64 + 8 + 262144 + 12 + 12 + FCFS + 0 + 0 + 1 + 1 + 1 + None + None + 1 + 256 + 0 + NONE + NONE + S + 0.1592 + 0.43964264705 + 0.43964264705 + Unified + - - 4200 - WB - 64 - 4 - 262144 - 12 - 12 - FCFS - 0 - 0 - 1 - 1 - 1 - D1 - Power4 - 1 - 256 - 0 - NONE - NONE - S - 0.1592 - 0.43964264705 - 0.43964264705 - Unified - + + -1 + 2500 + WB + 64 + 4 + 262144 + 12 + 12 + FCFS + 1 + 1 + 0 + 1 + 1 + None + Power4 + 1 + 256 + 0 + NONE + NONE + S + 0.1592 + 0.43964264705 + 0.43964264705 + Unified + - - 2000 - WB - 64 - 8 - 1048576 - 60 - 60 - UL - 0 - 0 - 1 - 1 - 1 - None - None - 1 - 8 - 0 - NONE - NONE - S - 0.1892 - 0.60964264705 - 0.60964264705 - Unified - + + -1 + WB + 64 + 16 + 1048576 + 12 + FCFS + 1 + 1 + 0 + 1 + 1 + D1 + Power4 + 1 + 256 + 0 + NONE + NONE + S + 0.1592 + 0.43964264705 + 0.43964264705 + Unified + - - 2000 - WB - 64 - 16 - 8388608 - 60 - 60 - UL - 0 - 0 - 1 - 5 - 5 - None - Power4 - 1 - 8 - 0 - NONE - NONE - S - 0.1892 - 0.60964264705 - 0.60964264705 - Unified - + + -1 + 2000 + WB + 64 + 8 + 1048576 + 60 + 60 + UL + 0 + 0 + 1 + 1 + 1 + None + None + 1 + 8 + 0 + NONE + NONE + S + 0.1892 + 0.60964264705 + 0.60964264705 + Unified + - - 2000 - WB - 64 - 16 - 12582912 - 60 - 60 - UL - 0 - 0 - 1 - 1 - 1 - None - None - 1 - 8 - 0 - NONE - NONE - S - 0.1892 - 0.60964264705 - 0.60964264705 - Unified - + + -1 + 4000 + WB + 64 + 16 + 8388608 + 77 + 77 + UL + 1 + 1 + 1 + 2 + 2 + None + Power4 + 1 + 8 + 0 + NONE + NONE + S + 0.1892 + 0.60964264705 + 0.60964264705 + Unified + - - 2000 - WB - 64 - 16 - 23068672 - 44 - 44 - UL - 0 - 0 - 1 - 1 - 1 - None - None - 1 - 8 - 0 - NONE - NONE - S - 0.1892 - 0.60964264705 - 0.60964264705 - Unified - + + -1 + 2500 + WB + 64 + 8 + 4194304 + 44 + 44 + UL + 1 + 1 + 1 + 2 + 2 + None + Power4 + 1 + 8 + 0 + NONE + NONE + S + 0.1892 + 0.60964264705 + 0.60964264705 + Unified + - - 2000 - WB - 64 - 16 - 16777216 - 44 - 44 - UL - 0 - 0 - 1 - 5 - 5 - None - None - 1 - 8 - 0 - NONE - NONE - S - 0.1892 - 0.60964264705 - 0.60964264705 - Unified - + + -1 + 2000 + WB + 64 + 16 + 12582912 + 60 + 60 + UL + 0 + 0 + 1 + 1 + 1 + None + None + 1 + 8 + 0 + NONE + NONE + S + 0.1892 + 0.60964264705 + 0.60964264705 + Unified + - - 2000 - WB - N - 64 - 64 - 65536 - 5 - 5 - FCFS - 0 - 0 - 2 - 1 - 1 - N - None - 1 - 16 - 0 - NONE - NONE - S - Unified - .1092 - .3396 - .3396 - true - Unified - + + -1 + 2000 + WB + 64 + 16 + 23068672 + 44 + 44 + UL + 0 + 0 + 1 + 1 + 1 + None + None + 1 + 8 + 0 + NONE + NONE + S + 0.1892 + 0.60964264705 + 0.60964264705 + Unified + + + + -1 + 2000 + WB + 64 + 16 + 16777216 + 44 + 44 + UL + 0 + 0 + 1 + 5 + 5 + None + None + 1 + 8 + 0 + NONE + NONE + S + 0.1892 + 0.60964264705 + 0.60964264705 + Unified + + + + -1 + 2400 + WB + N + 64 + 64 + 65536 + 5 + 5 + FCFS + 0 + 0 + 2 + 1 + 1 + N + None + 1 + 16 + 0 + NONE + NONE + S + Unified + .1092 + .3396 + .3396 + true + Unified + diff --git a/src/simulator/emulatorinterface/DynamicInstructionBuffer.java b/src/simulator/emulatorinterface/DynamicInstructionBuffer.java index f81788c..cfccfdd 100755 --- a/src/simulator/emulatorinterface/DynamicInstructionBuffer.java +++ b/src/simulator/emulatorinterface/DynamicInstructionBuffer.java @@ -44,6 +44,8 @@ public class DynamicInstructionBuffer implements Encoding private long ip; + private boolean predicateInsnNotExecuted; + public DynamicInstructionBuffer() { memRead = new long[64]; @@ -59,6 +61,8 @@ public class DynamicInstructionBuffer implements Encoding branchAddress = -1; + predicateInsnNotExecuted = false; + ip = arrayListPacket.get(0).ip; int numAssemblyPackets = 0; @@ -100,6 +104,10 @@ public class DynamicInstructionBuffer implements Encoding branchTaken = false; branchAddress = p.tgt; break; + + case (PREDICATE_INSN_NOT_EXECUTED): + predicateInsnNotExecuted = true; + break; case (ASSEMBLY): numAssemblyPackets++; @@ -190,4 +198,8 @@ public class DynamicInstructionBuffer implements Encoding boolean readAuthenticBranch = branchInformationRead==false && branchAddress!=-1; return readAuthenticBranch; } + + public boolean isPredicateInsnNotExecuted() { + return predicateInsnNotExecuted; + } } \ No newline at end of file diff --git a/src/simulator/emulatorinterface/RunnableThread.java b/src/simulator/emulatorinterface/RunnableThread.java index 5a718cd..abc07a2 100755 --- a/src/simulator/emulatorinterface/RunnableThread.java +++ b/src/simulator/emulatorinterface/RunnableThread.java @@ -204,6 +204,7 @@ public class RunnableThread implements Encoding, Runnable { iNew.setDestinationOperandMemValue(Long.parseLong(splited[i+2])); iNew.setBranchTargetAddress(Long.parseLong(splited[i+3])); iNew.setBranchTaken(Boolean.parseBoolean(splited[i+4])); + iNew.setPredicateAndNotExecuted(Boolean.parseBoolean(splited[i+7])); //iNew.setSerialNo(Long.parseLong(splited[i+6])); } } @@ -833,7 +834,7 @@ public class RunnableThread implements Encoding, Runnable { } - if (pnew.value!=INSTRUCTION && !(pnew.value>6 && pnew.value<26) && pnew.value!=Encoding.ASSEMBLY ) { + if (pnew.value!=INSTRUCTION && !(pnew.value>6 && pnew.value<26) && pnew.value!=Encoding.ASSEMBLY && pnew.value!=Encoding.PREDICATE_INSN_NOT_EXECUTED ) { // just append the packet to outstanding packetList for current instruction pointer thread.packetList.add(pnew); diff --git a/src/simulator/emulatorinterface/communication/Encoding.java b/src/simulator/emulatorinterface/communication/Encoding.java index 812a80b..7cda502 100755 --- a/src/simulator/emulatorinterface/communication/Encoding.java +++ b/src/simulator/emulatorinterface/communication/Encoding.java @@ -41,5 +41,7 @@ public interface Encoding { static final int CPL_SWITCH = 34; static final int PARENT_SPAWN = 35; static final int CHILD_START = 36; + + static final int PREDICATE_INSN_NOT_EXECUTED = 37; } diff --git a/src/simulator/emulatorinterface/translator/visaHandler/IntegerALU.java b/src/simulator/emulatorinterface/translator/visaHandler/IntegerALU.java index 1b0bde8..c489cbb 100755 --- a/src/simulator/emulatorinterface/translator/visaHandler/IntegerALU.java +++ b/src/simulator/emulatorinterface/translator/visaHandler/IntegerALU.java @@ -9,7 +9,7 @@ public class IntegerALU implements DynamicInstructionHandler public int handle(int microOpIndex, Instruction microOp, DynamicInstructionBuffer dynamicInstructionBuffer) { - //nothing to be done in such cases + microOp.setPredicateAndNotExecuted(dynamicInstructionBuffer.isPredicateInsnNotExecuted()); return ++microOpIndex; } } diff --git a/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalMove.java b/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalMove.java index 206d184..e6b9a88 100755 --- a/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalMove.java +++ b/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalMove.java @@ -44,7 +44,9 @@ public class ConditionalMove implements X86StaticInstructionHandler (operand2.isIntegerRegisterOperand() || operand2.isImmediateOperand()) && (operand3==null)) { - instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(operand2, Registers.getEFlagsRegister(), operand1)); + Operand temp = Registers.getTempIntReg(tempRegisterNum); + instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(Registers.getEFlagsRegister(), operand1, temp)); + instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(operand2, temp, operand1)); } //if operand1 = register and operand2 = memory - load @@ -52,8 +54,10 @@ public class ConditionalMove implements X86StaticInstructionHandler operand2.isMemoryOperand() && operand3==null) { + Operand temp = Registers.getTempIntReg(tempRegisterNum); + instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(Registers.getEFlagsRegister(), operand1, temp)); Operand sourceOperand = OperandTranslator.processSourceMemoryOperand(operand2, instructionArrayList, tempRegisterNum, true); - instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(sourceOperand, Registers.getEFlagsRegister(), operand1)); + instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(sourceOperand, temp, operand1)); } // //if operand1 = memory and operand2 = memory - store diff --git a/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalSet.java b/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalSet.java index e82bd02..f002892 100755 --- a/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalSet.java +++ b/src/simulator/emulatorinterface/translator/x86/instruction/ConditionalSet.java @@ -19,7 +19,7 @@ public class ConditionalSet implements X86StaticInstructionHandler operand2==null && operand3==null) { instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(Registers.getEFlagsRegister(), - Operand.getImmediateOperand(), operand1)); + operand1, operand1)); } else if(operand1.isMemoryOperand()) diff --git a/src/simulator/generic/Instruction.java b/src/simulator/generic/Instruction.java index b2a7e6b..f5c7a80 100755 --- a/src/simulator/generic/Instruction.java +++ b/src/simulator/generic/Instruction.java @@ -44,11 +44,14 @@ public class Instruction implements Serializable private long serialNo; private int threadID; + private boolean isPredicateAndNotExecuted; + public Instruction() { this.sourceOperand1 = null; this.sourceOperand2 = null; this.destinationOperand = null; + isPredicateAndNotExecuted = false; } public void clear() @@ -57,6 +60,7 @@ public class Instruction implements Serializable this.sourceOperand1 = null; this.sourceOperand2 = null; this.destinationOperand = null; + isPredicateAndNotExecuted = false; } public Instruction(OperationType type, Operand sourceOperand1, @@ -66,6 +70,7 @@ public class Instruction implements Serializable this.sourceOperand1 = sourceOperand1; this.sourceOperand2 = sourceOperand2; this.destinationOperand = destinationOperand; + isPredicateAndNotExecuted = false; } private void set(OperationType type, Operand sourceOperand1, @@ -75,6 +80,7 @@ public class Instruction implements Serializable this.sourceOperand1 = sourceOperand1; this.sourceOperand2 = sourceOperand2; this.destinationOperand = destinationOperand; + isPredicateAndNotExecuted = false; } // /* our clone constructor */ @@ -123,6 +129,8 @@ public class Instruction implements Serializable this.serialNo = sourceInstruction.serialNo; this.threadID = sourceInstruction.threadID; + + this.isPredicateAndNotExecuted = sourceInstruction.isPredicateAndNotExecuted; } public static Instruction getIntALUInstruction(Operand sourceOperand1, Operand sourceOperand2, Operand destinationOperand) @@ -492,6 +500,14 @@ public class Instruction implements Serializable this.destinationOperandMemValue = destinationOperandMemValue; } + public boolean isPredicateAndNotExecuted() { + return isPredicateAndNotExecuted; + } + + public void setPredicateAndNotExecuted(boolean isPredicateAndNotExecuted) { + this.isPredicateAndNotExecuted = isPredicateAndNotExecuted; + } + /** * strInstruction method returns the instruction information in a string. * @return String describing the instruction diff --git a/src/simulator/pipeline/outoforder/ReorderBuffer.java b/src/simulator/pipeline/outoforder/ReorderBuffer.java index 0158791..686f39f 100755 --- a/src/simulator/pipeline/outoforder/ReorderBuffer.java +++ b/src/simulator/pipeline/outoforder/ReorderBuffer.java @@ -448,7 +448,7 @@ public class ReorderBuffer extends SimulationElement{ else bw.write(" null null null"); bw.write(" "+tmp.getSourceOperand1MemValue()+" "+ tmp.getSourceOperand2MemValue()+" "+tmp.getDestinationOperandMemValue()+" "+ - tmp.getBranchTargetAddress()+" "+tmp.isBranchTaken()+" "+tmp.getThreadID()+" "+tmp.getSerialNo()+"\n"); + tmp.getBranchTargetAddress()+" "+tmp.isBranchTaken()+" "+tmp.getThreadID()+" "+tmp.getSerialNo()+" "+tmp.isPredicateAndNotExecuted()+"\n"); } catch(Exception e) {