From cb16bd3a8a454d729f65a811e7614480a59a928f Mon Sep 17 00:00:00 2001 From: robert Date: Mon, 5 May 2014 10:37:59 +0200 Subject: [PATCH] changed simulation recorder to record filenames of memspec and memconfig --- .../configs/memconfigs/fifo_n100.xml | 11 -- .../configs/memconfigs/fifo_n1000.xml | 11 -- .../resources/configs/memconfigs/fifo_n20.xml | 11 -- dram/resources/configs/memconfigs/fifo_n5.xml | 11 -- .../resources/configs/memconfigs/fifo_n50.xml | 11 -- dram/resources/configs/memconfigs/par_bs.xml | 11 -- dram/resources/configs/memspecs/DDR4.xml | 5 +- dram/resources/configs/memspecs/WideIO.xml | 7 +- dram/resources/scripts/metrics.py | 117 +++++++++++++----- dram/resources/simulations/datasizes.xml | 24 ++-- dram/resources/simulations/first.xml | 33 ----- dram/resources/simulations/sim-batch.xml | 37 +++--- .../scheduling/checker/RefreshChecker.cpp | 4 + dram/src/simulation/SimulationManager.cpp | 2 +- 14 files changed, 115 insertions(+), 180 deletions(-) delete mode 100644 dram/resources/configs/memconfigs/fifo_n100.xml delete mode 100644 dram/resources/configs/memconfigs/fifo_n1000.xml delete mode 100644 dram/resources/configs/memconfigs/fifo_n20.xml delete mode 100644 dram/resources/configs/memconfigs/fifo_n5.xml delete mode 100644 dram/resources/configs/memconfigs/fifo_n50.xml delete mode 100644 dram/resources/configs/memconfigs/par_bs.xml delete mode 100644 dram/resources/simulations/first.xml diff --git a/dram/resources/configs/memconfigs/fifo_n100.xml b/dram/resources/configs/memconfigs/fifo_n100.xml deleted file mode 100644 index ba84ec9e..00000000 --- a/dram/resources/configs/memconfigs/fifo_n100.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/dram/resources/configs/memconfigs/fifo_n1000.xml b/dram/resources/configs/memconfigs/fifo_n1000.xml deleted file mode 100644 index 409263d7..00000000 --- a/dram/resources/configs/memconfigs/fifo_n1000.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/dram/resources/configs/memconfigs/fifo_n20.xml b/dram/resources/configs/memconfigs/fifo_n20.xml deleted file mode 100644 index 94b43a40..00000000 --- a/dram/resources/configs/memconfigs/fifo_n20.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/dram/resources/configs/memconfigs/fifo_n5.xml b/dram/resources/configs/memconfigs/fifo_n5.xml deleted file mode 100644 index 8140b874..00000000 --- a/dram/resources/configs/memconfigs/fifo_n5.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/dram/resources/configs/memconfigs/fifo_n50.xml b/dram/resources/configs/memconfigs/fifo_n50.xml deleted file mode 100644 index 1da98872..00000000 --- a/dram/resources/configs/memconfigs/fifo_n50.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/dram/resources/configs/memconfigs/par_bs.xml b/dram/resources/configs/memconfigs/par_bs.xml deleted file mode 100644 index c27fd9d9..00000000 --- a/dram/resources/configs/memconfigs/par_bs.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/dram/resources/configs/memspecs/DDR4.xml b/dram/resources/configs/memspecs/DDR4.xml index e54ec3d1..db03826f 100644 --- a/dram/resources/configs/memspecs/DDR4.xml +++ b/dram/resources/configs/memspecs/DDR4.xml @@ -1,6 +1,5 @@ - @@ -15,9 +14,7 @@ - - + diff --git a/dram/resources/configs/memspecs/WideIO.xml b/dram/resources/configs/memspecs/WideIO.xml index bd270c08..e71d27c6 100644 --- a/dram/resources/configs/memspecs/WideIO.xml +++ b/dram/resources/configs/memspecs/WideIO.xml @@ -5,7 +5,6 @@ - - @@ -20,16 +19,12 @@ - - + - - - diff --git a/dram/resources/scripts/metrics.py b/dram/resources/scripts/metrics.py index 1a1769b2..0986bc73 100644 --- a/dram/resources/scripts/metrics.py +++ b/dram/resources/scripts/metrics.py @@ -42,6 +42,53 @@ def average_response_latency_in_ns(connection): result = cursor.fetchone() return round(result[0],1) + + +def refreshMissDecision(connection,calculatedMetrics): + cursor = connection.cursor() + cursor.execute("""SELECT phases.ID,PhaseBegin,PhaseEnd,TBank FROM Phases INNER JOIN transactions on transactions.id = phases.transact WHERE PhaseName='AUTO_REFRESH' """) + queryMinREQ = """SELECT id,min(PhaseBegin) FROM (SELECT transactions.id, PhaseBegin FROM transactions + inner join ranges on ranges.id = transactions.range inner join phases on phases.transact = transactions.id + where tthread != 0 and tbank = :bank and PhaseName = "REQ" and ranges.begin<:begin and ranges.end>:end)""" + + queryMinRESP = """SELECT id,min(PhaseBegin) FROM (SELECT transactions.id, PhaseBegin FROM transactions + inner join ranges on ranges.id = transactions.range inner join phases on phases.transact = transactions.id + where tthread != 0 and tbank = :bank and PhaseName = "RESP" and ranges.begin<:begin and ranges.end>:end) """ + + missDecisions = 0 + totalDecisios = 0 + + for refresh in cursor: + id = refresh[0] + begin = refresh[1] + end = refresh[2] + bank = refresh[3] + #print('Refresh: {0} {1} {2} {3}'.format(id,begin,end,bank)) + + cursorMinREQ = connection.cursor() + cursorMinRESP = connection.cursor() + + cursorMinREQ.execute(queryMinREQ, {"bank":bank, "begin":begin, "end":end}) + cursorMinRESP.execute(queryMinRESP, {"bank":bank, "begin":begin, "end":end}) + + earliestReq = cursorMinREQ.fetchone() + earliestResp = cursorMinRESP.fetchone() + if(earliestReq[0] != None): + totalDecisios = totalDecisios + 1 + if(earliestReq[0] != earliestResp[0]): + missDecisions = missDecisions + 1 + print("earliest Req: {0}| earliest Res: {1}".format(earliestReq[0], earliestResp[0])) + end + + + + if(totalDecisios != 0): + calculatedMetrics.append(("Total Missdecisions", missDecisions)) + calculatedMetrics.append(("Relative Missdecisions", 1.0*missDecisions/totalDecisios)) + else: + calculatedMetrics.append(("Total Missdecisions", 0)) + calculatedMetrics.append(("Relative Missdecisions", 0)) + # @metric # def median_response_latency_in_ns(connection): # cursor = connection.cursor() @@ -75,15 +122,15 @@ def average_response_latency_in_ns(connection): # return round(result[0],1) -# @threadMetric -# def average_response_latency_in_ns(connection, thread): -# cursor = connection.cursor() -# query = """SELECT avg(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases -# ON phases.transact = transactions.ID WHERE PhaseName='RESP' AND TThread = :Thread """ +@threadMetric +def average_response_latency_in_ns(connection, thread): + cursor = connection.cursor() + query = """SELECT avg(PhaseBegin-timeOfGeneration)/1000 FROM transactions INNER JOIN Phases + ON phases.transact = transactions.ID WHERE PhaseName='RESP' AND TThread = :Thread """ -# cursor.execute(query, {"Thread": thread}) -# result = cursor.fetchone() -# return round(result[0],1) + cursor.execute(query, {"Thread": thread}) + result = cursor.fetchone() + return round(result[0],1) # @threadMetric # def median_response_latency_in_ns(connection, thread): @@ -95,26 +142,26 @@ def average_response_latency_in_ns(connection): # result = cursor.fetchone() # return round(result[0],1) -@metric -def number_of_activates(connection): - cursor = connection.cursor() - cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName = 'ACT'") - result = cursor.fetchone() - return result[0] +# @metric +# def number_of_activates(connection): +# cursor = connection.cursor() +# cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName = 'ACT'") +# result = cursor.fetchone() +# return result[0] -@metric -def number_of_precharges(connection): - cursor = connection.cursor() - cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName IN ('PRE','PRE_ALL','RDA','WRA')") - result = cursor.fetchone() - return result[0] +# @metric +# def number_of_precharges(connection): +# cursor = connection.cursor() +# cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName IN ('PRE','PRE_ALL','RDA','WRA')") +# result = cursor.fetchone() +# return result[0] -@metric -def accesses_per_activate(connection): - cursor = connection.cursor() - cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName IN ('REQ')") - result = cursor.fetchone() - return round(result[0]*1.0/number_of_activates(connection),1) +# @metric +# def accesses_per_activate(connection): +# cursor = connection.cursor() +# cursor.execute("SELECT COUNT(*) FROM Phases WHERE PhaseName IN ('REQ')") +# result = cursor.fetchone() +# return round(result[0]*1.0/number_of_activates(connection),1) def timeInPowerStates(connection): totalTimeAllBanks = getTraceLength(connection)*getNumberOfBanks(connection) @@ -215,15 +262,19 @@ def calculateMetrics(pathToTrace): print("{0}: {1}".format(res[0],res[1])) calculatedMetrics.append(res) - # for thread in getThreads(connection): - # for metric in threadMetrics: - # res = ("Thread " + str(thread) + " " + metric.__name__.replace("_"," "), metric(connection, thread)) - # print("{0}: {1}".format(res[0],res[1])) - # calculatedMetrics.append(res) + for thread in getThreads(connection): + for metric in threadMetrics: + res = ("Thread " + str(thread) + " " + metric.__name__.replace("_"," "), metric(connection, thread)) + print("{0}: {1}".format(res[0],res[1])) + calculatedMetrics.append(res) - calculatedMetrics.extend(passRatio(connection)) + calculatedMetrics.append(("test",0)) + #calculatedMetrics.extend(passRatio(connection)) #calculatedMetrics.extend(timeInPowerStates(connection)) - + + refreshMissDecision(connection, calculatedMetrics) + print(calculatedMetrics[-1]) + print(calculatedMetrics[-2]) connection.close() return calculatedMetrics diff --git a/dram/resources/simulations/datasizes.xml b/dram/resources/simulations/datasizes.xml index e2d50043..c014fcfa 100644 --- a/dram/resources/simulations/datasizes.xml +++ b/dram/resources/simulations/datasizes.xml @@ -2,29 +2,21 @@ JEDEC_256Mb_WIDEIO_SDR-266_128bit.xml am_wideioFourBanks.xml - fr_fcfs_bankwise.xml + fr_fcfs_unaware.xml + + chstone-aes_32.stl chstone-motion_32.stl + + chstone-motion_32.stl chstone-jpeg_32.stl - - mediabench-gsmdecode_32.stl - - - mediabench-fractal_32.stl - - - mediabench-epic_32.stl - - - mediabench-mpeg2encode_32.stl - - - mediabench-h263encode_32.stl - + + + diff --git a/dram/resources/simulations/first.xml b/dram/resources/simulations/first.xml deleted file mode 100644 index 5e26992b..00000000 --- a/dram/resources/simulations/first.xml +++ /dev/null @@ -1,33 +0,0 @@ - -DDR4.xml - -am_highPara.xml - - - - - fr_fcfs.xml - fr_fcfs_unaware.xml - - - - - chstone-sha_32.stl - chstone-aes_32.stl - - - mediabench-h263decode_32.stl - mediabench-g721encode_32.stl - - - mediabench-fractal_32.stl - chstone-aes_32.stl - - - mediabench-h263decode_32.stl - chstone-aes_32.stl - - - diff --git a/dram/resources/simulations/sim-batch.xml b/dram/resources/simulations/sim-batch.xml index 0e9756f8..c1b21891 100644 --- a/dram/resources/simulations/sim-batch.xml +++ b/dram/resources/simulations/sim-batch.xml @@ -1,28 +1,23 @@ - - JEDEC_256Mb_WIDEIO_SDR-266_128bit.xml - am_wideioFourBanks.xml + +DDR4.xml + + + + am_lowHits.xml + am_lowPara.xml + fr_fcfs.xml - fr_fcfs_bankwise.xml + fifo.xml - - chstone-sha_32.stl - chstone-aes_32.stl + + mediabench-fractal_32.stl + - + + diff --git a/dram/src/core/scheduling/checker/RefreshChecker.cpp b/dram/src/core/scheduling/checker/RefreshChecker.cpp index 32287311..16f3e2e1 100644 --- a/dram/src/core/scheduling/checker/RefreshChecker.cpp +++ b/dram/src/core/scheduling/checker/RefreshChecker.cpp @@ -35,6 +35,10 @@ void RefreshChecker::delayToSatisfyConstraints(ScheduledCommand& command) const { command.delayToMeetConstraint(lastCommandOnBank.getStart(), config.Timings.tXP); } + else if (lastCommandOnBank.getCommand() == Command::SREFX) + { + command.delayToMeetConstraint(lastCommandOnBank.getStart(), config.Timings.tXSR); + } else if (lastCommandOnBank.getCommand() == Command::AutoRefresh) { } diff --git a/dram/src/simulation/SimulationManager.cpp b/dram/src/simulation/SimulationManager.cpp index 027b151e..c9bff046 100644 --- a/dram/src/simulation/SimulationManager.cpp +++ b/dram/src/simulation/SimulationManager.cpp @@ -68,7 +68,7 @@ void SimulationManager::runSimulations() for (auto& traceSetup : batch.traceSetups) { runSimulation( - exportPath + "/" + batch.simulationName + "/" + traceSetup.first + "-" + addressmappig + "-" + + exportPath + "/" + batch.simulationName + "/" + traceSetup.first + "-" + memspec + "-" + memconfig + ".tdb", dramSetup, traceSetup.second); } }