Commit 2f7db364 authored by Paul's avatar Paul
Browse files

Formatting

parent e0b0cd9e
...@@ -209,13 +209,16 @@ struct stream_info ...@@ -209,13 +209,16 @@ struct stream_info
continue; continue;
} }
auto stream = get_stream(i); auto stream = get_stream(i);
if (m.count(stream) == 0) if(m.count(stream) == 0)
m[stream] = i; m[stream] = i;
else else
m[stream] = std::min(m[stream], i, by(std::less<>{}, [&](auto x) { return std::distance(x, start); })); m[stream] = std::min(m[stream], i, by(std::less<>{}, [&](auto x) {
return std::distance(x, start);
}));
} }
})(start); })(start);
std::transform(m.begin(), m.end(), std::back_inserter(result), [](auto&& p) { return p.second; }); std::transform(
m.begin(), m.end(), std::back_inserter(result), [](auto&& p) { return p.second; });
return result; return result;
} }
...@@ -328,11 +331,11 @@ void schedule::apply(program& p) const ...@@ -328,11 +331,11 @@ void schedule::apply(program& p) const
// Insert wait instructions // Insert wait instructions
if(si.is_merge_point(ins, stream)) if(si.is_merge_point(ins, stream))
{ {
for(auto i:si.get_recorded_instructions(ins)) for(auto i : si.get_recorded_instructions(ins))
{ {
if (not si.has_stream(i)) if(not si.has_stream(i))
continue; continue;
if (stream == si.get_stream(i)) if(stream == si.get_stream(i))
continue; continue;
// Create a new event if it hasn't been recorded // Create a new event if it hasn't been recorded
if(ins2wait.count(i) == 0) if(ins2wait.count(i) == 0)
......
...@@ -148,10 +148,7 @@ struct context ...@@ -148,10 +148,7 @@ struct context
events.emplace_back(create_event()); events.emplace_back(create_event());
} }
hipEvent_t get_event(std::size_t i) const hipEvent_t get_event(std::size_t i) const { return events.at(i).get(); }
{
return events.at(i).get();
}
std::vector<argument> literals{}; std::vector<argument> literals{};
void finish() const { gpu_sync(); } void finish() const { gpu_sync(); }
......
...@@ -25,10 +25,7 @@ struct record_event ...@@ -25,10 +25,7 @@ struct record_event
return {}; return {};
} }
void finalize(context& ctx, const shape&, std::vector<shape>) void finalize(context& ctx, const shape&, std::vector<shape>) { ctx.create_events(event); }
{
ctx.create_events(event);
}
}; };
struct wait_event struct wait_event
......
...@@ -28,9 +28,9 @@ struct schedule_model ...@@ -28,9 +28,9 @@ struct schedule_model
/// Schedule a concurrent instruction /// Schedule a concurrent instruction
void sched(program& p, instruction_ref ins, std::size_t n) const; void sched(program& p, instruction_ref ins, std::size_t n) const;
// Insert necessary waits before an instruction // Insert necessary waits before an instruction
void wait(program& p,instruction_ref ins, std::size_t wait_id) const; void wait(program& p, instruction_ref ins, std::size_t wait_id) const;
// Insert necessary records after an instruction // Insert necessary records after an instruction
void record(program& p,instruction_ref ins, std::size_t wait_id) const; void record(program& p, instruction_ref ins, std::size_t wait_id) const;
/// Compute weights for an operation /// Compute weights for an operation
std::size_t weight(const operation& op) const; std::size_t weight(const operation& op) const;
}; };
......
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