Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ShapeOf-V1 and ShapeOf-V3 do not support i64 outputs on GPU #28360

Open
3 tasks done
vihangm opened this issue Jan 9, 2025 · 3 comments
Open
3 tasks done

[Bug]: ShapeOf-V1 and ShapeOf-V3 do not support i64 outputs on GPU #28360

vihangm opened this issue Jan 9, 2025 · 3 comments
Assignees
Labels
bug Something isn't working category: GPU OpenVINO GPU plugin support_request

Comments

@vihangm
Copy link

vihangm commented Jan 9, 2025

OpenVINO Version

2024.6.0

Operating System

Ubuntu 20.04 (LTS)

Device used for inference

GPU

Framework

None

Model used

No response

Issue description

ShapeOf-V1 has i64 outputs. Running it on a GPU produces a shape that is all zeroes.
ShapeOf-V3 produces expected output in i32 mode on the GPU but produces all zeroes when using i64.

Step-by-step reproduction

To repro

import torch
from torch.nn import Module
import openvino as ov
import numpy as np


def compile_torch(model, input_data):
    ov_model = ov.convert_model(model, example_input=input_data)
    ir_path = f"shapeof_ov.xml"
    ov.save_model(ov_model, ir_path)
    core = ov.Core()
    model = core.read_model(ir_path)

    compiled_model = core.compile_model(model=model, device_name='GPU')
    result = compiled_model(input_data)
    return result.to_tuple()

input_data = torch.randn([2, 7, 3])


class shape_of(Module):
    def forward(self, *args):
        return args[0].shape

torch_model = shape_of().eval()
torch_outputs = torch_model(input_data)

trace = torch.jit.trace(torch_model, input_data)
trace = torch.jit.freeze(trace)

input_shapes = input_data.shape
res_ov = compile_torch(trace, input_data)
np.testing.assert_allclose(torch_outputs, res_ov, rtol=1e-3, atol=1e-3)

This produces the graph:

<net name="Model27" version="11">
        <layers>
                <layer id="0" name="1" type="Parameter" version="opset1">
                        <data shape="?,?,?" element_type="f32" />
                        <output>
                                <port id="0" precision="FP32" names="1">
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                </port>
                        </output>
                </layer>
                <layer id="1" name="aten::size/ShapeOf" type="ShapeOf" version="opset3">
                        <data output_type="i64" />
                        <input>
                                <port id="0" precision="FP32">
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                </port>
                        </input>
                        <output>
                                <port id="1" precision="I64">
                                        <dim>3</dim>
                                </port>
                        </output>
                </layer>
... snip ...

Note that this graph does produce the expected result

<?xml version="1.0"?>
<net name="Model6" version="11">
        <layers>
                <layer id="0" name="1" type="Parameter" version="opset1">
                        <data shape="?,?,?,?" element_type="f32" />
                        <output>
                                <port id="0" precision="FP32" names="1">
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                </port>
                        </output>
                </layer>
                <layer id="1" name="aten::size/ShapeOf" type="ShapeOf" version="opset3">
                        <data output_type="i32" />
                        <input>
                                <port id="0" precision="FP32">
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                        <dim>-1</dim>
                                </port>
                        </input>
                        <output>
                                <port id="1" precision="I32">
                                        <dim>4</dim>
                                </port>
                        </output>
                </layer>
                <layer id="5" name="Result_5628" type="Result" version="opset1">
                        <input>
                                <port id="0" precision="I32">
                    <dim>4</dim>
                </port>
                        </input>
                </layer>
        </layers>
        <edges>
                <edge from-layer="0" from-port="0" to-layer="1" to-port="0" />
                <edge from-layer="1" from-port="1" to-layer="5" to-port="0" />
        </edges>
        <rt_info>
                <Runtime_version value="2024.6.0-17404-4c0f47d2335-releases/2024/6" />
                <conversion_parameters>
                        <framework value="pytorch" />
                        <is_python_object value="True" />
                </conversion_parameters>
        </rt_info>
</net>

Relevant log output

No response

Issue submission checklist

  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
  • There is reproducer code and related data files such as images, videos, models, etc.
@vihangm vihangm added bug Something isn't working support_request labels Jan 9, 2025
@rkazants rkazants added the category: GPU OpenVINO GPU plugin label Jan 10, 2025
@vihangm
Copy link
Author

vihangm commented Jan 10, 2025

Added note, I tried this same script on a NUC with an iGPU and it produces expected results.
However when I run it on a server machine with a Ponte Vecchio GPU, it fails.

Trying various openvino versions seems to show the same output so perhaps it's related to the GPU driver or ICR version.
The NUC says it's driver version is 23.35.27191.9 while the Ponte Vecchio is running 24.39.31294.12.

@DipayanDasgupta
Copy link

.take

Copy link
Contributor

Thanks for being interested in this issue. It looks like this ticket is already assigned to a contributor. Please communicate with the assigned contributor to confirm the status of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working category: GPU OpenVINO GPU plugin support_request
Projects
None yet
Development

No branches or pull requests

5 participants