Commit a33653ee by songxinkai

add HBM2

parent ee56fe2b
#local_repository(
# name = "ptsimulator",
# path = "/home/songxinkai/ptsimulator",
#)
########################
# Example config file
# Comments start with #
# There are restrictions for valid channel/rank numbers
standard = HBM
channels = 8
ranks = 1
speed = HBM_1Gbps
org = HBM_4Gb
# record_cmd_trace: (default is off): on, off
record_cmd_trace = off
# print_cmd_trace: (default is off): on, off
print_cmd_trace = off
### Below are parameters only for CPU trace
cpu_tick = 32
mem_tick = 5
### Below are parameters only for multicore mode
# When early_exit is on, all cores will be terminated when the earliest one finishes.
early_exit = on
# early_exit = on, off (default value is on)
# If expected_limit_insts is set, some per-core statistics will be recorded when this limit (or the end of the whole trace if it's shorter than specified limit) is reached. The simulation won't stop and will roll back automatically until the last one reaches the limit.
expected_limit_insts = 200000000
warmup_insts = 100000000
cache = no
# cache = no, L1L2, L3, all (default value is no)
translation = None
# translation = None, Random (default value is None)
#
########################
...@@ -77,6 +77,7 @@ cc_library( ...@@ -77,6 +77,7 @@ cc_library(
"ram.h", "ram.h",
], ],
deps=[ deps=[
#"@ptsimulator//hardware:instruction",
":Config", ":Config",
":Controller", ":Controller",
":SpeedyController", ":SpeedyController",
...@@ -104,6 +105,7 @@ cc_library( ...@@ -104,6 +105,7 @@ cc_library(
"-std=c++11", "-std=c++11",
"-g", "-g",
"-Wall", "-Wall",
"-DRAMULATOR",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
...@@ -555,6 +557,7 @@ cc_library( ...@@ -555,6 +557,7 @@ cc_library(
"-O3", "-O3",
"-std=c++11", "-std=c++11",
"-Wall", "-Wall",
"-DRAMULATOR",
], ],
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <vector> #include <vector>
#include <functional> #include <functional>
#include <cassert> #include <cassert>
#include <iostream>
using namespace std; using namespace std;
using namespace ramulator; using namespace ramulator;
......
...@@ -183,6 +183,8 @@ public: ...@@ -183,6 +183,8 @@ public:
int nCKESR, nXS; int nCKESR, nXS;
} speed_table[int(Speed::MAX)] = { } speed_table[int(Speed::MAX)] = {
{1000, 500, 2.0, 2, 2, 3, 7, 7, 6, 7, 4, 17, 24, 7, 2, 4, 8, 4, 5, 20, 0, 1950, 0, 5, 5, 5, 0} {1000, 500, 2.0, 2, 2, 3, 7, 7, 6, 7, 4, 17, 24, 7, 2, 4, 8, 4, 5, 20, 0, 1950, 0, 5, 5, 5, 0}
// HBM2
//{2000, 1000, 2.0, 4, 2, 4, 20, 14, 10, 14, 7, 33, 47, 5, 4, 9, 16, 4, 6, 16, 260, 3900, 240, 8, 8, 9, 270}
}, speed_entry; }, speed_entry;
int read_latency; int read_latency;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// FIXME Find better way to decide where does it come from // FIXME Find better way to decide where does it come from
#if !defined(RAMULATOR) #if !defined(RAMULATOR)
#define INTEGRATED_WITH_GEM5 //#define INTEGRATED_WITH_GEM5
#endif #endif
#ifdef INTEGRATED_WITH_GEM5 #ifdef INTEGRATED_WITH_GEM5
......
#include "ram.h" #include "ram.h"
#include <assert.h> #include <assert.h>
#include <functional>
template<typename T> template<typename T>
Ram<T>::Ram(const std::string& config_file){ Ram<T>::Ram(const std::string& config_file){
...@@ -127,7 +126,20 @@ bool Ram<T>::AccessCommand(const long req_addr, const Request::Type req_type, in ...@@ -127,7 +126,20 @@ bool Ram<T>::AccessCommand(const long req_addr, const Request::Type req_type, in
}); });
Request req(req_addr_param, req_type_param, callback, 0); Request req(req_addr_param, req_type_param, callback, 0);
bool res = memory_->send(req); bool res = memory_->send(req);
cout << "request id " << message << ", send result: " << res << endl; cout << "request id " << message << ", send result: " << res << ", memory_->clk_ns(): " << memory_->clk_ns() << endl;
memory_->tick();
clk_++;
return res;
}
// memory_->send() and memory_->tick()
template<typename T>
bool Ram<T>::AccessCommand(const long req_addr, const Request::Type req_type, std::function<void(Request&)> callback){
long req_addr_param = req_addr;
auto req_type_param = req_type;
auto clk = this->clk_;
Request req(req_addr_param, req_type_param, callback, 0);
bool res = memory_->send(req);
memory_->tick(); memory_->tick();
clk_++; clk_++;
return res; return res;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "PCM.h" #include "PCM.h"
#include <string> #include <string>
#include <functional>
#include <memory> // std::shared_ptr #include <memory> // std::shared_ptr
using namespace ramulator; using namespace ramulator;
...@@ -36,6 +37,7 @@ public: ...@@ -36,6 +37,7 @@ public:
void WaitUntil(const double time); void WaitUntil(const double time);
void WaitFor(const double time); void WaitFor(const double time);
// memory_->send() and memory_->tick() // memory_->send() and memory_->tick()
bool AccessCommand(const long req_addr, const Request::Type req_type, std::function<void(Request&)> callback);
bool AccessCommand(const long req_addr, const Request::Type req_type, int message); bool AccessCommand(const long req_addr, const Request::Type req_type, int message);
// memory_->send() and Loop: memory_->tick(), return: realtime from send to return // memory_->send() and Loop: memory_->tick(), return: realtime from send to return
double AccessAndWaitUntilReturn(const long req_addr, const Request::Type req_type); double AccessAndWaitUntilReturn(const long req_addr, const Request::Type req_type);
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <fstream>
using namespace ramulator; using namespace ramulator;
using namespace std;
int main(int argc, const char *argv[]){ int main(int argc, const char *argv[]){
if (argc < 3) { if (argc < 3) {
...@@ -11,16 +13,36 @@ int main(int argc, const char *argv[]){ ...@@ -11,16 +13,36 @@ int main(int argc, const char *argv[]){
"Example: %s ramulator-configs.cfg 16\n", argv[0], argv[0]); "Example: %s ramulator-configs.cfg 16\n", argv[0], argv[0]);
return 0; return 0;
} }
Ram<ramulator::DDR3> ram(argv[1]); Ram<ramulator::HBM> ram(argv[1]);
ram.SetFrequency(1.0); ram.SetFrequency(1.0);
ram.PrintCtrlsQueuesSize(); ram.PrintCtrlsQueuesSize();
int addr_interval = std::stoi(argv[2]); int addr_interval = stoi(argv[2]);
for (int i = 0; i < 10000; ++i){ for (int i = 0; i < 32; ++i){
while (!ram.AccessCommand(long(20734016 + i * addr_interval), ramulator::Request::Type::READ, i)){} while (!ram.AccessCommand(long(0 + i * addr_interval), ramulator::Request::Type::READ, i)){}
ram.WaitFor(100); //ram.WaitFor(0);
//ram.PrintCtrlsQueuesSize(); //ram.PrintCtrlsQueuesSize();
} }
ram.WaitUntil(80000); ram.WaitUntil(80000);
std::cout << "total cycles: " << ram.GetClockRealtime() << std::endl; cout << "total cycles: " << ram.GetClockRealtime() << endl;
edges = readfile(task_param.edge_file());
return 0; return 0;
} }
void (){
// read edges from file
ifstream fedge(task_param.edge_aggregation_param().edge_file(), ios::in|ios::binary);
CHECK(fedge.is_open()) << task_param.edge_aggregation_param().edge_file() << "Not found.";
vector<vector<int> > edges;
int* tmp = new int[edge_num*edge_unit_len];
fedge.read((char*)tmp, edge_num*edge_unit_len*sizeof(int));
fedge.close();
edges.resize(edge_num);
for (int i = 0; i < edge_num; ++i){
for (int j = 0; j < edge_unit_len; ++j){
edges[i].push_back(tmp[edge_unit_len*i+j]);
}
}
}
#!/bin/bash #!/bin/bash
#./bazel-bin/ramulator/testram ./configs/DDR4-config.cfg $1 #./bazel-bin/ramulator/testram ./configs/DDR4-config.cfg $1
./bazel-bin/ramulator/testram_break ./configs/DDR4-config.cfg $1 ./bazel-bin/ramulator/testram_break ./configs/HBM-config.cfg $1
#./bazel-bin/ramulator/main ./configs/DDR4-config.cfg $1 #./bazel-bin/ramulator/main ./configs/DDR4-config.cfg $1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment