Skip to content

Commit 5dd5d5a

Browse files
committed
Release V1.1
2 parents ba41ac7 + 1561eca commit 5dd5d5a

File tree

4 files changed

+84
-41
lines changed

4 files changed

+84
-41
lines changed

models/processor/spx/core.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ void spx_core_t::send_qsim_proxy_request()
160160
void spx_core_t::handle_qsim_response(int temp, qsim_proxy_request_t *qsim_proxy_request)
161161
{
162162
assert(qsim_proxy_request->get_core_id() == core_id);
163-
assert(qsim_proxy_request_sent);
164-
qsim_proxy_request_sent = false;
163+
if (qsim_proxy_request->is_extended() == false) {
164+
assert(qsim_proxy_request_sent);
165+
qsim_proxy_request_sent = false;
166+
}
165167

166168
/* qsim_proxy_request is deleted here */
167169
qsim_proxy->handle_qsim_response(qsim_proxy_request);

models/processor/spx/qsim-proxy.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ spx_qsim_proxy_t::spx_qsim_proxy_t(pipeline_t *Pipeline) :
1111
pipeline(Pipeline)
1212
{
1313
/* Reserve fixed queue length. */
14-
queue.reserve(SPX_QSIM_PROXY_QUEUE_SIZE);
14+
queue.reserve(QSIM_PROXY_QUEUE_SIZE);
1515
queue.clear();
1616
}
1717

@@ -25,10 +25,9 @@ void spx_qsim_proxy_t::handle_qsim_response(qsim_proxy_request_t *QsimProxyReque
2525
#ifdef DEBUG_NEW_QSIM_1
2626
std::cerr << "******************" << std::endl << std::flush;
2727
std::cerr << std::dec << pipeline->core->core_id << " recv: " << QsimProxyRequest->get_queue_size() << std::endl << std::flush;
28+
std::vector<Qsim::QueueItem>::size_type sz = queue.size();
2829
//QsimProxyRequest->dump_queue();
2930
#endif
30-
31-
int sz = queue.size();
3231
QsimProxyRequest->append_to(queue);
3332
#ifdef DEBUG_NEW_QSIM_1
3433
std::cerr << "copied: " << queue.size() - sz << std::endl << std::flush;

models/processor/spx/qsim-proxy.h

+50-33
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,89 @@
77

88
/* Refer to ../../qsim/proxy/proxy.h:QSIM_PROXY_QUEUE_SIZE */
99
//#define SPX_QSIM_PROXY_QUEUE_SIZE 256
10-
#define SPX_QSIM_PROXY_QUEUE_SIZE 5000
10+
// The QSIM_* Macros should be identical to those in qsim/proxy/proxy.h
1111

12+
#define QSIM_RUN_GRANULARITY 200
13+
#define QSIM_OVERHEAD 0.2
14+
#define QSIM_PROXY_QUEUE_SIZE (int)(5 * QSIM_RUN_GRANULARITY * (1 + QSIM_OVERHEAD))
1215
//#define DEBUG_NEW_QSIM 1
1316
//#define DEBUG_NEW_QSIM_1 1
1417

1518
namespace manifold {
1619
namespace spx {
1720

21+
1822
class qsim_proxy_request_t
1923
{
2024
public:
2125
qsim_proxy_request_t() {}
22-
qsim_proxy_request_t(int CoreID, int PortID) : core_id(CoreID),
26+
qsim_proxy_request_t(int CoreID, int PortID, bool ex = false) : core_id(CoreID),
2327
port_id(PortID),
28+
extended (ex),
2429
num_queue_items(0) {}
2530
~qsim_proxy_request_t() {}
2631

2732
int get_core_id() const { return core_id; }
2833
int get_port_id() const { return port_id; }
34+
bool is_extended() const { return extended; }
2935
Qsim::QueueItem get_queue_item(unsigned idx) const { return queue[idx]; }
30-
void push_back(Qsim::QueueItem queue_item) { queue.push_back(queue_item); }
36+
void push_back(Qsim::QueueItem queue_item) { queue[num_queue_items++] = queue_item; }
3137
void reset() { num_queue_items = 0; }
32-
unsigned get_queue_size() const { return queue.size(); }
38+
unsigned get_queue_size() const { return num_queue_items; }
3339
void append_to (std::vector<Qsim::QueueItem> &q) {
3440
#ifdef DEBUG_NEW_QSIM
35-
std::cerr << "in append_to -> q: " << q.size() << " queue: " << queue.size() << std::endl << std::flush;
41+
std::cerr << "in append_to -> q: " << q.size() << " queue: " << get_queue_size() << std::endl << std::flush;
3642
#endif
37-
q.insert(q.end(), queue.begin(), queue.end());
43+
q.insert(q.end(), std::begin(queue), std::begin(queue) + get_queue_size());
3844
#ifdef DEBUG_NEW_QSIM
39-
std::cerr << "in append_to[af] -> q: " << q.size() << " queue: " << queue.size() << std::endl << std::flush;
45+
std::cerr << "in append_to[af] -> q: " << q.size() << " queue: " << get_queue_size() << std::endl << std::flush;
4046
#endif
4147
}
42-
void dump_queue () {
43-
for(std::vector<Qsim::QueueItem>::iterator it = queue.begin(); it != queue.end(); it++) {
44-
Qsim::QueueItem qi = *it;
45-
switch (qi.cb_type) {
46-
case Qsim::QueueItem::INST:
47-
std::cerr << "(core " << std::dec << qi.id << " ) | INST" << std::endl << std::flush;
48-
break;
49-
case Qsim::QueueItem::MEM:
50-
std::cerr << "(core " << std::dec << qi.id << " ) | MEM" << std::endl << std::flush;
51-
break;
52-
case Qsim::QueueItem::REG:
53-
std::cerr << "(core " << std::dec << qi.id << " ) | REG" << std::endl << std::flush;
54-
break;
55-
case Qsim::QueueItem::IDLE:
56-
std::cerr << "(core " << std::dec << qi.id << " ) | IDLE" << std::endl << std::flush;
57-
break;
58-
case Qsim::QueueItem::TERMINATED:
59-
std::cerr << "(core " << std::dec << qi.id << " ) | TERMINATED" << std::endl << std::flush;
60-
break;
61-
default:
62-
std::cerr << " (core " << std::dec << qi.id << ") | Wrong Type!" << std::endl << std::flush;
63-
}
64-
}
65-
}
48+
//void dump_queue () {
49+
//for(std::vector<Qsim::QueueItem>::iterator it = queue.begin(); it != queue.end(); it++) {
50+
//Qsim::QueueItem qi = *it;
51+
//switch (qi.cb_type) {
52+
//case Qsim::QueueItem::INST:
53+
//std::cerr << "(core " << std::dec << qi.id << " ) | INST" << std::endl << std::flush;
54+
//break;
55+
//case Qsim::QueueItem::MEM:
56+
//std::cerr << "(core " << std::dec << qi.id << " ) | MEM" << std::endl << std::flush;
57+
//break;
58+
//case Qsim::QueueItem::REG:
59+
//std::cerr << "(core " << std::dec << qi.id << " ) | REG" << std::endl << std::flush;
60+
//break;
61+
//case Qsim::QueueItem::IDLE:
62+
//std::cerr << "(core " << std::dec << qi.id << " ) | IDLE" << std::endl << std::flush;
63+
//break;
64+
//case Qsim::QueueItem::TERMINATED:
65+
//std::cerr << "(core " << std::dec << qi.id << " ) | TERMINATED" << std::endl << std::flush;
66+
//break;
67+
//default:
68+
//std::cerr << " (core " << std::dec << qi.id << ") | Wrong Type!" << std::endl << std::flush;
69+
//}
70+
//}
71+
//}
72+
73+
//qsim_proxy_request_t operator=(const qsim_proxy_request_t _)
74+
//{
75+
//core_id = _.core_id;
76+
//port_id = _.port_id;
77+
//queue = _.queue;
78+
//num_queue_items = _.num_queue_items;
79+
80+
//return *this;
81+
//}
6682

6783
private:
6884
int core_id;
6985
int port_id;
70-
std::vector<Qsim::QueueItem> queue;
86+
Qsim::QueueItem queue[QSIM_PROXY_QUEUE_SIZE];
87+
//std::vector<Qsim::QueueItem> queue;
7188
unsigned num_queue_items;
89+
bool extended;
7290
};
7391

7492

75-
7693
class spx_qsim_proxy_t {
7794
public:
7895
spx_qsim_proxy_t(pipeline_t *Pipeline);

models/qsim/proxy/proxy.h

+28-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
#include "kernel/component.h"
77
#include "kernel/clock.h"
88

9-
#define QSIM_RUN_GRANULARITY 1000
10-
#define QSIM_PROXY_QUEUE_SIZE 5000
9+
#define QSIM_RUN_GRANULARITY 200
10+
#define QSIM_OVERHEAD 0.2
11+
#define QSIM_PROXY_QUEUE_SIZE (int)(5 * QSIM_RUN_GRANULARITY * (1 + QSIM_OVERHEAD))
1112

1213
//#define DEBUG_NEW_QSIM 1
1314
//#define DEBUG_NEW_QSIM_1 1
@@ -97,7 +98,31 @@ void qsim_proxy_t::handle_core_request(int temp, T *CoreRequest)
9798
#ifdef DEBUG_NEW_QSIM
9899
std::cerr << "( core: " << std::dec << core_id << " ) cbs: " << buffer.size() << " | " << std::flush;
99100
#endif
100-
for(std::vector<Qsim::QueueItem>::iterator it = buffer.begin(); it != buffer.end(); it++) {
101+
102+
std::vector<Qsim::QueueItem>::size_type sz = buffer.size();
103+
std::vector<Qsim::QueueItem>::size_type offset = 0;
104+
while ( sz > QSIM_PROXY_QUEUE_SIZE ) {
105+
T *req = new T(CoreRequest->get_core_id(), CoreRequest->get_port_id(), true);
106+
std::vector<Qsim::QueueItem>::iterator it = buffer.begin() + offset;
107+
108+
for(int i = 0; i < QSIM_PROXY_QUEUE_SIZE; i++) {
109+
Qsim::QueueItem qi = *it;
110+
req->push_back(qi);
111+
it++;
112+
}
113+
114+
#ifdef DEBUG_NEW_QSIM_1
115+
std::cerr << "( Core " << std::dec << req->get_core_id() << " ) [receive request from qsim*] | " << std::dec << req->get_queue_size() << std::endl << std::flush;
116+
#endif
117+
118+
Send(req->get_port_id(), req);
119+
120+
sz -= QSIM_PROXY_QUEUE_SIZE;
121+
offset += QSIM_PROXY_QUEUE_SIZE;
122+
}
123+
124+
//assert( buffer.size() < QSIM_PROXY_QUEUE_SIZE );
125+
for(std::vector<Qsim::QueueItem>::iterator it = buffer.begin() + offset; it != buffer.end(); it++) {
101126
Qsim::QueueItem qi = *it;
102127
CoreRequest->push_back(qi);
103128
}

0 commit comments

Comments
 (0)