"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "5d745540c6e3d9e286931a4e0eb3fbfda251f7ba"
Commit 6d59be1b authored by Gyula Zakor's avatar Gyula Zakor
Browse files

Fix gpu::contiguous elimination bug

When testing gpu::contiguous instruction replacability recursive calls to try_compute_shape can pick up gpu::contiguous instructions as well.
These instructions always passes the try_compute_shape check because compute_shape of gpu::contiguous always returns a standard shape, thus propagating false `true` values upwards.
For these corner cases we must demand the standard shape of the inputs as well, to avoid ellimination of needed gpu::contiguous instructions.
parent d1305d0c
......@@ -41,6 +41,14 @@ static bool try_compute_shape(instruction_ref ins,
const std::vector<shape>& inputs,
const std::vector<module_ref>& mods)
{
// compute_shape of gpu::contiguous always returns a standard shape
// this can propagate false `true` values for non standard shapes in recursive try_compute_shape
// calls
if(ins->name() == "gpu::contiguous" &&
std::any_of(inputs.begin(), inputs.end(), [&](auto& shape) { return not shape.standard(); }))
{
return false;
}
try
{
shape new_shape = ins->get_operator().compute_shape(inputs, mods);
......
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