Skip to content

[GPU] Enable custom op with dynamic shape #30880

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

xipingyan
Copy link
Contributor

@xipingyan xipingyan commented Jun 6, 2025

Details:

  • Wrapper gws and lws calculation, and move it to custom_gpu_primitive.hpp
  • Pass OP(customer provided) to cldnn::custom_gpu_primitive, we need to call it(new_op->validate_and_infer_types()) to inference real output shape.
  • WIP: Test case.

Tickets:

@github-actions github-actions bot added the category: GPU OpenVINO GPU plugin label Jun 6, 2025
@xipingyan xipingyan requested a review from peterchen-intel June 6, 2025 06:17
: primitive_base(id, inputs, 1, {optional_data_type()}, {output_layout.data_padding}),
kernel_entry_point(kernel_entry_point),
kernel_arguments(kernel_arguments),
build_options(build_options),
output_layout(output_layout),
gws(gws.size() ? gws : std::vector<size_t>{output_layout.count()}),
lws(lws),
kernels_code(kernels_code) {}
kernels_code(kernels_code),
op(op),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to clone it? Not sure if there are some ops references kept, the model could be released to recycle the memory.


auto op = impl_param.typed_desc<custom_gpu_primitive>()->op;
auto new_op = op->clone_with_new_inputs(new_inputs);
new_op->validate_and_infer_types();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In rare case, the shape infer may depend on the input data and it should not work here. Maybe we can detect the case and report error to the user?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants