"git@developer.sourcefind.cn:modelzoo/resnet50_tensorflow.git" did not exist on "8173df8bd3df1d16e795212755fad072d80d0157"
Commit a6d83b3a authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

lib/nicif: factor out init and add dummy yield calls

Enables overriding for multi NIC runner in next step
parent f0e0939e
...@@ -92,6 +92,7 @@ volatile union SimbricksProtoPcieD2H *Runner::D2HAlloc() { ...@@ -92,6 +92,7 @@ volatile union SimbricksProtoPcieD2H *Runner::D2HAlloc() {
nicif_.d2h_pos); nicif_.d2h_pos);
first = false; first = false;
} }
YieldPoll();
} }
if (!first) if (!first)
...@@ -109,6 +110,7 @@ volatile union SimbricksProtoNetD2N *Runner::D2NAlloc() { ...@@ -109,6 +110,7 @@ volatile union SimbricksProtoNetD2N *Runner::D2NAlloc() {
nicif_.d2n_pos); nicif_.d2n_pos);
first = false; first = false;
} }
YieldPoll();
} }
if (!first) if (!first)
...@@ -472,6 +474,13 @@ void Runner::EventTrigger() { ...@@ -472,6 +474,13 @@ void Runner::EventTrigger() {
dev_.Timed(*ev); dev_.Timed(*ev);
} }
void Runner::YieldPoll() {
}
int Runner::NicIfInit(struct SimbricksNicIfParams &nsparams) {
return SimbricksNicIfInit(&nicif_, &nsparams, &dintro_);
}
Runner::Runner(Device &dev) : dev_(dev), events_(EventCmp()) { Runner::Runner(Device &dev) : dev_(dev), events_(EventCmp()) {
// mac_addr = lrand48() & ~(3ULL << 46); // mac_addr = lrand48() & ~(3ULL << 46);
dma_pending_ = 0; dma_pending_ = 0;
...@@ -539,7 +548,7 @@ int Runner::RunMain(int argc, char *argv[]) { ...@@ -539,7 +548,7 @@ int Runner::RunMain(int argc, char *argv[]) {
sync_mode == SIMBRICKS_PROTO_SYNC_BARRIER); sync_mode == SIMBRICKS_PROTO_SYNC_BARRIER);
nsparams.sync_mode = sync_mode; nsparams.sync_mode = sync_mode;
if (SimbricksNicIfInit(&nicif_, &nsparams, &dintro_)) { if (NicIfInit(nsparams)) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
fprintf(stderr, "sync_pci=%d sync_eth=%d\n", nsparams.sync_pci, fprintf(stderr, "sync_pci=%d sync_eth=%d\n", nsparams.sync_pci,
...@@ -553,7 +562,12 @@ int Runner::RunMain(int argc, char *argv[]) { ...@@ -553,7 +562,12 @@ int Runner::RunMain(int argc, char *argv[]) {
} }
SimbricksNicIfAdvanceEpoch(&nicif_, main_time); SimbricksNicIfAdvanceEpoch(&nicif_, main_time);
bool first = true;
do { do {
if (!first)
YieldPoll();
first = false;
PollH2D(); PollH2D();
PollN2D(); PollN2D();
EventTrigger(); EventTrigger();
...@@ -571,6 +585,8 @@ int Runner::RunMain(int argc, char *argv[]) { ...@@ -571,6 +585,8 @@ int Runner::RunMain(int argc, char *argv[]) {
next_ts = ev_ts; next_ts = ev_ts;
} while (next_ts <= main_time && !exiting); } while (next_ts <= main_time && !exiting);
main_time = SimbricksNicIfAdvanceTime(&nicif_, next_ts); main_time = SimbricksNicIfAdvanceTime(&nicif_, next_ts);
YieldPoll();
} }
fprintf(stderr, "exit main_time: %lu\n", main_time); fprintf(stderr, "exit main_time: %lu\n", main_time);
......
...@@ -147,6 +147,9 @@ class Runner { ...@@ -147,6 +147,9 @@ class Runner {
void DmaDo(DMAOp &op); void DmaDo(DMAOp &op);
void DmaTrigger(); void DmaTrigger();
virtual void YieldPoll();
virtual int NicIfInit(struct SimbricksNicIfParams &nsparams);
public: public:
explicit Runner(Device &dev_); explicit Runner(Device &dev_);
......
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