8000 Widen tanh acceptable range (output values) by petermcneeleychromium · Pull Request #5199 · gpuweb/gpuweb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Widen tanh acceptable range (output values) #5199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

petermcneeleychromium
Copy link
Contributor
@petermcneeleychromium petermcneeleychromium commented May 21, 2025

After a bit of investigation it has been determined that tanh has a max Absolute error of 1e-5 for some devices (nvidia)

We discussed polyfilling this function (sinh/cosh) but this inaccuracy is likely intentional as tanh is commonly used in sigmoid functions for ML.

crbug.com/390221422

Copy link
Contributor

Previews, as seen when this build job started (7da6fc3):
WebGPU webgpu.idl | Explainer | Correspondence Reference
WGSL grammar.js | wgsl.lalr.txt

@petermcneeleychromium
Copy link
Contributor Author

Assuming this pr gets approved this pull is waiting in the wings
gpuweb/cts#4392

Copy link
Contributor
@dneto0 dneto0 left a comment

Choose a reason for hiding this comment

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

Please attach images of the errors you found for the NVIDIA and Intel devices.

This spec change will need approval by the WG, but I think the CTS change should land sooner.

@dneto0 dneto0 added this to the Milestone 1 milestone May 22, 2025
@petermcneeleychromium
Copy link
Contributor Author

I evaluated the precision of existing webgpu tanh on nvidia (hlsl) and intel (vulkan)
Nvidia simply has low precision

Here is the data shared via sheets (chromium account)
https://docs.google.com/spreadsheets/d/1i5n8sFlkHi0QrFwa00oXVcY8iBo6VftXzxOsziWzrsg/edit?gid=176471445#gid=176471445

@petermcneeleychromium
Copy link
Contributor Author

Waiting on
#5206

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.

2 participants
0