[GPU] Bugfix in resample_pil_ref#36549
Conversation
Signed-off-by: Min, Byungil <byungil.min@intel.com>
Signed-off-by: Min, Byungil <byungil.min@intel.com>
9368fec to
d1d6884
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes a crash in the GPU “Pillow reference” resample path for identity resampling (input spatial size equals output spatial size), and adds a regression test to ensure the identity case executes and produces correct output.
Changes:
- Force at least one resample pass (horizontal) when the operation is an identity resample to avoid constructing a primitive with zero kernels.
- Add a unit test covering the identity case for BILINEAR_PILLOW and BICUBIC_PILLOW modes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/plugins/intel_gpu/src/kernel_selector/kernels/resample/resample_kernel_pil_ref.cpp | Introduces identity detection and forces a horizontal pass to prevent zero-kernel execution crashes. |
| src/plugins/intel_gpu/tests/unit/test_cases/resample_gpu_test.cpp | Adds a regression test validating identity resample doesn’t crash and preserves values for Pillow modes. |
Signed-off-by: Min, Byungil <byungil.min@intel.com>
| return ExtractDim(params.outputs[0], params.axes[eVertical]).v; | ||
| } | ||
|
|
||
| bool IsIdentityResample(const resample_params& params) { |
There was a problem hiding this comment.
Not sure but this fix is acceptable as a short-term crash hotfix, but the correct long-term direction is to opt-out this kernel entirely for the identity case rather than forcing an unnecessary GPU kernel enqueue. Isn't it it?
There was a problem hiding this comment.
Agree with Hyunback. Maybe you can just skip the execution of the node. Dynamic quantization has similar bypass logic. It is implemented around should_skip_execution
There was a problem hiding this comment.
You are right. I think there will be next optimization pr for precision of code_predictor sub-model. I will apply the opt-out scenario.
There was a problem hiding this comment.
Currently, a target resample kernel is fused normalization case.
Following clamp+ subtract + multiply layers are fused to the resample_pil_ref kernel.
This case is generated by image pre-processing.
raw_frame(u8 NHWC) → Convert(f32) → Transpose(NCHW) → Interpolate BICUBIC_PILLOW(f32→f32, pads=0) → Clamp(0,255) → Subtract(mean) → Multiply(scale)
Description
Optimization of GPU offloading of image pre-processing caused execution failure. It is caused by assertion in resample kernel selection.
Detail
Pillow's CPU resample copies the input straight to the output when neither axis needs
resampling (input size == output size on both axes). The staged GPU pipeline derives the
number of passes from NeedHorizontalPass/NeedVerticalPass, so a true identity would emit
zero passes: the output is left unwritten and the primitive is built with zero kernels,
which crashes at execution. Force a single horizontal pass for the identity case; it runs
with scale==1 (identity) coefficients and copies the input to the output.
Tickets:
AI Assistance: