Unverified Commit e521fa3f authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Make get_context experimental (#1137)

The get_context may change in the future(when we support multi-targets) so make this experimental for now.
parent 64e79a94
...@@ -1102,8 +1102,8 @@ migraphx_program_equal(bool* out, const_migraphx_program_t program, const_migrap ...@@ -1102,8 +1102,8 @@ migraphx_program_equal(bool* out, const_migraphx_program_t program, const_migrap
return api_error_result; return api_error_result;
} }
extern "C" migraphx_status migraphx_program_get_context(migraphx_context_t* out, extern "C" migraphx_status
const_migraphx_program_t program) migraphx_program_experimental_get_context(migraphx_context_t* out, const_migraphx_program_t program)
{ {
auto api_error_result = migraphx::try_([&] { auto api_error_result = migraphx::try_([&] {
if(program == nullptr) if(program == nullptr)
......
...@@ -291,8 +291,8 @@ migraphx_status migraphx_program_run(migraphx_arguments_t* out, ...@@ -291,8 +291,8 @@ migraphx_status migraphx_program_run(migraphx_arguments_t* out,
migraphx_status migraphx_status
migraphx_program_equal(bool* out, const_migraphx_program_t program, const_migraphx_program_t x); migraphx_program_equal(bool* out, const_migraphx_program_t program, const_migraphx_program_t x);
migraphx_status migraphx_program_get_context(migraphx_context_t* out, migraphx_status migraphx_program_experimental_get_context(migraphx_context_t* out,
const_migraphx_program_t program); const_migraphx_program_t program);
migraphx_status migraphx_operation_destroy(migraphx_operation_t operation); migraphx_status migraphx_operation_destroy(migraphx_operation_t operation);
......
...@@ -733,10 +733,10 @@ struct program : MIGRAPHX_HANDLE_BASE(program) ...@@ -733,10 +733,10 @@ struct program : MIGRAPHX_HANDLE_BASE(program)
return module{p_modu}; return module{p_modu};
} }
context get_context() context experimental_get_context()
{ {
migraphx_context_t ctx; migraphx_context_t ctx;
call(&migraphx_program_get_context, &ctx, this->get_handle_ptr()); call(&migraphx_program_experimental_get_context, &ctx, this->get_handle_ptr());
return context{ctx}; return context{ctx};
} }
......
...@@ -248,7 +248,7 @@ def program(h): ...@@ -248,7 +248,7 @@ def program(h):
invoke='migraphx::equal($@)', invoke='migraphx::equal($@)',
returns='bool', returns='bool',
const=True) const=True)
h.method('get_context', h.method('experimental_get_context',
invoke='migraphx::get_context($@)', invoke='migraphx::get_context($@)',
const=True, const=True,
returns='migraphx::context') returns='migraphx::context')
......
...@@ -461,8 +461,8 @@ lifetime get_lifetime_op(const T&) ...@@ -461,8 +461,8 @@ lifetime get_lifetime_op(const T&)
* shape compute_shape(const std::vector<shape>& input) const; * shape compute_shape(const std::vector<shape>& input) const;
* shape compute_shape(const std::vector<shape>& inputs,const std::vector<module_ref>& * shape compute_shape(const std::vector<shape>& inputs,const std::vector<module_ref>&
* mod_args) const; argument compute(context& ctx,const shape& output,const std::vector<argument>& * mod_args) const; argument compute(context& ctx,const shape& output,const std::vector<argument>&
* input) const; argument compute(const shape& output,const std::vector<argument>& input) * input) const; argument compute(const shape& output,const std::vector<argument>& input) const;
* const; argument compute(const shape& output,const std::vector<argument>& input,const * argument compute(const shape& output,const std::vector<argument>& input,const
* std::vector<module_ref>& module_args,std::function<std::vector<argument>(module_ref&, const * std::vector<module_ref>& module_args,std::function<std::vector<argument>(module_ref&, const
* std::unordered_map<std::string, argument>&)> run) const; argument compute(context& ctx,const * std::unordered_map<std::string, argument>&)> run) const; argument compute(context& ctx,const
* shape& output,const std::vector<argument>& input,const std::vector<module_ref>& * shape& output,const std::vector<argument>& input,const std::vector<module_ref>&
......
...@@ -37,7 +37,7 @@ TEST_CASE(load_and_run_ctx) ...@@ -37,7 +37,7 @@ TEST_CASE(load_and_run_ctx)
{ {
pp.add(name, migraphx::argument::generate(param_shapes[name])); pp.add(name, migraphx::argument::generate(param_shapes[name]));
} }
auto ctx = p.get_context(); auto ctx = p.experimental_get_context();
p.eval(pp); p.eval(pp);
ctx.finish(); ctx.finish();
} }
......
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