Skip to content

[GPU] Fix fused eltwise rank reduction#36889

Open
wilson-seok wants to merge 2 commits into
openvinotoolkit:masterfrom
wilson-seok:gpu/fix-df1-fused-eltwise-rank-reduction
Open

[GPU] Fix fused eltwise rank reduction#36889
wilson-seok wants to merge 2 commits into
openvinotoolkit:masterfrom
wilson-seok:gpu/fix-df1-fused-eltwise-rank-reduction

Conversation

@wilson-seok

@wilson-seok wilson-seok commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Details

This fixes two Intel GPU accuracy issues in MotionDeblur/df1:

  • Keep per-channel eltwise constants on the correct semantic axis when moving them through rank-changing Squeeze/Reshape operations. The GPU-local transformation accepts NumPy broadcasting only and rejects ambiguous, dynamic, overflowing, and PDPD cases before mutating the graph.
  • Prevent higher-rank fused eltwise peers from being indexed with an incompatible reduced-rank host layout. A shared overflow-safe fold proof validates peers against the actual reduced layout. Rank-reducing reorder fusion is declined whenever any external peer cannot be represented exactly, preserving the producer rank instead.

The common transformation implementation remains unchanged, so CPU, NPU, and external common-pass users are unaffected.

Validation

Tested on Intel Arc B580 (GPU.1):

  • Focused rank/fold matrix: 41/41, repeated 3 times
    • 7-case 5D broadcast matrix
    • all 16 spatial broadcast masks for a 6D host, including XW/XWY
    • 15 canonicalization guard tests
  • Full Permute suite: 844/844
  • Relevant neighboring fusion suite: 1957 passed, 21 hardware skips, 0 failures
  • GPU-local transformation tests: 10/10
  • Unchanged common transformation tests: 18/18

MotionDeblur/df1 GPU model MSE versus captured reference:

Configuration Before After
f16 default 2.383282e-02 9.524043e-06
f32 inference hint 2.376328e-02 3.140034e-11

After-fix model MSEs were also reproduced on Intel PTL-H (366H): 9.5240e-06 for default inference and 3.1400e-11 for the f32 hint.

All four f16 outputs are finite and stable; outputs 0/2/3 improve and output 1 is unchanged. The full runnable Blackmagic GPU.1 inventory shows no non-df1 MSE regression.

Output BEFORE (none) Fix 1/2 only Fix 3 only AFTER (all) Fixed by
output_0 1.04e‑2 1.18e‑4 1.04e‑2 1.99e‑6 Fix 1/2
output_1 2.24e‑4 2.24e‑4 2.24e‑4 2.24e‑4 — (off both paths)
output_2 2.52e‑1 2.52e‑1 1.87e‑4 1.87e‑4 Fix 3
output_3 1.11 1.11 3.41e‑4 3.41e‑4 Fix 3

The two defects are orthogonal — each output is recovered by exactly one fix:

  • Fix 1/2 (runtime fold) → recovers output_0 only. Fix 3 alone leaves it broken.
  • Fix 3 (transformation) → recovers output_2 & output_3 only. Fix 1/2 alone leaves them broken.
  • Fix 3 additionally sharpens output_0 in the full build (1.18e‑4 → 1.99e‑6, its per-channel input gets cleaner).

This corrects what I told you two turns ago. I had assumed Fix 3 → Defect A and Fix 1/2 → Defect B by reasoning; the measurement confirms the pairing but pins it to specific outputs, and shows neither fix alone is sufficient.

Keep per-channel eltwise transformations correct across rank-changing data movement.

Canonicalize provable higher-rank fused peers against the actual reduced layout and preserve producer rank when no exact fold exists.

Add regression coverage for 5D and exhaustive 6D broadcast masks.
@wilson-seok wilson-seok requested review from a team as code owners July 15, 2026 04:50
@github-actions github-actions Bot added the category: GPU OpenVINO GPU plugin label Jul 15, 2026
@wilson-seok wilson-seok requested a review from Copilot July 15, 2026 04:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses Intel GPU accuracy regressions caused by fused eltwise peers becoming rank-incompatible with a rank-reduced “host” layout (e.g., 5D peer being indexed as 4D after layout optimization), and by incorrectly moving per-channel constants across rank-changing data-movement ops.

Changes:

  • Add an overflow-safe folding proof (fold_higher_rank_fused_peer) and use it in OCL fused-op shape canonicalization to safely represent higher-rank peers at the host rank when possible.
  • Prevent rank-reducing reorder fusion when any fused higher-rank eltwise peer cannot be represented exactly at the reduced layout (keeps producer rank to preserve correct indexing).
  • Introduce a GPU-local “move per-channel eltwise up through reshape/squeeze/unsqueeze” transformation and add targeted unit/regression tests (including df1-like reproducers and broadcast matrices).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/plugins/intel_gpu/src/graph/impls/ocl/kernel_selector_helper.h Canonicalize fused eltwise peer shapes by folding higher-rank peers to the host rank when provable; avoid assertions for unsupported cases.
src/plugins/intel_gpu/src/graph/include/fused_shape_utils.hpp New shared, overflow-safe helper implementing the fold proof for higher-rank fused peers.
src/plugins/intel_gpu/src/graph/layout_optimizer.cpp Gate rank-reducing reorder fusion on whether all higher-rank fused eltwise peers can fold to the reduced layout.
src/plugins/intel_gpu/src/plugin/transformations/move_eltwise_up_data_movement_per_channel.hpp New GPU-local MatcherPass declaration for per-channel eltwise motion through rank-changing ops.
src/plugins/intel_gpu/src/plugin/transformations/move_eltwise_up_data_movement_per_channel.cpp GPU-local transformation implementation with stricter guards (NumPy-only, static/overflow-safe/unique-axis checks).
src/plugins/intel_gpu/src/plugin/transformations_pipeline.cpp Register the GPU-local per-channel eltwise move pass in the GPU transformation pipeline.
src/plugins/intel_gpu/tests/unit/transformations/move_eltwise_up_data_movement_per_channel_test.cpp Unit tests validating legal moves and explicit rejection/guard cases for the new GPU-local pass.
src/plugins/intel_gpu/tests/unit/module_tests/canonicalize_fused_shapes_test.cpp Unit coverage for the fold proof across equal-total, broadcast, padding/format/dynamic/overflow rejection scenarios.
src/plugins/intel_gpu/tests/unit/fusions/permute_fusion_test.cpp Large end-to-end regression coverage reproducing df1-like rank mismatch and broadcast matrices, asserting both fusion state and numerical correctness.

Comment thread src/plugins/intel_gpu/tests/unit/fusions/permute_fusion_test.cpp Outdated
Address Copilot review comment on PR openvinotoolkit#36889: consolidate the new
reproducer's #include statements into the file's top include block
instead of mid-file, matching the file's convention.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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