Commit 9cd5cf4e authored by Paul's avatar Paul
Browse files

Formatting

parent 19ed10f0
......@@ -17,11 +17,10 @@ struct hip_device
{
hip_device() { add_stream(); }
hip_device(std::size_t id, std::size_t n)
: device_id(id)
hip_device(std::size_t id, std::size_t n) : device_id(id)
{
for(std::size_t i = 0;i< n;i++)
add_stream();
for(std::size_t i = 0; i < n; i++)
add_stream();
}
struct stream
......@@ -108,7 +107,7 @@ struct hip_device
void add_stream() { streams.emplace_back(device_id); }
stream& get_stream() { return streams.at(current_stream); }
stream& get_stream(std::size_t n) { return streams.at(n); }
void set_stream(std::size_t n) { current_stream = n; }
......@@ -123,7 +122,10 @@ struct hip_device
struct context
{
context(std::size_t device_id = 0, std::size_t n = 4) : current_device(std::make_shared<hip_device>(device_id, n)) {}
context(std::size_t device_id = 0, std::size_t n = 4)
: current_device(std::make_shared<hip_device>(device_id, n))
{
}
hip_device& get_current_device()
{
......
......@@ -33,16 +33,13 @@ struct wait_event
argument compute(context& ctx, const shape&, const std::vector<argument>&) const
{
assert(event != nullptr);
for(auto n:wait_for)
for(auto n : wait_for)
ctx.get_stream(n).record(event.get());
ctx.get_stream().wait(event.get());
return {};
}
void finalize(context& ctx, const shape&, std::vector<shape>)
{
event = create_event();
}
void finalize(context& ctx, const shape&, std::vector<shape>) { event = create_event(); }
};
struct set_stream
......@@ -66,7 +63,7 @@ struct set_stream
};
std::size_t schedule_model::concurrency() const { return n; }
void schedule_model::schedule_instruction(program& p, instruction_ref ins, std::size_t n) const
void schedule_model::schedule_instruction(program& p, instruction_ref ins, std::size_t n) const
{
p.insert_instruction(ins, set_stream{n});
}
......@@ -79,7 +76,6 @@ void schedule_model::wait(program& p,
p.insert_instruction(ins, wait_event{wait_for});
}
static std::unordered_map<std::string, std::size_t> create_weight_map()
{
return {
......@@ -100,12 +96,11 @@ static const std::unordered_map<std::string, std::size_t>& weight_map()
return m;
}
std::size_t schedule_model::weight(const operation& op) const
std::size_t schedule_model::weight(const operation& op) const
{
if (weight_map().count(op.name()) == 0)
return 0;
return weight_map().at(op.name());
if(weight_map().count(op.name()) == 0)
return 0;
return weight_map().at(op.name());
}
} // namespace gpu
......
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