_N_HIST = 2 bp = BranchPredictorTournament(sat_cnt_bits=_SAT_CNT_BITS, bht_addr_bits=_BHT_ADDR_BITS, n_hist=_N_HIST) # loop over all trace lines for address, taken in tr.read(): # predict branch prediction = bp.predict(address) # check if prediction was correct correct = prediction == taken # update internal predictor state bp.update(address, correct) # parameter grid search if args.gridsearch: # instantiate evaluator ev = Evaluator(branch_predictor=BranchPredictorTournament, num_processes=4) # add all evaluation corners for trace in ["short_mobile_1", "long_mobile_1", "short_server_1", "long_server_1"]: for sat_bits in [1, 2, 3, 4, 5]: for addr_bits in [3, 6, 9, 12, 15]: ev.submit(trace, sat_bits, addr_bits) # wait for all tasks to finish ev.finalize() # write result to file ev.write_result("gridsearch_bp_tournament.csv") # print result ev.print_result()
tr = TraceReader("../traces/dummy.trace") # instantiate branch predictor bp = BranchPredictorAlwaysTaken() # loop over all trace lines for address, taken in tr.read(): # predict branch prediction = bp.predict(address) # check if prediction was correct correct = prediction == taken # update internal predictor state bp.update(address, correct) # parameter grid search if args.gridsearch: # instantiate evaluator ev = Evaluator(branch_predictor=BranchPredictorAlwaysTaken, num_processes=4) # add all evaluation corners for trace in ["short_mobile_1", "long_mobile_1", "short_server_1", "long_server_1"]: ev.submit(trace) # wait for all tasks to finish ev.finalize() # write result to file ev.write_result("gridsearch_bp_always_taken.csv") # print result ev.print_result()
n_hist=_N_HIST) # loop over all trace lines for address, taken in tr.read(): # predict branch prediction = bp.predict(address) # check if prediction was correct correct = prediction == taken # update internal predictor state bp.update(address, correct) # parameter grid search if args.gridsearch: # instantiate evaluator ev = Evaluator(branch_predictor=BranchPredictorGselect, num_processes=4) # add all evaluation corners for trace in [ "short_mobile_1", "long_mobile_1", "short_server_1", "long_server_1" ]: for sat_bits in [1, 2, 3, 4, 5]: for addr_bits in [3, 6, 9, 12, 15]: for n_hist in [3, 6]: ev.submit(trace, sat_bits, addr_bits, n_hist) # wait for all tasks to finish ev.finalize() # write result to file ev.write_result("gridsearch_bp_gselect.csv")
n_hist=_N_HIST) # loop over all trace lines for address, taken in tr.read(): # predict branch prediction = bp.predict(address) # check if prediction was correct correct = prediction == taken # update internal predictor state bp.update(address, correct) # parameter grid search if args.gridsearch: # instantiate evaluator ev = Evaluator(branch_predictor=BranchPredictorTwoLevelLocal, num_processes=4) # add all evaluation corners for trace in [ "short_mobile_1", "long_mobile_1", "short_server_1", "long_server_1" ]: for sat_bits in [1, 2, 3, 4, 5]: for addr_bits in [3, 6, 9, 12, 15]: ev.submit(trace, sat_bits, addr_bits) # wait for all tasks to finish ev.finalize() # write result to file ev.write_result("gridsearch_bp_two_level_local.csv") # print result
n_hist=_N_HIST) # loop over all trace lines for address, taken in tr.read(): # predict branch prediction = bp.predict(address) # check if prediction was correct correct = prediction == taken # update internal predictor state bp.update(address, correct) # parameter grid search if args.gridsearch: # instantiate evaluator ev = Evaluator(branch_predictor=BranchPredictorPerceptron, num_processes=4) # add all evaluation corners for trace in [ "short_mobile_1", "long_mobile_1", "short_server_1", "long_server_1" ]: for sat_bits in [1, 2, 3, 4, 5]: for addr_bits in [3, 6, 9, 12, 15]: ev.submit(trace, sat_bits, addr_bits) # wait for all tasks to finish ev.finalize() # write result to file ev.write_result("gridsearch_bp_perceptron.csv") # print result