openvino
efbd45e7 - [GPU] use common shape inference for eltwise validation (#35566)

Commit
6 days ago
[GPU] use common shape inference for eltwise validation (#35566) ### Details This PR updates GPU eltwise static shape validation to use the common OpenVINO eltwise shape inference logic instead of a local manual broadcast check, and fixes a related Power-op miscompile where a scalar exponent combined with a broadcast-producing input shape was incorrectly lowered to a unary activation. The previous GPU validation path rejected a valid NumPy broadcast case for `Divide` with input shapes: - `[1, 1, 1, 8]` - `[1, 4, 1, 8]` This caused GPU `compile_model()` to fail even though the shape combination is valid and accepted by common shape inference. Separately, `CreatePowerOp` lowered `Power` to unary `activation_func::pow` whenever the exponent was a Constant of `shape_size == 1`, without checking whether the first input itself is broadcast against the exponent. For shapes like `input0 = [2]`, `input1 = [1, 1, 1, 1]`, the output must be `[1, 1, 1, 2]`, but the unary path keeps the input0 layout and produces an incorrect shape. ### Changes - `src/graph/eltwise.cpp` - Replace manual GPU eltwise broadcast validation with `ov::op::eltwise_shape_infer`, folding over all inputs and preserving the primitive `broadcast_spec` via a dummy `ov::op::v1::Add`. - Relax `need_align_for_numpy_broadcast` rank guard from `pshape_a_rank > 1 && pshape_b_rank > 1` to `small_pshape_rank > 0`, so rank-1 inputs (e.g. `[2]`) that participate in NumPy broadcast are aligned consistently with the common shape inference result. - `src/plugin/ops/eltwise.cpp` - In `CreatePowerOp`, additionally require `input0.partial_shape.same_scheme(output.partial_shape)` before lowering to unary `pow`. When the exponent is a scalar Constant but broadcast changes the output shape, fall back to the generic elementwise `pow` path. - `tests/functional/shared_tests_instances/single_layer_tests/eltwise.cpp` - Add `smoke_NumpyBroadcastDiv` (`[1,1,1,8]` vs `[1,4,1,8]`) regression for the Divide broadcast case. - Add `smoke_NumpyBroadcastPower` (`[2]` vs `[1,1,1,1]` Constant) regression for the Power lowering fix. ### Validation - Ran targeted regression tests: - `ov_gpu_func_tests --gtest_filter='smoke_NumpyBroadcastDiv/*'` - `ov_gpu_func_tests --gtest_filter='smoke_NumpyBroadcastPower/*'` ### Tickets: - 185355 ### AI Assistance: - AI assistance used: yes - AI: implement/build/tests - Human: review
Author
Parents
Loading