Commit f3a84348 authored by Paul's avatar Paul
Browse files

Fix adjust gpu allocation test

parent b3e9d8f8
...@@ -26,6 +26,8 @@ struct instruction ...@@ -26,6 +26,8 @@ struct instruction
void replace(const shape& r); void replace(const shape& r);
void replace(const operation& o);
void recompute_shape(); void recompute_shape();
void clear_arguments(); void clear_arguments();
......
...@@ -28,6 +28,12 @@ void instruction::replace(const shape& r) ...@@ -28,6 +28,12 @@ void instruction::replace(const shape& r)
} }
} }
void instruction::replace(const operation& o)
{
op = std::move(o);
recompute_shape();
}
void instruction::recompute_shape() { replace(compute_shape(op, arguments)); } void instruction::recompute_shape() { replace(compute_shape(op, arguments)); }
void instruction::clear_arguments() void instruction::clear_arguments()
......
...@@ -63,11 +63,16 @@ static void print_program(const program& p, F print_func) ...@@ -63,11 +63,16 @@ static void print_program(const program& p, F print_func)
for(auto ins : iterator_for(p)) for(auto ins : iterator_for(p))
{ {
std::string var_name = "@" + std::to_string(count); std::string var_name;
if(ins->name() == "@param") if(ins->name() == "@param")
{ {
var_name = any_cast<builtin::param>(ins->get_operator()).parameter; var_name = any_cast<builtin::param>(ins->get_operator()).parameter;
} }
else
{
var_name = "@" + std::to_string(count);
count++;
}
names.emplace(ins, var_name); names.emplace(ins, var_name);
// TODO: Use all_of // TODO: Use all_of
...@@ -78,8 +83,6 @@ static void print_program(const program& p, F print_func) ...@@ -78,8 +83,6 @@ static void print_program(const program& p, F print_func)
} }
print_func(ins, names); print_func(ins, names);
count++;
} }
} }
......
...@@ -56,7 +56,7 @@ TEST_CASE(tanh_shape) ...@@ -56,7 +56,7 @@ TEST_CASE(tanh_shape)
if(ins->name() == "hip::allocate") if(ins->name() == "hip::allocate")
{ {
migraphx::shape wrong_s{migraphx::shape::float_type, {3, 2}, {1, 3}}; migraphx::shape wrong_s{migraphx::shape::float_type, {3, 2}, {1, 3}};
ins->replace(wrong_s); ins->replace(migraphx::gpu::hip_allocate{wrong_s});
} }
} }
EXPECT(p1 != p2); EXPECT(p1 != p2);
......
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