[WebGPU] Fix nearest half-tie handling for round_prefer_ceil/floor#28757
Open
haoxli wants to merge 3 commits into
Open
[WebGPU] Fix nearest half-tie handling for round_prefer_ceil/floor#28757haoxli wants to merge 3 commits into
haoxli wants to merge 3 commits into
Conversation
ResizeOpTest.ResizeOpNearestUpSample_RoundPreferCeil_HalfPixel_2x2to7x8 fails on Intel WebGPU devices: error: The difference between cur_expected[i] and cur_actual[i] is 2, which exceeds tolerance, where cur_expected[i] evaluates to 3, cur_actual[i] evaluates to 1, and tolerance evaluates to 0.00030999997397884727. The WebGPU shader logic used exact half-tie equality checks combined with i32 truncation arithmetic. This approach is fragile under GPU floating-point precision constraints and misbehaves on negative halfway coordinates. This change replaces the exact comparisons with a robust, epsilon-based fractional tie check (<= 1e-6) for both ROUND_PREFER_CEIL and ROUND_PREFER_FLOOR execution paths. Also add regression coverage for round_prefer_floor in resize_op_test.cc: - ResizeOpNearestUpSample_RoundPreferFloor_HalfPixel_2x2to7x8 - ResizeOpNearestUpSample_RoundPreferFloor_HalfPixel_GH28291_Regression
xadupre
previously approved these changes
Jun 3, 2026
qjia7
reviewed
Jun 4, 2026
Author
|
CI failure due to OOM: |
qjia7
approved these changes
Jun 5, 2026
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.
Description
ResizeOpTest.ResizeOpNearestUpSample_RoundPreferCeil_HalfPixel_2x2to7x8 fails on Intel WebGPU devices:
Motivation and Context
The WebGPU shader logic used exact half-tie equality checks combined with i32 truncation arithmetic. This approach is fragile under GPU floating-point precision constraints and misbehaves on negative halfway coordinates.
This change replaces the exact comparisons with a robust, epsilon-based fractional tie check (<= 1e-6) for both ROUND_PREFER_CEIL and ROUND_PREFER_FLOOR execution paths.
Also add regression coverage for round_prefer_floor in resize_op_test.cc: