Unverified Commit 2466dd6f authored by Shucai Xiao's avatar Shucai Xiao Committed by GitHub
Browse files

Refactor program to module (#684)



* code backup

* clang format

* change corresponding tool files

* clang format
Co-authored-by: default avatarmvermeulen <5479696+mvermeulen@users.noreply.github.com>
parent de10423f
...@@ -9,8 +9,9 @@ struct test_tanh : verify_program<test_tanh> ...@@ -9,8 +9,9 @@ struct test_tanh : verify_program<test_tanh>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
p.add_instruction(migraphx::op::tanh{}, x); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
mm->add_instruction(migraphx::op::tanh{}, x);
return p; return p;
} }
}; };
...@@ -9,11 +9,12 @@ struct test_trans_abs : verify_program<test_trans_abs> ...@@ -9,11 +9,12 @@ struct test_trans_abs : verify_program<test_trans_abs>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
auto tx = p.add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto absx = p.add_instruction(migraphx::op::abs{}, tx); auto tx = mm->add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x);
auto r = p.add_instruction(migraphx::op::add{}, absx, absx); auto absx = mm->add_instruction(migraphx::op::abs{}, tx);
p.add_instruction(migraphx::op::contiguous{}, r); auto r = mm->add_instruction(migraphx::op::add{}, absx, absx);
mm->add_instruction(migraphx::op::contiguous{}, r);
return p; return p;
} }
......
...@@ -9,9 +9,10 @@ struct test_trans_ret : verify_program<test_trans_ret> ...@@ -9,9 +9,10 @@ struct test_trans_ret : verify_program<test_trans_ret>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
auto tx = p.add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
p.add_return({tx}); auto tx = mm->add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x);
mm->add_return({tx});
return p; return p;
} }
......
...@@ -9,11 +9,12 @@ struct test_trans_tanh : verify_program<test_trans_tanh> ...@@ -9,11 +9,12 @@ struct test_trans_tanh : verify_program<test_trans_tanh>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
auto tx = p.add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto tanhx = p.add_instruction(migraphx::op::tanh{}, tx); auto tx = mm->add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x);
auto r = p.add_instruction(migraphx::op::add{}, tanhx, tanhx); auto tanhx = mm->add_instruction(migraphx::op::tanh{}, tx);
p.add_instruction(migraphx::op::contiguous{}, r); auto r = mm->add_instruction(migraphx::op::add{}, tanhx, tanhx);
mm->add_instruction(migraphx::op::contiguous{}, r);
return p; return p;
} }
......
...@@ -9,11 +9,12 @@ struct test_trans_tanh1 : verify_program<test_trans_tanh1> ...@@ -9,11 +9,12 @@ struct test_trans_tanh1 : verify_program<test_trans_tanh1>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
auto tx = p.add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto tanhx = p.add_instruction(migraphx::op::tanh{}, tx); auto tx = mm->add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, x);
auto r = p.add_instruction(migraphx::op::add{}, tanhx, tanhx); auto tanhx = mm->add_instruction(migraphx::op::tanh{}, tx);
p.add_return({tx, r}); auto r = mm->add_instruction(migraphx::op::add{}, tanhx, tanhx);
mm->add_return({tx, r});
return p; return p;
} }
......
...@@ -9,11 +9,12 @@ struct test_transpose : verify_program<test_transpose> ...@@ -9,11 +9,12 @@ struct test_transpose : verify_program<test_transpose>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {4, 3, 4, 4}}; migraphx::shape s{migraphx::shape::float_type, {4, 3, 4, 4}};
auto x = p.add_parameter("x", s); auto x = mm->add_parameter("x", s);
std::vector<int64_t> perm = {0, 2, 3, 1}; std::vector<int64_t> perm = {0, 2, 3, 1};
auto l = p.add_instruction(migraphx::op::transpose{perm}, x); auto l = mm->add_instruction(migraphx::op::transpose{perm}, x);
p.add_instruction(migraphx::op::contiguous{}, l); mm->add_instruction(migraphx::op::contiguous{}, l);
return p; return p;
} }
}; };
...@@ -9,12 +9,13 @@ struct test_triadd : verify_program<test_triadd> ...@@ -9,12 +9,13 @@ struct test_triadd : verify_program<test_triadd>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {3}}; migraphx::shape s{migraphx::shape::float_type, {3}};
auto x = p.add_parameter("x", s); auto x = mm->add_parameter("x", s);
auto y = p.add_parameter("y", s); auto y = mm->add_parameter("y", s);
auto z = p.add_parameter("z", s); auto z = mm->add_parameter("z", s);
auto sum = p.add_instruction(migraphx::op::add{}, x, y); auto sum = mm->add_instruction(migraphx::op::add{}, x, y);
p.add_instruction(migraphx::op::add{}, sum, z); mm->add_instruction(migraphx::op::add{}, sum, z);
return p; return p;
} }
}; };
...@@ -9,14 +9,15 @@ struct test_triadd2 : verify_program<test_triadd2> ...@@ -9,14 +9,15 @@ struct test_triadd2 : verify_program<test_triadd2>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {2, 3}}; migraphx::shape s{migraphx::shape::float_type, {2, 3}};
migraphx::shape b{migraphx::shape::float_type, {3}}; migraphx::shape b{migraphx::shape::float_type, {3}};
auto x = p.add_parameter("x", s); auto x = mm->add_parameter("x", s);
auto y = p.add_parameter("y", s); auto y = mm->add_parameter("y", s);
auto z = p.add_parameter("z", b); auto z = mm->add_parameter("z", b);
auto zb = p.add_instruction(migraphx::op::broadcast{1, s.lens()}, z); auto zb = mm->add_instruction(migraphx::op::broadcast{1, s.lens()}, z);
auto sum = p.add_instruction(migraphx::op::add{}, x, y); auto sum = mm->add_instruction(migraphx::op::add{}, x, y);
p.add_instruction(migraphx::op::add{}, sum, zb); mm->add_instruction(migraphx::op::add{}, sum, zb);
return p; return p;
} }
}; };
...@@ -10,13 +10,14 @@ struct test_triadd_broadcast : verify_program<test_triadd_broadcast> ...@@ -10,13 +10,14 @@ struct test_triadd_broadcast : verify_program<test_triadd_broadcast>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {3}}; migraphx::shape s{migraphx::shape::float_type, {3}};
auto x = p.add_parameter("x", {migraphx::shape::float_type, {2, 2, 3}}); auto x = mm->add_parameter("x", {migraphx::shape::float_type, {2, 2, 3}});
auto y = p.add_parameter("y", {migraphx::shape::float_type, {2, 2}}); auto y = mm->add_parameter("y", {migraphx::shape::float_type, {2, 2}});
auto z = p.add_parameter("z", {migraphx::shape::float_type, {2, 2, 3}}); auto z = mm->add_parameter("z", {migraphx::shape::float_type, {2, 2, 3}});
auto by = p.add_instruction(migraphx::op::broadcast{0, x->get_shape().lens()}, y); auto by = mm->add_instruction(migraphx::op::broadcast{0, x->get_shape().lens()}, y);
auto sum = p.add_instruction(migraphx::op::add{}, x, by); auto sum = mm->add_instruction(migraphx::op::add{}, x, by);
p.add_instruction(migraphx::op::add{}, sum, z); mm->add_instruction(migraphx::op::add{}, sum, z);
return p; return p;
} }
}; };
...@@ -9,12 +9,13 @@ struct test_triadd_relu : verify_program<test_triadd_relu> ...@@ -9,12 +9,13 @@ struct test_triadd_relu : verify_program<test_triadd_relu>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
auto y = p.add_parameter("y", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto z = p.add_parameter("z", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto y = mm->add_parameter("y", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto sum = p.add_instruction(migraphx::op::add{}, x, y); auto z = mm->add_parameter("z", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto triadd = p.add_instruction(migraphx::op::add{}, sum, z); auto sum = mm->add_instruction(migraphx::op::add{}, x, y);
p.add_instruction(migraphx::op::relu{}, triadd); auto triadd = mm->add_instruction(migraphx::op::add{}, sum, z);
mm->add_instruction(migraphx::op::relu{}, triadd);
return p; return p;
} }
}; };
...@@ -9,12 +9,13 @@ struct test_triadd_sigmoid : verify_program<test_triadd_sigmoid> ...@@ -9,12 +9,13 @@ struct test_triadd_sigmoid : verify_program<test_triadd_sigmoid>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
auto y = p.add_parameter("y", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto z = p.add_parameter("z", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto y = mm->add_parameter("y", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto sum = p.add_instruction(migraphx::op::add{}, x, y); auto z = mm->add_parameter("z", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto triadd = p.add_instruction(migraphx::op::add{}, sum, z); auto sum = mm->add_instruction(migraphx::op::add{}, x, y);
p.add_instruction(migraphx::op::sigmoid{}, triadd); auto triadd = mm->add_instruction(migraphx::op::add{}, sum, z);
mm->add_instruction(migraphx::op::sigmoid{}, triadd);
return p; return p;
} }
}; };
...@@ -9,12 +9,13 @@ struct test_triadd_tanh : verify_program<test_triadd_tanh> ...@@ -9,12 +9,13 @@ struct test_triadd_tanh : verify_program<test_triadd_tanh>
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto x = p.add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto* mm = p.get_main_module();
auto y = p.add_parameter("y", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto z = p.add_parameter("z", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto y = mm->add_parameter("y", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto sum = p.add_instruction(migraphx::op::add{}, x, y); auto z = mm->add_parameter("z", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}});
auto triadd = p.add_instruction(migraphx::op::add{}, sum, z); auto sum = mm->add_instruction(migraphx::op::add{}, x, y);
p.add_instruction(migraphx::op::tanh{}, triadd); auto triadd = mm->add_instruction(migraphx::op::add{}, sum, z);
mm->add_instruction(migraphx::op::tanh{}, triadd);
return p; return p;
} }
}; };
...@@ -16,6 +16,7 @@ struct test_var_sl_gru_bidirct : verify_program<test_var_sl_gru_bidirct> ...@@ -16,6 +16,7 @@ struct test_var_sl_gru_bidirct : verify_program<test_var_sl_gru_bidirct>
float clip = 0.0f; float clip = 0.0f;
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape in_shape{migraphx::shape::float_type, {seq_len, batch_size, input_size}}; migraphx::shape in_shape{migraphx::shape::float_type, {seq_len, batch_size, input_size}};
migraphx::shape w_shape{migraphx::shape::float_type, migraphx::shape w_shape{migraphx::shape::float_type,
{num_dirct, 3 * hidden_size, input_size}}; {num_dirct, 3 * hidden_size, input_size}};
...@@ -25,27 +26,27 @@ struct test_var_sl_gru_bidirct : verify_program<test_var_sl_gru_bidirct> ...@@ -25,27 +26,27 @@ struct test_var_sl_gru_bidirct : verify_program<test_var_sl_gru_bidirct>
migraphx::shape sl_shape{migraphx::shape::int32_type, {batch_size}}; migraphx::shape sl_shape{migraphx::shape::int32_type, {batch_size}};
migraphx::shape ih_shape{migraphx::shape::float_type, {num_dirct, batch_size, hidden_size}}; migraphx::shape ih_shape{migraphx::shape::float_type, {num_dirct, batch_size, hidden_size}};
auto seq = p.add_parameter("seq", in_shape); auto seq = mm->add_parameter("seq", in_shape);
auto w = p.add_parameter("w", w_shape); auto w = mm->add_parameter("w", w_shape);
auto r = p.add_parameter("r", r_shape); auto r = mm->add_parameter("r", r_shape);
auto bias = p.add_parameter("bias", b_shape); auto bias = mm->add_parameter("bias", b_shape);
auto ih = p.add_parameter("ih", ih_shape); auto ih = mm->add_parameter("ih", ih_shape);
std::vector<int> sl_data{2, 1, 3}; std::vector<int> sl_data{2, 1, 3};
auto sql = p.add_literal(migraphx::literal{sl_shape, sl_data}); auto sql = mm->add_literal(migraphx::literal{sl_shape, sl_data});
auto hs = auto hs =
p.add_instruction(migraphx::op::gru{hidden_size, mm->add_instruction(migraphx::op::gru{hidden_size,
{migraphx::op::sigmoid{}, migraphx::op::tanh{}}, {migraphx::op::sigmoid{}, migraphx::op::tanh{}},
migraphx::op::rnn_direction::bidirectional, migraphx::op::rnn_direction::bidirectional,
clip}, clip},
seq, seq,
w, w,
r, r,
bias, bias,
sql, sql,
ih); ih);
auto lho = p.add_instruction(migraphx::op::rnn_last_hs_output{}, hs); auto lho = mm->add_instruction(migraphx::op::rnn_last_hs_output{}, hs);
p.add_return({hs, lho}); mm->add_return({hs, lho});
return p; return p;
} }
......
...@@ -16,6 +16,7 @@ struct test_var_sl_gru_forward : verify_program<test_var_sl_gru_forward> ...@@ -16,6 +16,7 @@ struct test_var_sl_gru_forward : verify_program<test_var_sl_gru_forward>
float clip = 0.0f; float clip = 0.0f;
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape in_shape{migraphx::shape::float_type, {seq_len, batch_size, input_size}}; migraphx::shape in_shape{migraphx::shape::float_type, {seq_len, batch_size, input_size}};
migraphx::shape w_shape{migraphx::shape::float_type, migraphx::shape w_shape{migraphx::shape::float_type,
{num_dirct, 3 * hidden_size, input_size}}; {num_dirct, 3 * hidden_size, input_size}};
...@@ -25,27 +26,27 @@ struct test_var_sl_gru_forward : verify_program<test_var_sl_gru_forward> ...@@ -25,27 +26,27 @@ struct test_var_sl_gru_forward : verify_program<test_var_sl_gru_forward>
migraphx::shape sl_shape{migraphx::shape::int32_type, {batch_size}}; migraphx::shape sl_shape{migraphx::shape::int32_type, {batch_size}};
migraphx::shape ih_shape{migraphx::shape::float_type, {num_dirct, batch_size, hidden_size}}; migraphx::shape ih_shape{migraphx::shape::float_type, {num_dirct, batch_size, hidden_size}};
auto seq = p.add_parameter("seq", in_shape); auto seq = mm->add_parameter("seq", in_shape);
auto w = p.add_parameter("w", w_shape); auto w = mm->add_parameter("w", w_shape);
auto r = p.add_parameter("r", r_shape); auto r = mm->add_parameter("r", r_shape);
auto bias = p.add_parameter("bias", b_shape); auto bias = mm->add_parameter("bias", b_shape);
auto ih = p.add_parameter("ih", ih_shape); auto ih = mm->add_parameter("ih", ih_shape);
std::vector<int> sl_data{3, 2, 1}; std::vector<int> sl_data{3, 2, 1};
auto sql = p.add_literal(migraphx::literal{sl_shape, sl_data}); auto sql = mm->add_literal(migraphx::literal{sl_shape, sl_data});
auto hs = auto hs =
p.add_instruction(migraphx::op::gru{hidden_size, mm->add_instruction(migraphx::op::gru{hidden_size,
{migraphx::op::sigmoid{}, migraphx::op::tanh{}}, {migraphx::op::sigmoid{}, migraphx::op::tanh{}},
migraphx::op::rnn_direction::forward, migraphx::op::rnn_direction::forward,
clip}, clip},
seq, seq,
w, w,
r, r,
bias, bias,
sql, sql,
ih); ih);
auto lho = p.add_instruction(migraphx::op::rnn_last_hs_output{}, hs); auto lho = mm->add_instruction(migraphx::op::rnn_last_hs_output{}, hs);
p.add_return({lho, hs}); mm->add_return({lho, hs});
return p; return p;
} }
......
...@@ -118,8 +118,8 @@ void quantize_fp16_with_op_names(program& prog, std::vector<std::string>& names) ...@@ -118,8 +118,8 @@ void quantize_fp16_with_op_names(program& prog, std::vector<std::string>& names)
struct quantize_int8_options struct quantize_int8_options
{ {
std::vector<program::parameter_map> calibration = {}; std::vector<parameter_map> calibration = {};
std::vector<std::string> op_names = {}; std::vector<std::string> op_names = {};
}; };
void add_op_name(quantize_int8_options& options, const char* name) void add_op_name(quantize_int8_options& options, const char* name)
...@@ -127,7 +127,7 @@ void add_op_name(quantize_int8_options& options, const char* name) ...@@ -127,7 +127,7 @@ void add_op_name(quantize_int8_options& options, const char* name)
options.op_names.push_back(name); options.op_names.push_back(name);
} }
void add_calibration_data(quantize_int8_options& options, program::parameter_map& data) void add_calibration_data(quantize_int8_options& options, parameter_map& data)
{ {
options.calibration.push_back(data); options.calibration.push_back(data);
} }
...@@ -160,10 +160,7 @@ bool equal(const T& x, const T& y) ...@@ -160,10 +160,7 @@ bool equal(const T& x, const T& y)
return x == y; return x == y;
} }
std::vector<argument> run(program& p, const program::parameter_map& params) std::vector<argument> run(program& p, const parameter_map& params) { return p.eval(params); }
{
return p.eval(params);
}
std::vector<shape> get_output_shapes(program& p) { return p.get_output_shapes(); } std::vector<shape> get_output_shapes(program& p) { return p.get_output_shapes(); }
......
...@@ -13,6 +13,7 @@ namespace migraphx { ...@@ -13,6 +13,7 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
struct program; struct program;
using module = program;
#ifdef DOXYGEN #ifdef DOXYGEN
...@@ -23,7 +24,7 @@ struct pass ...@@ -23,7 +24,7 @@ struct pass
/// A unique name used to identify the pass /// A unique name used to identify the pass
std::string name() const; std::string name() const;
/// Run the pass on the program /// Run the pass on the program
void apply(program& p) const; void apply(module& p) const;
}; };
#else #else
...@@ -31,7 +32,7 @@ struct pass ...@@ -31,7 +32,7 @@ struct pass
<% <%
interface('pass', interface('pass',
virtual('name', returns='std::string', const=True), virtual('name', returns='std::string', const=True),
virtual('apply', returns='void', p='program &', const=True) virtual('apply', returns='void', p='module &', const=True)
) )
%> %>
......
...@@ -16,6 +16,7 @@ namespace migraphx { ...@@ -16,6 +16,7 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
struct program; struct program;
using module = program;
struct operation; struct operation;
#ifdef DOXYGEN #ifdef DOXYGEN
...@@ -26,11 +27,11 @@ struct schedule_model ...@@ -26,11 +27,11 @@ struct schedule_model
/// Get the number of concurrent instruction allowed /// Get the number of concurrent instruction allowed
std::size_t concurrency() const; std::size_t concurrency() const;
/// Schedule a concurrent instruction /// Schedule a concurrent instruction
void sched(program& p, instruction_ref ins, std::size_t n) const; void sched(module& 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(module& 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(module& 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;
}; };
...@@ -40,9 +41,9 @@ struct schedule_model ...@@ -40,9 +41,9 @@ struct schedule_model
<% <%
interface('schedule_model', interface('schedule_model',
virtual('concurrency', returns='std::size_t', const=True), virtual('concurrency', returns='std::size_t', const=True),
virtual('sched', p='program&', ins='instruction_ref', n='std::size_t', const=True), virtual('sched', p='module&', ins='instruction_ref', n='std::size_t', const=True),
virtual('wait', p='program&', ins='instruction_ref', wait_id='std::size_t', const=True), virtual('wait', p='module&', ins='instruction_ref', wait_id='std::size_t', const=True),
virtual('record', p='program&', ins='instruction_ref', wait_id='std::size_t', const=True), virtual('record', p='module&', ins='instruction_ref', wait_id='std::size_t', const=True),
virtual('weight', returns='std::size_t', op='const operation&', const=True) virtual('weight', returns='std::size_t', op='const operation&', const=True)
) )
%> %>
......
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