Skip to content

[webgpu] Fix div precision#27662

Open
xenova wants to merge 2 commits intomicrosoft:mainfrom
xenova:webgpu-fix-div-precision
Open

[webgpu] Fix div precision#27662
xenova wants to merge 2 commits intomicrosoft:mainfrom
xenova:webgpu-fix-div-precision

Conversation

@xenova
Copy link
Contributor

@xenova xenova commented Mar 15, 2026

Description

For float types, GPU f32 division can introduce small ULP errors that cause exact integer quotients to be slightly off (e.g., 165.0/15.0 = 11.000001). When followed by Ceil (like it is for granite speech), this produces wrong results. We fix this by rounding the result when the operands are exactly divisible.

Motivation and Context

Closes #27661

@xenova
Copy link
Contributor Author

xenova commented Mar 15, 2026

cc @guschmue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebGPU] Div -> Ceil produces incorrect results due to floating point precision issues when operands are float casts of integers

1 participant