Skip to content

[GPU] Skip in-place concat when a predecessor is in a shape-of subgraph#36767

Queued
andrew-k-park wants to merge 1 commit into
openvinotoolkit:masterfrom
andrew-k-park:fix-gpu-concat-inplace-shape-of-padding
Queued

[GPU] Skip in-place concat when a predecessor is in a shape-of subgraph#36767
andrew-k-park wants to merge 1 commit into
openvinotoolkit:masterfrom
andrew-k-park:fix-gpu-concat-inplace-shape-of-padding

Conversation

@andrew-k-park

Copy link
Copy Markdown
Contributor

Description of the issue (symptom, root-cause, how it was resolved)

  • Symptom: [GPU] Padded output is not supported yet thrown from crop_cpu_impl during inference when a concat mixes a shape-of subgraph input with a regular one. Reproduced on GPU with a model that has a shape-of subgraph (ShapeOf -> ... -> VariadicSplit) inside a Loop body.
  • Root cause: concat_in_place_optimization forces offset padding on its predecessor outputs so they can write directly into the concat output buffer. Nodes inside a shape-of subgraph run on CPU impls (e.g. crop lowered from VariadicSplit) which do not support padded output. The existing guard only checked concat_node.is_in_shape_of_subgraph() — when the concat itself is outside the subgraph but one of its predecessors is inside it, the optimization still fired and the CPU crop impl asserted at runtime.
  • Resolution: In the predecessor loop of concat_in_place_optimization::match, reject the optimization when any predecessor is_in_shape_of_subgraph(). The concat then uses an explicit (non-in-place) implementation, so no padding is forced on the CPU-impl predecessor. Behavior for non-shape-of predecessors is unchanged.

The code and line that caused this issue (if it is not changed directly)

  • intel_gpu/src/graph/impls/cpu/crop.cpp:65
    • OPENVINO_ASSERT(!padded_output, "[GPU] Padded output is not supported yet") — CPU crop impl cannot produce a padded output.
  • intel_gpu/src/graph/graph_optimizer/prepare_buffer_fusing.cpp
    • concat_in_place_optimization::match() — existing guard checked only the concat node, not its predecessors.

Reproduction step and snapshot (if applicable. Do not attach for customer model)

Minimal graph inside a shape-of subgraph reaching the CPU crop impl:

input -> ShapeOf -> Gather -> VariadicSplit -> crop.out1[3] -+   (CPU impl, in shape-of subgraph)
                                                             |
                          eltwise (out of subgraph) ---------+-> Concat -> ...

Concat is outside the subgraph → passes the existing guard → in-place optimization forces padded output on crop.out1 → CPU crop impl throws at runtime.

Regression test: ov_gpu_unit_tests --gtest_filter='prepare_buffer_fusing.in_place_concat_rejected_for_shape_of_subgraph_input'

Problematic graph

                    shape-of subgraph (CPU impls)
       +------------------------------------------------+
input->| ShapeOf -> Gather -> VariadicSplit -> crop1 ---|--+
       +------------------------------------------------+  |
                                                           +-> Concat -> ...
                       eltwise (outside subgraph) ---------+

crop1 is a CPU-impl node inside the shape-of subgraph; Concat sits outside it. In-place concat makes crop1 write with an offset into the shared buffer (padded output), which the CPU crop impl does not support.

Checklist

  • Is it a proper fix? (not a workaround)
  • Did you include test case for this fix, if necessary?
  • Did you review existing test that can be extended to cover this scenario? Which test did you review? — Reviewed prepare_buffer_fusing_test.cpp; existing in_place_concat_* tests use regular (non-shape-of) predecessors and don't exercise the CPU-impl padded-output path, so a new test was added.

Tickets:

concat_in_place_optimization forces offset padding on predecessor outputs,
but shape-of subgraph nodes run on CPU impls that don't support padded
output. When such a node (e.g. a crop lowered from VariadicSplit) feeds a
concat that is itself outside the subgraph, in-place concat made the CPU
crop impl assert at runtime:

  Check '!padded_output' failed at .../impls/cpu/crop.cpp:65:
  [GPU] Padded output is not supported yet

The existing guard only checked concat_node.is_in_shape_of_subgraph(), which
misses this case. Reject the optimization when any predecessor is in a
shape-of subgraph. Adds a unit test reproducing the crash.
@andrew-k-park andrew-k-park requested review from a team as code owners July 8, 2026 06:00
@github-actions github-actions Bot added the category: GPU OpenVINO GPU plugin label Jul 8, 2026
@andrew-k-park andrew-k-park added this to the 2026.3 milestone Jul 8, 2026
@e-ddykim e-ddykim enabled auto-merge July 8, 2026 07:33
@e-ddykim e-ddykim added this pull request to the merge queue Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: GPU OpenVINO GPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants