[GPU] Fix fused eltwise rank reduction#36889
Open
wilson-seok wants to merge 2 commits into
Open
Conversation
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.
Contributor
There was a problem hiding this comment.
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. |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
This fixes two Intel GPU accuracy issues in
MotionDeblur/df1:Squeeze/Reshapeoperations. The GPU-local transformation accepts NumPy broadcasting only and rejects ambiguous, dynamic, overflowing, and PDPD cases before mutating the graph.The common transformation implementation remains unchanged, so CPU, NPU, and external common-pass users are unaffected.
Validation
Tested on Intel Arc B580 (
GPU.1):XW/XWYMotionDeblur/df1GPU model MSE versus captured reference:After-fix model MSEs were also reproduced on Intel PTL-H (366H):
9.5240e-06for default inference and3.1400e-11for 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.
The two defects are orthogonal — each output is recovered by exactly one fix:
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.