Commit 23f30d1b authored by Shucai Xiao's avatar Shucai Xiao
Browse files

Merge branch 'develop' of https://github.com/ROCmSoftwarePlatform/AMDMIGraphX into lstm_operator

parents 1f6c387e 3689dab0
......@@ -203,9 +203,8 @@ void memory_coloring_impl::rewrite()
if(is_allocate(ins))
{
assert(!ins->inputs().empty());
p_program->replace_instruction(
ins, op::load{ins->inputs().at(0)->get_shape(), offset}, scratch_param);
ins, op::load{ins->get_shape(), offset}, scratch_param);
}
else if(is_literal(ins))
{
......
......@@ -11,7 +11,7 @@ namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_DISABLE_NULL_STREAM)
MIGRAPHX_DECLARE_ENV_VAR(MIGRAPHX_ENABLE_NULL_STREAM)
struct hip_device
{
......@@ -40,7 +40,7 @@ struct hip_device
hipStream_t get()
{
if(enabled(MIGRAPHX_DISABLE_NULL_STREAM{}))
if(not enabled(MIGRAPHX_ENABLE_NULL_STREAM{}))
{
setup();
if(s == nullptr)
......@@ -53,7 +53,7 @@ struct hip_device
auto create_miopen_handle()
{
if(enabled(MIGRAPHX_DISABLE_NULL_STREAM{}))
if(not enabled(MIGRAPHX_ENABLE_NULL_STREAM{}))
return make_obj<miopen_handle>(&miopenCreateWithStream, get());
else
return make_obj<miopen_handle>(&miopenCreate);
......
......@@ -23,12 +23,13 @@ void copy_to_gpu(const argument& src, const argument& dst);
struct hip_allocate
{
shape s;
std::string tag{};
std::string name() const { return "hip::allocate"; }
shape compute_shape(const std::vector<shape>& inputs) const
{
check_shapes{inputs}.has(1);
return inputs.front();
check_shapes{inputs}.has(0);
return s;
}
argument compute(context&, const shape& output_shape, const std::vector<argument>&) const
{
......
......@@ -127,8 +127,7 @@ struct miopen_apply
}
else
{
auto is = prog->add_outline(s);
auto result = prog->insert_instruction(ins, hip_allocate{std::move(tag)}, is);
auto result = prog->insert_instruction(ins, hip_allocate{s, std::move(tag)});
return result;
}
}
......
......@@ -37,8 +37,7 @@ void write_literals::apply(program& p) const
{
literal l = ins->get_literal();
auto pre = p.add_literal(l);
auto s = p.add_outline(l.get_shape());
auto alloc = p.insert_instruction(std::next(pre), hip_allocate{}, s);
auto alloc = p.insert_instruction(std::next(pre), hip_allocate{l.get_shape()});
p.replace_instruction(ins, hip_copy{}, pre, alloc);
}
else
......
......@@ -21,8 +21,8 @@ struct allocate
std::string name() const { return "allocate"; }
migraphx::shape compute_shape(const std::vector<migraphx::shape>& inputs) const
{
migraphx::check_shapes{inputs, *this}.has(1);
return inputs.front();
migraphx::check_shapes{inputs, *this}.has(0);
return s;
}
migraphx::argument compute(migraphx::context&,
const migraphx::shape& output_shape,
......@@ -34,8 +34,7 @@ struct allocate
migraphx::instruction_ref add_alloc(migraphx::program& p, const migraphx::shape& s)
{
auto a0 = p.add_outline(s);
return p.add_instruction(allocate{}, a0);
return p.add_instruction(allocate{s});
}
bool no_allocate(const migraphx::program& p)
......
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